34#ifndef vtkArrayListTemplate_h
35#define vtkArrayListTemplate_h
49VTK_ABI_NAMESPACE_BEGIN
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;
102template <
typename TInputArray,
typename TOutputArray,
typename T>
111 ,
Input(
vtk::DataArrayValueRange(inArray))
112 ,
Output(
vtk::DataArrayValueRange(outArray))
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
214 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
232#ifdef VTK_USE_64BIT_IDS
233 void Copy(
unsigned int inId,
unsigned int outId)
override
238 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
243 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
247 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
override
252 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
256 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
override
262 void Copy(
unsigned short inId,
unsigned short outId)
override
267 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
272 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
276 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
override
281 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
286 unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
override
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
387 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
405#ifdef VTK_USE_64BIT_IDS
406 void Copy(
unsigned int inId,
unsigned int outId)
override
411 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
416 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
420 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
override
425 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
429 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
override
435 void Copy(
unsigned short inId,
unsigned short outId)
override
440 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
445 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
449 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
override
454 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
459 unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
override
479template <
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);
629#ifdef VTK_USE_64BIT_IDS
639 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
647 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
654 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
662 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
669 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
687 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
695 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
702 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
710 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
717 void InterpolateEdge(
unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
731 for (
auto& array : this->Arrays)
744#include "vtkArrayListTemplate.txx"
Abstract superclass for all arrays.
represent and manipulate attribute data in a dataset
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
a vtkAbstractArray subclass for strings
static vtkStringArray * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkStringArray.
ValueType * GetPointer(vtkIdType id)
Get the address of a particular data index.
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
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.
vtkAbstractArray * AddArrayPair(vtkIdType numTuples, vtkAbstractArray *inArray, vtkStdString &outArrayName, double nullValue, vtkTypeBool promote)
void Average(int numPts, const vtkIdType *ids, vtkIdType outId)
Loop over the arrays and have them averaged.
void Copy(unsigned short inId, unsigned short outId)
Loop over the array pairs and copy data from one to another.
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId)
Loop over the arrays perform edge interpolation.
void InterpolateEdge(TIdType v0, TIdType v1, double t, TIdType outId)
void AddSelfInterpolatingArrays(vtkIdType numOutPts, vtkDataSetAttributes *attr, double nullValue=0.0)
void Interpolate(int numWeights, const TIdType *ids, const double *weights, TIdType outId)
void AssignNullValue(vtkIdType outId)
Loop over the arrays and assign the null value.
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId)
Loop over the arrays and weighted average the attributes.
void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId)
Loop over the arrays and have them interpolate themselves.
vtkTypeBool IsExcluded(vtkAbstractArray *da)
std::vector< vtkAbstractArray * > ExcludedArrays
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId)
Loop over the arrays perform edge interpolation.
vtkIdType GetNumberOfArrays()
Return the number of arrays.
void Copy(vtkIdType inId, vtkIdType outId)
Loop over the array pairs and copy data from one to another.
void AddArrays(vtkIdType numOutPts, vtkDataSetAttributes *inPD, vtkDataSetAttributes *outPD, double nullValue=0.0, vtkTypeBool promote=true)
void AssignNullValue(TIdType outId)
void Average(int numPts, const TIdType *ids, TIdType outId)
void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId)
Loop over the arrays and weighted average the attributes.
void ExcludeArray(vtkAbstractArray *da)
void Average(int numPts, const unsigned short *ids, unsigned short outId)
Loop over the arrays and have them averaged.
void InterpolateOutput(int numWeights, const TIdType *ids, const double *weights, TIdType outId)
void Realloc(vtkIdType sze)
Extend (realloc) the arrays.
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 WeightedAverage(int numPts, const TIdType *ids, const double *weights, TIdType outId)
void Copy(TIdType inId, TIdType outId)
std::vector< BaseArrayPair * > Arrays
void AssignNullValue(unsigned short outId)
Loop over the arrays and assign the null value.
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 Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)
Loop over the arrays and have them interpolate themselves.
void Average(int numPts, const unsigned short *ids, unsigned short outId) override
~ArrayPair() override=default
void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
void InterpolateOutput(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
void InterpolateEdge(IdTypeT v0, IdTypeT v1, double t, IdTypeT outId)
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId) override
void Realloc(vtkIdType sze) override
void Copy(unsigned short inId, unsigned short outId) override
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void Average(int numPts, const IdTypeT *ids, IdTypeT outId)
void Copy(IdTypeT inId, IdTypeT outId)
void Copy(vtkIdType inId, vtkIdType outId) override
void AssignNullValue(vtkIdType outId) override
void Average(int numPts, const vtkIdType *ids, vtkIdType outId) override
ArrayPair(vtkStringArray *inArray, vtkStringArray *outArray, vtkIdType num, int numComp, vtkStdString null)
void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId) override
void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void InterpolateOutput(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
void AssignNullValue(unsigned short outId) override
void AssignNullValue(IdTypeT outId)
void Interpolate(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
void WeightedAverage(int numPts, const IdTypeT *ids, const double *weights, IdTypeT outId)
void Copy(unsigned short inId, unsigned short outId) override
void Copy(IdTypeT inId, IdTypeT outId)
void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId) override
void Average(int numPts, const unsigned short *ids, unsigned short outId) override
vtk::detail::ValueRange< TOutputArray, vtk::detail::DynamicTupleSize > Output
void InterpolateEdge(IdTypeT v0, IdTypeT v1, double t, IdTypeT outId)
void AssignNullValue(IdTypeT outId)
void InterpolateOutput(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void Copy(vtkIdType inId, vtkIdType outId) override
ArrayPair(TInputArray *inArray, TOutputArray *outArray, vtkIdType num, int numComp, T null)
void InterpolateOutput(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId) override
void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void AssignNullValue(unsigned short outId) override
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
void AssignNullValue(vtkIdType outId) override
void Average(int numPts, const IdTypeT *ids, IdTypeT outId)
void Average(int numPts, const vtkIdType *ids, vtkIdType outId) override
void WeightedAverage(int numPts, const IdTypeT *ids, const double *weights, IdTypeT outId)
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId) override
vtk::detail::ValueRange< TInputArray, vtk::detail::DynamicTupleSize > Input
~ArrayPair() override=default
void Realloc(vtkIdType sze) override
void Interpolate(int numWeights, const IdTypeT *ids, const double *weights, IdTypeT outId)
virtual void WeightedAverage(int numPts, const unsigned short *ids, const double *weights, unsigned short outId)=0
virtual void InterpolateOutput(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)=0
BaseArrayPair(vtkIdType num, int numComp, vtkAbstractArray *outArray)
virtual void Average(int numPts, const vtkIdType *ids, vtkIdType outId)=0
virtual void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId)=0
virtual void Average(int numPts, const unsigned short *ids, unsigned short outId)=0
virtual void InterpolateEdge(unsigned short v0, unsigned short v1, double t, unsigned short outId)=0
virtual void AssignNullValue(unsigned short outId)=0
virtual void AssignNullValue(vtkIdType outId)=0
virtual void Copy(vtkIdType inId, vtkIdType outId)=0
virtual ~BaseArrayPair()=default
virtual void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)=0
virtual void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId)=0
virtual void Realloc(vtkIdType sze)=0
virtual void Copy(unsigned short inId, unsigned short outId)=0
vtkSmartPointer< vtkAbstractArray > OutputArray
virtual void InterpolateOutput(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId)=0
virtual void Interpolate(int numWeights, const unsigned short *ids, const double *weights, unsigned short outId)=0
void CreateArrayPair(ArrayList *list, TArray *inData, TArray *outData, vtkIdType numTuples, int numComp, T nullValue)
STL-compatible iterable ranges that provide access to vtkDataArray elements.