| 53 | } // end anon namespace |
| 54 | |
| 55 | VTK_ABI_NAMESPACE_BEGIN |
| 56 | //------------------------------------------------------------------------------ |
| 57 | void vtkDataArray::InsertTuples( |
| 58 | vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* src) |
| 59 | { |
| 60 | if (n == 0) |
| 61 | { |
| 62 | return; |
| 63 | } |
| 64 | if (src->GetNumberOfComponents() != this->GetNumberOfComponents()) |
| 65 | { |
| 66 | vtkErrorMacro("Number of components do not match: Source: " |
| 67 | << src->GetNumberOfComponents() << " Dest: " << this->GetNumberOfComponents()); |
| 68 | return; |
| 69 | } |
| 70 | vtkDataArray* srcDA = vtkDataArray::FastDownCast(src); |
| 71 | if (!srcDA) |
| 72 | { |
| 73 | vtkErrorMacro("Source array must be a subclass of vtkDataArray. Got: " << src->GetClassName()); |
| 74 | return; |
| 75 | } |
| 76 | |
| 77 | vtkIdType maxSrcTupleId = srcStart + n - 1; |
| 78 | vtkIdType maxDstTupleId = dstStart + n - 1; |
| 79 | |
| 80 | if (maxSrcTupleId >= src->GetNumberOfTuples()) |
| 81 | { |
| 82 | vtkErrorMacro("Source array too small, requested tuple at index " |
| 83 | << maxSrcTupleId << ", but there are only " << src->GetNumberOfTuples() |
| 84 | << " tuples in the array."); |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | vtkIdType newSize = (maxDstTupleId + 1) * this->NumberOfComponents; |
| 89 | if (this->Size < newSize) |
| 90 | { |
| 91 | if (!this->Resize(maxDstTupleId + 1)) |
| 92 | { |
| 93 | vtkErrorMacro("Resize failed."); |
| 94 | return; |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | this->MaxId = std::max(this->MaxId, newSize - 1); |
| 99 | |
| 100 | SetTuplesRangeWorker worker(srcStart, dstStart, n); |
| 101 | if (!vtkArrayDispatch::Dispatch2::Execute(srcDA, this, worker)) |
| 102 | { |
| 103 | worker(srcDA, this); |
| 104 | } |
| 105 | } |
| 106 | VTK_ABI_NAMESPACE_END |
nothing calls this directly
no test coverage detected