------------------------------------------------------------------------------
| 333 | |
| 334 | //------------------------------------------------------------------------------ |
| 335 | void vtkFieldData::CopyStructure(vtkFieldData* inputField) |
| 336 | { |
| 337 | // Free old fields. |
| 338 | this->InitializeFields(); |
| 339 | |
| 340 | // Allocate new fields. |
| 341 | this->AllocateArrays(inputField->GetNumberOfArrays()); |
| 342 | this->NumberOfActiveArrays = inputField->GetNumberOfArrays(); |
| 343 | |
| 344 | // Copy the data array's structure (ie nTups,nComps,name, and info) |
| 345 | // don't copy their data. |
| 346 | for (int arrayIdx = 0; arrayIdx < inputField->GetNumberOfArrays(); ++arrayIdx) |
| 347 | { |
| 348 | if (!inputField->Data[arrayIdx]) |
| 349 | { |
| 350 | continue; |
| 351 | } |
| 352 | |
| 353 | vtkAbstractArray* data = inputField->Data[arrayIdx]->NewInstance(); |
| 354 | int numComponents = inputField->Data[arrayIdx]->GetNumberOfComponents(); |
| 355 | data->SetNumberOfComponents(numComponents); |
| 356 | data->SetName(inputField->Data[arrayIdx]->GetName()); |
| 357 | for (vtkIdType j = 0; j < numComponents; ++j) |
| 358 | { |
| 359 | data->SetComponentName(j, inputField->Data[arrayIdx]->GetComponentName(j)); |
| 360 | } |
| 361 | if (inputField->Data[arrayIdx]->HasInformation()) |
| 362 | { |
| 363 | data->CopyInformation(inputField->Data[arrayIdx]->GetInformation(), /*deep=*/1); |
| 364 | } |
| 365 | this->SetArray(arrayIdx, data); |
| 366 | data->Delete(); |
| 367 | } |
| 368 | } |
| 369 | |
| 370 | //------------------------------------------------------------------------------ |
| 371 | // Set the number of arrays used to define the field. |
no test coverage detected