| 27 | } |
| 28 | |
| 29 | bool vtkCellGridSampleQuery::Initialize() |
| 30 | { |
| 31 | this->Superclass::Initialize(); |
| 32 | |
| 33 | this->OutputOffsets.clear(); |
| 34 | this->AttributeMap.clear(); |
| 35 | this->MaximumParametricDimension = 0; |
| 36 | this->SourceCellId = nullptr; |
| 37 | this->SourceCellType = nullptr; |
| 38 | this->SourceCellSite = nullptr; |
| 39 | if (!this->Input || !this->Output) |
| 40 | { |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | if (this->IncludeSourceCellInfo) |
| 45 | { |
| 46 | this->SourceCellType = |
| 47 | vtkTypeUInt32Array::SafeDownCast(this->Output->GetColumnByName("SourceCellType")); |
| 48 | if (!this->SourceCellType) |
| 49 | { |
| 50 | this->SourceCellType = vtkSmartPointer<vtkTypeUInt32Array>::New(); |
| 51 | this->SourceCellType->SetName("SourceCellType"); |
| 52 | this->Output->AddColumn(this->SourceCellType); |
| 53 | } |
| 54 | |
| 55 | this->SourceCellId = |
| 56 | vtkIdTypeArray::SafeDownCast(this->Output->GetColumnByName("vtkOriginalCellIds")); |
| 57 | if (!this->SourceCellId) |
| 58 | { |
| 59 | this->SourceCellId = vtkSmartPointer<vtkIdTypeArray>::New(); |
| 60 | this->SourceCellType->SetName("vtkOriginalCellIds"); |
| 61 | this->Output->AddColumn(this->SourceCellId); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | if (this->IncludeSourceCellSite) |
| 66 | { |
| 67 | this->SourceCellSite = |
| 68 | vtkDataArray::SafeDownCast(this->Output->GetColumnByName("SourceCellSite")); |
| 69 | if (!this->SourceCellSite) |
| 70 | { |
| 71 | this->SourceCellSite = vtkSmartPointer<vtkDoubleArray>::New(); |
| 72 | this->SourceCellSite->SetName("SourceCellSite"); |
| 73 | this->Output->AddColumn(this->SourceCellSite); |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | for (const auto& inputAtt : this->Input->GetCellAttributeList()) |
| 78 | { |
| 79 | vtkNew<vtkDoubleArray> outputCol; |
| 80 | outputCol->SetNumberOfComponents(inputAtt->GetNumberOfComponents()); |
| 81 | outputCol->SetName(inputAtt->GetName().Data().c_str()); |
| 82 | this->Output->AddColumn(outputCol); |
| 83 | this->AttributeMap[inputAtt] = outputCol; |
| 84 | } |
| 85 | |
| 86 | return true; |
nothing calls this directly
no test coverage detected