34 #ifndef vtkArrayListTemplate_h
35 #define vtkArrayListTemplate_h
49 VTK_ABI_NAMESPACE_BEGIN
59 , OutputArray(outArray)
74 #ifdef VTK_USE_64BIT_IDS
75 virtual void Copy(
unsigned int inId,
unsigned int outId) = 0;
77 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId) = 0;
79 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId) = 0;
80 virtual void Average(
int numPts,
const unsigned int* ids,
unsigned int outId) = 0;
82 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId) = 0;
83 virtual void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId) = 0;
86 virtual void Copy(
unsigned short inId,
unsigned short outId) = 0;
88 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId) = 0;
90 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId) = 0;
91 virtual void Average(
int numPts,
const unsigned short* ids,
unsigned short outId) = 0;
93 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId) = 0;
95 unsigned short v0,
unsigned short v1,
double t,
unsigned short outId) = 0;
102 template <
typename TInputArray,
typename TOutputArray,
typename T>
118 template <
typename IdTypeT>
119 void Copy(IdTypeT inId, IdTypeT outId)
121 for (
int j = 0; j < this->
NumComp; ++j)
123 this->Output[outId * this->NumComp + j] =
124 static_cast<T
>(this->Input[inId * this->NumComp + j]);
128 template <
typename IdTypeT>
129 void Interpolate(
int numWeights,
const IdTypeT* ids,
const double* weights, IdTypeT outId)
131 for (
int j = 0; j < this->
NumComp; ++j)
134 for (
int i = 0; i < numWeights; ++i)
136 v += weights[i] *
static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
138 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
142 template <
typename IdTypeT>
143 void InterpolateOutput(
int numWeights,
const IdTypeT* ids,
const double* weights, IdTypeT outId)
145 for (
int j = 0; j < this->
NumComp; ++j)
148 for (
int i = 0; i < numWeights; ++i)
150 v += weights[i] *
static_cast<double>(this->Output[ids[i] * this->NumComp + j]);
152 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
156 template <
typename IdTypeT>
157 void Average(
int numPts,
const IdTypeT* ids, IdTypeT outId)
159 for (
int j = 0; j < this->
NumComp; ++j)
162 for (
int i = 0; i < numPts; ++i)
164 v +=
static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
166 v /=
static_cast<double>(numPts);
167 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
171 template <
typename IdTypeT>
172 void WeightedAverage(
int numPts,
const IdTypeT* ids,
const double* weights, IdTypeT outId)
174 for (
int j = 0; j < this->
NumComp; ++j)
177 for (
int i = 0; i < numPts; ++i)
179 v += (weights[i] *
static_cast<double>(this->Input[ids[i] * this->NumComp + j]));
181 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
185 template <
typename IdTypeT>
189 for (
int j = 0; j < this->
NumComp; ++j)
191 v = this->Input[v0 * this->NumComp + j] +
192 t * (this->Input[v1 * this->NumComp + j] - this->Input[v0 * this->NumComp + j]);
193 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
197 template <
typename IdTypeT>
200 for (
int j = 0; j < this->
NumComp; ++j)
202 this->Output[outId * this->NumComp + j] = this->
NullValue;
209 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
211 this->Interpolate<vtkIdType>(numWeights, ids, weights, outId);
214 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
216 this->InterpolateOutput<vtkIdType>(numWeights, ids, weights, outId);
220 this->Average<vtkIdType>(numPts, ids, outId);
225 this->WeightedAverage<vtkIdType>(numPts, ids, weights, outId);
229 this->InterpolateEdge<vtkIdType>(v0, v1, t, outId);
232 #ifdef VTK_USE_64BIT_IDS
233 void Copy(
unsigned int inId,
unsigned int outId)
override
235 this->Copy<unsigned int>(inId, outId);
238 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
240 this->Interpolate<unsigned int>(numWeights, ids, weights, outId);
243 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
245 this->InterpolateOutput<unsigned int>(numWeights, ids, weights, outId);
247 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
override
249 this->Average<unsigned int>(numPts, ids, outId);
252 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
254 this->WeightedAverage<unsigned int>(numPts, ids, weights, outId);
256 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
override
258 this->InterpolateEdge<unsigned int>(v0, v1, t, outId);
260 void AssignNullValue(
unsigned int outId)
override { this->AssignNullValue<unsigned int>(outId); }
262 void Copy(
unsigned short inId,
unsigned short outId)
override
264 this->Copy<unsigned short>(inId, outId);
267 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
269 this->Interpolate<unsigned short>(numWeights, ids, weights, outId);
272 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
274 this->InterpolateOutput<unsigned short>(numWeights, ids, weights, outId);
276 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
override
278 this->Average<unsigned short>(numPts, ids, outId);
281 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
283 this->WeightedAverage<unsigned short>(numPts, ids, weights, outId);
286 unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
override
288 this->InterpolateEdge<unsigned short>(v0, v1, t, outId);
292 this->AssignNullValue<unsigned short>(outId);
312 , Input(inArray->GetPointer(0))
313 , Output(outArray->GetPointer(0))
319 template <
typename IdTypeT>
320 void Copy(IdTypeT inId, IdTypeT outId)
322 for (
int j = 0; j < this->
NumComp; ++j)
324 this->Output[outId * this->NumComp + j] =
325 static_cast<vtkStdString>(this->Input[inId * this->NumComp + j]);
328 template <
typename IdTypeT>
330 int numWeights,
const IdTypeT* ids,
const double* vtkNotUsed(weights), IdTypeT outId)
332 for (
int i = 0; i < numWeights; ++i)
334 this->
Copy(ids[i], outId);
337 template <
typename IdTypeT>
339 const double* vtkNotUsed(weights), IdTypeT vtkNotUsed(outId))
342 template <
typename IdTypeT>
343 void Average(
int numPts,
const IdTypeT* ids, IdTypeT outId)
345 for (
int i = 0; i < numPts; ++i)
347 this->
Copy(ids[i], outId);
350 template <
typename IdTypeT>
352 int numPts,
const IdTypeT* ids,
const double* vtkNotUsed(weights), IdTypeT outId)
354 for (
int i = 0; i < numPts; ++i)
356 this->
Copy(ids[i], outId);
359 template <
typename IdTypeT>
363 for (
int j = 0; j < this->
NumComp; ++j)
365 this->Output[outId * this->NumComp + j] =
366 this->Input[v0 * this->NumComp + j] + this->Input[v1 * this->NumComp + j];
370 template <
typename IdTypeT>
373 for (
int j = 0; j < this->
NumComp; ++j)
375 this->Output[outId * this->NumComp + j] = this->
NullValue;
382 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
384 this->Interpolate<vtkIdType>(numWeights, ids, weights, outId);
387 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
389 this->InterpolateOutput<vtkIdType>(numWeights, ids, weights, outId);
393 this->Average<vtkIdType>(numPts, ids, outId);
398 this->WeightedAverage<vtkIdType>(numPts, ids, weights, outId);
402 this->InterpolateEdge<vtkIdType>(v0, v1, t, outId);
405 #ifdef VTK_USE_64BIT_IDS
406 void Copy(
unsigned int inId,
unsigned int outId)
override
408 this->Copy<unsigned int>(inId, outId);
411 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
413 this->Interpolate<unsigned int>(numWeights, ids, weights, outId);
416 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
418 this->InterpolateOutput<unsigned int>(numWeights, ids, weights, outId);
420 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
override
422 this->Average<unsigned int>(numPts, ids, outId);
425 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
427 this->WeightedAverage<unsigned int>(numPts, ids, weights, outId);
429 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
override
431 this->InterpolateEdge<unsigned int>(v0, v1, t, outId);
433 void AssignNullValue(
unsigned int outId)
override { this->AssignNullValue<unsigned int>(outId); }
435 void Copy(
unsigned short inId,
unsigned short outId)
override
437 this->Copy<unsigned short>(inId, outId);
440 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
442 this->Interpolate<unsigned short>(numWeights, ids, weights, outId);
445 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
447 this->InterpolateOutput<unsigned short>(numWeights, ids, weights, outId);
449 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
override
451 this->Average<unsigned short>(numPts, ids, outId);
454 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
456 this->WeightedAverage<unsigned short>(numPts, ids, weights, outId);
459 unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
override
461 this->InterpolateEdge<unsigned short>(v0, v1, t, outId);
465 this->AssignNullValue<unsigned short>(outId);
479 template <
typename TArray,
typename T>
481 ArrayList* list, TArray* inData, TArray* outData,
vtkIdType numTuples,
int numComp, T nullValue);
493 double nullValue = 0.0,
vtkTypeBool promote =
true);
513 for (
auto& array : this->Arrays)
520 template <
typename TIdType>
521 void Copy(TIdType inId, TIdType outId)
523 for (
auto& array : this->Arrays)
525 array->Copy(inId, outId);
529 template <
typename TIdType>
530 void Interpolate(
int numWeights,
const TIdType* ids,
const double* weights, TIdType outId)
532 for (
auto& array : this->Arrays)
534 array->Interpolate(numWeights, ids, weights, outId);
538 template <
typename TIdType>
539 void InterpolateOutput(
int numWeights,
const TIdType* ids,
const double* weights, TIdType outId)
541 for (
auto& array : this->Arrays)
543 array->InterpolateOutput(numWeights, ids, weights, outId);
547 template <
typename TIdType>
548 void Average(
int numPts,
const TIdType* ids, TIdType outId)
550 for (
auto& array : this->Arrays)
552 array->Average(numPts, ids, outId);
556 template <
typename TIdType>
557 void WeightedAverage(
int numPts,
const TIdType* ids,
const double* weights, TIdType outId)
559 for (
auto& array : this->Arrays)
561 array->WeightedAverage(numPts, ids, weights, outId);
565 template <
typename TIdType>
568 for (
auto& array : this->Arrays)
570 array->InterpolateEdge(v0, v1, t, outId);
574 template <
typename TIdType>
577 for (
auto& array : this->Arrays)
579 array->AssignNullValue(outId);
594 this->Interpolate<vtkIdType>(numWeights, ids, weights, outId);
602 this->InterpolateOutput<vtkIdType>(numWeights, ids, weights, outId);
609 this->Average<vtkIdType>(numPts, ids, outId);
616 this->WeightedAverage<vtkIdType>(numPts, ids, weights, outId);
623 this->InterpolateEdge<vtkIdType>(v0, v1, t, outId);
629 #ifdef VTK_USE_64BIT_IDS
634 void Copy(
unsigned int inId,
unsigned int outId) { this->Copy<unsigned int>(inId, outId); }
639 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
641 this->Interpolate<unsigned int>(numWeights, ids, weights, outId);
647 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
649 this->InterpolateOutput<unsigned int>(numWeights, ids, weights, outId);
654 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
656 this->Average<unsigned int>(numPts, ids, outId);
662 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
664 this->WeightedAverage<unsigned int>(numPts, ids, weights, outId);
669 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
671 this->InterpolateEdge<unsigned int>(v0, v1, t, outId);
676 void AssignNullValue(
unsigned int outId) { this->AssignNullValue<unsigned int>(outId); }
682 void Copy(
unsigned short inId,
unsigned short outId) { this->Copy<unsigned short>(inId, outId); }
687 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
689 this->Interpolate<unsigned short>(numWeights, ids, weights, outId);
695 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
697 this->InterpolateOutput<unsigned short>(numWeights, ids, weights, outId);
702 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
704 this->Average<unsigned short>(numPts, ids, outId);
710 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
712 this->WeightedAverage<unsigned short>(numPts, ids, weights, outId);
717 void InterpolateEdge(
unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
719 this->InterpolateEdge<unsigned short>(v0, v1, t, outId);
724 void AssignNullValue(
unsigned short outId) { this->AssignNullValue<unsigned short>(outId); }
731 for (
auto& array : this->Arrays)
743 VTK_ABI_NAMESPACE_END
744 #include "vtkArrayListTemplate.txx"
void Interpolate(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
void WeightedAverage(int numPts, const TIdType *ids, const double *weights, TIdType outId)
void Interpolate(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
vtkSmartPointer< vtkAbstractArray > OutputArray
void Copy(unsigned short inId, unsigned short outId) override
Wrapper around std::string to keep symbols short.
void Interpolate(int numWeights, const TIdType *ids, const double *weights, TIdType outId)
virtual void SetNumberOfTuples(vtkIdType numTuples)
Set the number of tuples (a component group) in the array.
std::vector< BaseArrayPair * > Arrays
void AssignNullValue(unsigned short outId)
Loop over the arrays and assign the null value.
void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)
Loop over the arrays and have them interpolate themselves based on the output arrays.
void AssignNullValue(unsigned short outId) override
void Copy(unsigned short inId, unsigned short outId) override
void Average(int numPts, const unsigned short *ids, unsigned short outId)
Loop over the arrays and have them averaged.
void ExcludeArray(vtkAbstractArray *da)
std::vector< vtkAbstractArray * > ExcludedArrays
void CreateArrayPair(ArrayList *list, TArray *inData, TArray *outData, vtkIdType numTuples, int numComp, T nullValue)
vtkAbstractArray * AddArrayPair(vtkIdType numTuples, vtkAbstractArray *inArray, vtkStdString &outArrayName, double nullValue, vtkTypeBool promote)
void WeightedAverage(int numPts, const IdTypeT *ids, const double *weights, IdTypeT outId)
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
void Realloc(vtkIdType sze) override
void Average(int numPts, const IdTypeT *ids, IdTypeT outId)
void Average(int numPts, const TIdType *ids, TIdType outId)
Abstract superclass for all arrays.
void Copy(unsigned short inId, unsigned short outId)
Loop over the array pairs and copy data from one to another.
void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId) override
void Realloc(vtkIdType sze) override
virtual vtkTypeBool ReserveTuples(vtkIdType numTuples)=0
Reserve the array to the requested number of tuples and preserve data.
a vtkAbstractArray subclass for strings
void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void Average(int numPts, const vtkIdType *ids, vtkIdType outId)
Loop over the arrays and have them averaged.
void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
virtual void Average(int numPts, const vtkIdType *ids, vtkIdType outId)=0
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void InterpolateOutput(int numWeights, const TIdType *ids, const double *weights, TIdType outId)
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
void AssignNullValue(vtkIdType outId) override
virtual void Realloc(vtkIdType sze)=0
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
void AssignNullValue(IdTypeT outId)
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)
Loop over the arrays and have them interpolate themselves.
virtual void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)=0
void InterpolateEdge(TIdType v0, TIdType v1, double t, TIdType outId)
void Copy(IdTypeT inId, IdTypeT outId)
ArrayPair(TInputArray *inArray, TOutputArray *outArray, vtkIdType num, int numComp, T null)
virtual void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId)=0
void AssignNullValue(TIdType outId)
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId)
Loop over the arrays perform edge interpolation.
void Average(int numPts, const vtkIdType *ids, vtkIdType outId) override
void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId) override
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
virtual void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)=0
void AssignNullValue(vtkIdType outId)
Loop over the arrays and assign the null value.
void AssignNullValue(IdTypeT outId)
vtkIdType GetNumberOfArrays()
Return the number of arrays.
ArrayPair(vtkStringArray *inArray, vtkStringArray *outArray, vtkIdType num, int numComp, vtkStdString null)
void Copy(vtkIdType inId, vtkIdType outId)
Loop over the array pairs and copy data from one to another.
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId) override
void Average(int numPts, const unsigned short *ids, unsigned short outId) override
void InterpolateEdge(IdTypeT v0, IdTypeT v1, double t, IdTypeT outId)
void Copy(vtkIdType inId, vtkIdType outId) override
void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
vtk::detail::ValueRange< TInputArray, vtk::detail::DynamicTupleSize > Input
void Realloc(vtkIdType sze)
Extend (realloc) the arrays.
void Copy(vtkIdType inId, vtkIdType outId) override
void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
void Copy(IdTypeT inId, IdTypeT outId)
void AddArrays(vtkIdType numOutPts, vtkDataSetAttributes *inPD, vtkDataSetAttributes *outPD, double nullValue=0.0, vtkTypeBool promote=true)
void WeightedAverage(int numPts, const IdTypeT *ids, const double *weights, IdTypeT outId)
represent and manipulate attribute data in a dataset
ValueType * GetPointer(vtkIdType id)
Get the address of a particular data index.
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId)
Loop over the arrays perform edge interpolation.
virtual void Copy(vtkIdType inId, vtkIdType outId)=0
VTK_ITER_INLINE auto DataArrayValueRange(const ArrayTypePtr &array, ValueIdType start=-1, ValueIdType end=-1) -> typename detail::SelectValueRange< ArrayTypePtr, TupleSize, ForceValueTypeForVtkDataArray >::type
Generate an stl and for-range compatible range of flat AOS iterators from a vtkDataArray.
vtkTypeBool IsExcluded(vtkAbstractArray *da)
void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId)
Loop over the arrays and weighted average the attributes.
void InterpolateEdge(IdTypeT v0, IdTypeT v1, double t, IdTypeT outId)
void InterpolateOutput(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
void Average(int numPts, const vtkIdType *ids, vtkIdType outId) override
void InterpolateOutput(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
virtual void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId)=0
void InterpolateOutput(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId)
Loop over the arrays and have them interpolate themselves based on the output arrays.
void AssignNullValue(vtkIdType outId) override
void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId)
Loop over the arrays and have them interpolate themselves.
BaseArrayPair(vtkIdType num, int numComp, vtkAbstractArray *outArray)
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId) override
void Average(int numPts, const unsigned short *ids, unsigned short outId) override
void InterpolateOutput(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
vtk::detail::ValueRange< TOutputArray, vtk::detail::DynamicTupleSize > Output
virtual void AssignNullValue(vtkIdType outId)=0
void Copy(TIdType inId, TIdType outId)
void AssignNullValue(unsigned short outId) override
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId)
Loop over the arrays and weighted average the attributes.
static vtkStringArray * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkStringArray.
void Average(int numPts, const IdTypeT *ids, IdTypeT outId)
void InterpolateOutput(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
void AddSelfInterpolatingArrays(vtkIdType numOutPts, vtkDataSetAttributes *attr, double nullValue=0.0)
virtual ~BaseArrayPair()=default
STL-compatible iterable ranges that provide access to vtkDataArray elements.
~ArrayPair() override=default