| 59 | //------------------------------------------------------------------------------ |
| 60 | |
| 61 | int vtkDiagonalMatrixSource::RequestData( |
| 62 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 63 | { |
| 64 | if (this->Extents < 1) |
| 65 | { |
| 66 | vtkErrorMacro(<< "Invalid matrix extents: " << this->Extents << "x" << this->Extents |
| 67 | << " array is not supported."); |
| 68 | return 0; |
| 69 | } |
| 70 | |
| 71 | vtkArray* array = nullptr; |
| 72 | switch (this->ArrayType) |
| 73 | { |
| 74 | case DENSE: |
| 75 | array = this->GenerateDenseArray(); |
| 76 | break; |
| 77 | case SPARSE: |
| 78 | array = this->GenerateSparseArray(); |
| 79 | break; |
| 80 | default: |
| 81 | vtkErrorMacro(<< "Invalid array type: " << this->ArrayType << "."); |
| 82 | return 0; |
| 83 | } |
| 84 | |
| 85 | vtkArrayData* const output = vtkArrayData::GetData(outputVector); |
| 86 | output->ClearArrays(); |
| 87 | output->AddArray(array); |
| 88 | array->Delete(); |
| 89 | |
| 90 | return 1; |
| 91 | } |
| 92 | |
| 93 | vtkArray* vtkDiagonalMatrixSource::GenerateDenseArray() |
| 94 | { |
nothing calls this directly
no test coverage detected