------------------------------------------------------------------------------
| 234 | |
| 235 | //------------------------------------------------------------------------------ |
| 236 | void vtkXMLDataReader::SetupOutputData() |
| 237 | { |
| 238 | this->Superclass::SetupOutputData(); |
| 239 | |
| 240 | vtkDataSet* output = vtkDataSet::SafeDownCast(this->GetCurrentOutput()); |
| 241 | vtkPointData* pointData = output->GetPointData(); |
| 242 | vtkCellData* cellData = output->GetCellData(); |
| 243 | |
| 244 | // Get the size of the output arrays. |
| 245 | vtkIdType pointTuples = this->GetNumberOfPoints(); |
| 246 | vtkIdType cellTuples = this->GetNumberOfCells(); |
| 247 | |
| 248 | // Allocate the arrays in the output. We only need the information |
| 249 | // from one piece because all pieces have the same set of arrays. |
| 250 | vtkXMLDataElement* ePointData = this->PointDataElements[0]; |
| 251 | vtkXMLDataElement* eCellData = this->CellDataElements[0]; |
| 252 | |
| 253 | this->NumberOfPointArrays = 0; |
| 254 | this->PointDataTimeStep->clear(); |
| 255 | this->PointDataOffset->clear(); |
| 256 | if (ePointData) |
| 257 | { |
| 258 | this->MarkIdTypeArrays(ePointData); |
| 259 | std::vector<vtkXMLDataElement*> elementsToRemove; |
| 260 | for (int i = 0; i < ePointData->GetNumberOfNestedElements(); ++i) |
| 261 | { |
| 262 | vtkXMLDataElement* eNested = ePointData->GetNestedElement(i); |
| 263 | const char* ename = eNested->GetAttribute("Name"); |
| 264 | if (this->PointDataArrayIsEnabled(eNested)) |
| 265 | { |
| 266 | if (!pointData->HasArray(ename)) |
| 267 | { |
| 268 | this->NumberOfPointArrays++; |
| 269 | (*this->PointDataTimeStep)[ename] = -1; |
| 270 | (*this->PointDataOffset)[ename] = -1; |
| 271 | vtkAbstractArray* array = this->CreateArray(eNested); |
| 272 | if (array) |
| 273 | { |
| 274 | array->SetNumberOfTuples(pointTuples); |
| 275 | pointData->AddArray(array); |
| 276 | array->Delete(); |
| 277 | } |
| 278 | else |
| 279 | { |
| 280 | this->DataError = 1; |
| 281 | } |
| 282 | } |
| 283 | else |
| 284 | { |
| 285 | vtkWarningMacro( |
| 286 | "Another point data array named " << ename << " already exists. Ignoring."); |
| 287 | elementsToRemove.push_back(eNested); |
| 288 | } |
| 289 | } |
| 290 | } |
| 291 | for (const auto& elem : elementsToRemove) |
| 292 | { |
| 293 | ePointData->RemoveNestedElement(elem); |
nothing calls this directly
no test coverage detected