MCPcopy Create free account
hub / github.com/Kitware/VTK / CopyStructure

Method CopyStructure

Common/DataModel/vtkFieldData.cxx:335–368  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

333
334//------------------------------------------------------------------------------
335void 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.

Callers 1

DeepCopyMethod · 0.95

Calls 14

InitializeFieldsMethod · 0.95
AllocateArraysMethod · 0.95
SetArrayMethod · 0.95
SetComponentNameMethod · 0.80
GetComponentNameMethod · 0.80
DeleteMethod · 0.65
GetNumberOfArraysMethod · 0.45
NewInstanceMethod · 0.45
GetNumberOfComponentsMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNameMethod · 0.45
GetNameMethod · 0.45

Tested by

no test coverage detected