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

Method DeepCopy

Common/Core/vtkDataArray_DeepCopy.cxx:126–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

124} // end anon namespace
125
126VTK_ABI_NAMESPACE_BEGIN
127//------------------------------------------------------------------------------
128// Normally subclasses will do this when the input and output type of the
129// DeepCopy are the same. When they are not the same, then we use the
130// templated code below.
131void vtkDataArray::DeepCopy(vtkDataArray* da)
132{
133 // Match the behavior of the old AttributeData
134 if (da == nullptr)
135 {
136 return;
137 }
138
139 if (this != da)
140 {
141 this->Superclass::DeepCopy(da); // copy Information object
142
143 vtkIdType numTuples = da->GetNumberOfTuples();
144 int numComps = da->NumberOfComponents;
145
146 this->SetNumberOfComponents(numComps);
147 this->SetNumberOfTuples(numTuples);
148
149 if (numTuples != 0)
150 {
151 DeepCopyWorker worker;
152 if (!vtkArrayDispatch::Dispatch2::Execute(da, this, worker))
153 {
154 // If dispatch fails, use fallback:
155 worker(da, this);
156 }
157 }
158
159 this->SetLookupTable(nullptr);
160 if (da->LookupTable)
161 {
162 this->LookupTable = da->LookupTable->NewInstance();
163 this->LookupTable->DeepCopy(da->LookupTable);
164 }
165 }
166
167 this->Squeeze();
168}
169VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 7

SetLookupTableMethod · 0.95
ExecuteFunction · 0.50
GetNumberOfTuplesMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNumberOfTuplesMethod · 0.45
NewInstanceMethod · 0.45
SqueezeMethod · 0.45

Tested by

no test coverage detected