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

Method CopyComponent

Common/Core/vtkStringArray.cxx:212–234  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

210
211//------------------------------------------------------------------------------
212bool vtkStringArray::CopyComponent(int dstComponent, vtkAbstractArray* src, int srcComponent)
213{
214 auto* source = vtkStringArray::SafeDownCast(src);
215 if (!source || source->GetNumberOfTuples() != this->GetNumberOfTuples() || srcComponent < 0 ||
216 srcComponent >= source->GetNumberOfComponents() || dstComponent < 0 ||
217 dstComponent >= this->GetNumberOfComponents())
218 {
219 return false;
220 }
221
222 vtkIdType nn = this->GetNumberOfTuples();
223 vtkSMPTools::For(0, nn,
224 [this, dstComponent, source, srcComponent](vtkIdType begin, vtkIdType end)
225 {
226 vtkIdType ndc = this->GetNumberOfComponents();
227 vtkIdType nsc = source->GetNumberOfComponents();
228 for (vtkIdType ii = begin; ii < end; ++ii)
229 {
230 this->SetValue(ii * ndc + dstComponent, source->GetValue(ii * nsc + srcComponent));
231 }
232 });
233 return true;
234}
235
236//------------------------------------------------------------------------------
237// Deep copy of another string array.

Callers 15

CopyShapeMethod · 0.45
GetNodalAttributesMethod · 0.45
GetElementAttributesMethod · 0.45
GetFieldsMethod · 0.45
ReadVariableNodesMethod · 0.45
ReadVariableArrayMethod · 0.45
ReadVariableElementsMethod · 0.45
SetInputDataMethod · 0.45
ComponentOrNormAsArrayFunction · 0.45

Calls 5

SetValueMethod · 0.95
ForFunction · 0.70
GetNumberOfTuplesMethod · 0.45
GetNumberOfComponentsMethod · 0.45
GetValueMethod · 0.45

Tested by

no test coverage detected