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

Method GenerateDenseArray

Filters/Sources/vtkDiagonalMatrixSource.cxx:93–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93vtkArray* vtkDiagonalMatrixSource::GenerateDenseArray()
94{
95 vtkDenseArray<double>* const array = vtkDenseArray<double>::New();
96 array->Resize(vtkArrayExtents::Uniform(2, this->Extents));
97 array->SetDimensionLabel(0, this->RowLabel);
98 array->SetDimensionLabel(1, this->ColumnLabel);
99
100 array->Fill(0.0);
101
102 if (this->Diagonal != 0.0)
103 {
104 for (vtkIdType i = 0; i != this->Extents; ++i)
105 array->SetValue(vtkArrayCoordinates(i, i), this->Diagonal);
106 }
107
108 if (this->SuperDiagonal != 0.0)
109 {
110 for (vtkIdType i = 0; i + 1 != this->Extents; ++i)
111 array->SetValue(vtkArrayCoordinates(i, i + 1), this->SuperDiagonal);
112 }
113
114 if (this->SubDiagonal != 0.0)
115 {
116 for (vtkIdType i = 0; i + 1 != this->Extents; ++i)
117 array->SetValue(vtkArrayCoordinates(i + 1, i), this->SubDiagonal);
118 }
119
120 return array;
121}
122
123vtkArray* vtkDiagonalMatrixSource::GenerateSparseArray()
124{

Callers 1

RequestDataMethod · 0.95

Calls 5

SetDimensionLabelMethod · 0.80
NewFunction · 0.50
ResizeMethod · 0.45
FillMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected