------------------------------------------------------------------------------
| 58 | |
| 59 | //------------------------------------------------------------------------------ |
| 60 | void vtkXMLPDataReader::SetupOutputData() |
| 61 | { |
| 62 | this->Superclass::SetupOutputData(); |
| 63 | |
| 64 | // Setup the output arrays. |
| 65 | vtkXMLDataElement* ePointData = this->PPointDataElement; |
| 66 | vtkXMLDataElement* eCellData = this->PCellDataElement; |
| 67 | vtkDataSet* output = vtkDataSet::SafeDownCast(this->GetCurrentOutput()); |
| 68 | vtkPointData* pointData = output->GetPointData(); |
| 69 | vtkCellData* cellData = output->GetCellData(); |
| 70 | |
| 71 | // Get the size of the output arrays. |
| 72 | unsigned long pointTuples = this->GetNumberOfPoints(); |
| 73 | unsigned long cellTuples = this->GetNumberOfCells(); |
| 74 | |
| 75 | // Allocate data in the arrays. |
| 76 | int i; |
| 77 | if (ePointData) |
| 78 | { |
| 79 | std::vector<vtkXMLDataElement*> elementsToRemove; |
| 80 | for (i = 0; i < ePointData->GetNumberOfNestedElements(); ++i) |
| 81 | { |
| 82 | vtkXMLDataElement* eNested = ePointData->GetNestedElement(i); |
| 83 | const char* ename = eNested->GetAttribute("Name"); |
| 84 | if (this->PointDataArrayIsEnabled(eNested)) |
| 85 | { |
| 86 | if (!pointData->HasArray(ename)) |
| 87 | { |
| 88 | vtkAbstractArray* array = this->CreateArray(eNested); |
| 89 | if (array) |
| 90 | { |
| 91 | array->SetNumberOfTuples(pointTuples); |
| 92 | pointData->AddArray(array); |
| 93 | array->Delete(); |
| 94 | } |
| 95 | else |
| 96 | { |
| 97 | this->DataError = 1; |
| 98 | } |
| 99 | } |
| 100 | else |
| 101 | { |
| 102 | vtkWarningMacro( |
| 103 | "Another point data array named " << ename << " already exists. Ignoring."); |
| 104 | elementsToRemove.push_back(eNested); |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | for (const auto& elem : elementsToRemove) |
| 109 | { |
| 110 | ePointData->RemoveNestedElement(elem); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | if (eCellData) |
| 115 | { |
| 116 | std::vector<vtkXMLDataElement*> elementsToRemove; |
| 117 | for (i = 0; i < eCellData->GetNumberOfNestedElements(); i++) |
nothing calls this directly
no test coverage detected