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

Method DeepCopy

Common/DataModel/vtkHyperTreeGrid.cxx:1075–1154  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

1073
1074//------------------------------------------------------------------------------
1075void vtkHyperTreeGrid::DeepCopy(vtkDataObject* src)
1076{
1077 assert("pre: src_exists" && src != nullptr);
1078 vtkHyperTreeGrid* htg = vtkHyperTreeGrid::SafeDownCast(src);
1079 assert("pre: same_type" && htg != nullptr);
1080
1081 // Copy grid parameters
1082 this->Dimension = htg->Dimension;
1083 this->Orientation = htg->Orientation;
1084 this->BranchFactor = htg->BranchFactor;
1085 this->NumberOfChildren = htg->NumberOfChildren;
1086 this->DepthLimiter = htg->DepthLimiter;
1087 this->TransposedRootIndexing = htg->TransposedRootIndexing;
1088 memcpy(this->Axis, htg->GetAxes(), 2 * sizeof(unsigned int));
1089
1090 this->HasInterface = htg->HasInterface;
1091 this->SetInterfaceNormalsName(htg->InterfaceNormalsName);
1092 this->SetInterfaceInterceptsName(htg->InterfaceInterceptsName);
1093
1094 if (htg->Mask)
1095 {
1096 vtkNew<vtkBitArray> mask;
1097 this->SetMask(mask);
1098 this->Mask->DeepCopy(htg->Mask);
1099 }
1100
1101 if (htg->PureMask)
1102 {
1103 if (!this->PureMask)
1104 {
1105 this->PureMask = vtkBitArray::New();
1106 }
1107 this->PureMask->DeepCopy(htg->PureMask);
1108 }
1109
1110 this->CellData->DeepCopy(htg->GetCellData());
1111
1112 // Rectilinear part
1113 memcpy(this->Dimensions, htg->GetDimensions(), 3 * sizeof(unsigned int));
1114 memcpy(this->Extent, htg->GetExtent(), 6 * sizeof(int));
1115 memcpy(this->CellDims, htg->GetCellDims(), 3 * sizeof(unsigned int));
1116 this->DataDescription = htg->DataDescription;
1117
1118 this->WithCoordinates = htg->WithCoordinates;
1119
1120 if (this->WithCoordinates)
1121 {
1122 vtkDoubleArray* s;
1123 s = vtkDoubleArray::New();
1124 s->DeepCopy(htg->XCoordinates);
1125 this->SetXCoordinates(s);
1126 s->Delete();
1127 s = vtkDoubleArray::New();
1128 s->DeepCopy(htg->YCoordinates);
1129 this->SetYCoordinates(s);
1130 s->Delete();
1131 s = vtkDoubleArray::New();
1132 s->DeepCopy(htg->ZCoordinates);

Callers 2

CopyEmptyStructureMethod · 0.45
CopyStructureMethod · 0.45

Calls 15

SetMaskMethod · 0.95
DeleteMethod · 0.65
assertFunction · 0.50
NewFunction · 0.50
GetCellDataMethod · 0.45
GetDimensionsMethod · 0.45
GetExtentMethod · 0.45
GetCellDimsMethod · 0.45
SetXCoordinatesMethod · 0.45
SetYCoordinatesMethod · 0.45
SetZCoordinatesMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected