------------------------------------------------------------------------------
| 210 | |
| 211 | //------------------------------------------------------------------------------ |
| 212 | bool 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. |
no test coverage detected