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

Method InsertTuples

Common/Core/vtkDataArray_InsertTuples_array_range.cxx:55–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53} // end anon namespace
54
55VTK_ABI_NAMESPACE_BEGIN
56//------------------------------------------------------------------------------
57void 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}
106VTK_ABI_NAMESPACE_END

Callers

nothing calls this directly

Calls 7

FastDownCastFunction · 0.70
maxFunction · 0.50
ExecuteFunction · 0.50
GetNumberOfComponentsMethod · 0.45
GetClassNameMethod · 0.45
GetNumberOfTuplesMethod · 0.45
ResizeMethod · 0.45

Tested by

no test coverage detected