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

Method CopyComponent

Common/Core/vtkVariantArray.cxx:166–188  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

164
165//------------------------------------------------------------------------------
166bool vtkVariantArray::CopyComponent(int dstComponent, vtkAbstractArray* src, int srcComponent)
167{
168 auto* source = vtkVariantArray::SafeDownCast(src);
169 if (!source || source->GetNumberOfTuples() != this->GetNumberOfTuples() || srcComponent < 0 ||
170 srcComponent >= source->GetNumberOfComponents() || dstComponent < 0 ||
171 dstComponent >= this->GetNumberOfComponents())
172 {
173 return false;
174 }
175
176 vtkIdType nn = this->GetNumberOfTuples();
177 vtkSMPTools::For(0, nn,
178 [this, dstComponent, source, srcComponent](vtkIdType begin, vtkIdType end)
179 {
180 vtkIdType ndc = this->GetNumberOfComponents();
181 vtkIdType nsc = source->GetNumberOfComponents();
182 for (vtkIdType ii = begin; ii < end; ++ii)
183 {
184 this->SetValue(ii * ndc + dstComponent, source->GetValue(ii * nsc + srcComponent));
185 }
186 });
187 return true;
188}
189
190//------------------------------------------------------------------------------
191int vtkVariantArray::GetDataType() const

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected