MCPcopy Create free account
hub / github.com/Kitware/VTK / GenerateSparseArray

Method GenerateSparseArray

Filters/Sources/vtkDiagonalMatrixSource.cxx:123–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123vtkArray* vtkDiagonalMatrixSource::GenerateSparseArray()
124{
125 vtkSparseArray<double>* const array = vtkSparseArray<double>::New();
126 array->Resize(vtkArrayExtents::Uniform(2, this->Extents));
127 array->SetDimensionLabel(0, this->RowLabel);
128 array->SetDimensionLabel(1, this->ColumnLabel);
129
130 if (this->Diagonal != 0.0)
131 {
132 for (vtkIdType i = 0; i != this->Extents; ++i)
133 array->AddValue(vtkArrayCoordinates(i, i), this->Diagonal);
134 }
135
136 if (this->SuperDiagonal != 0.0)
137 {
138 for (vtkIdType i = 0; i + 1 != this->Extents; ++i)
139 array->AddValue(vtkArrayCoordinates(i, i + 1), this->SuperDiagonal);
140 }
141
142 if (this->SubDiagonal != 0.0)
143 {
144 for (vtkIdType i = 0; i + 1 != this->Extents; ++i)
145 array->AddValue(vtkArrayCoordinates(i + 1, i), this->SubDiagonal);
146 }
147
148 return array;
149}
150VTK_ABI_NAMESPACE_END

Callers 1

RequestDataMethod · 0.95

Calls 4

SetDimensionLabelMethod · 0.80
AddValueMethod · 0.80
NewFunction · 0.50
ResizeMethod · 0.45

Tested by

no test coverage detected