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
313 ,
Input(inArray->GetPointer(0))
314 ,
Output(outArray->GetPointer(0))
320 template <
typename IdTypeT>
321 void Copy(IdTypeT inId, IdTypeT outId)
323 for (
int j = 0; j < this->
NumComp; ++j)
325 this->Output[outId * this->NumComp + j] =
326 static_cast<vtkStdString>(this->Input[inId * this->NumComp + j]);
329 template <
typename IdTypeT>
331 int numWeights,
const IdTypeT* ids,
const double* vtkNotUsed(weights), IdTypeT outId)
333 for (
int i = 0; i < numWeights; ++i)
335 this->
Copy(ids[i], outId);
338 template <
typename IdTypeT>
340 const double* vtkNotUsed(weights), IdTypeT vtkNotUsed(outId))
343 template <
typename IdTypeT>
344 void Average(
int numPts,
const IdTypeT* ids, IdTypeT outId)
346 for (
int i = 0; i < numPts; ++i)
348 this->
Copy(ids[i], outId);
351 template <
typename IdTypeT>
353 int numPts,
const IdTypeT* ids,
const double* vtkNotUsed(weights), IdTypeT outId)
355 for (
int i = 0; i < numPts; ++i)
357 this->
Copy(ids[i], outId);
360 template <
typename IdTypeT>
364 for (
int j = 0; j < this->
NumComp; ++j)
366 this->Output[outId * this->NumComp + j] =
367 this->Input[v0 * this->NumComp + j] + this->Input[v1 * this->NumComp + j];
371 template <
typename IdTypeT>
374 for (
int j = 0; j < this->
NumComp; ++j)
376 this->Output[outId * this->NumComp + j] = this->NullValue;
383 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
388 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
406#ifdef VTK_USE_64BIT_IDS
407 void Copy(
unsigned int inId,
unsigned int outId)
override
412 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
417 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
421 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
override
426 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
override
430 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
override
436 void Copy(
unsigned short inId,
unsigned short outId)
override
441 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
446 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
450 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
override
455 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
override
460 unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
override
480template <
typename TArray,
typename T>
482 ArrayList* list, TArray* inData, TArray* outData,
vtkIdType numTuples,
int numComp, T nullValue);
494 double nullValue = 0.0,
vtkTypeBool promote =
true);
514 for (
auto& array : this->Arrays)
521 template <
typename TIdType>
522 void Copy(TIdType inId, TIdType outId)
524 for (
auto& array : this->Arrays)
526 array->Copy(inId, outId);
530 template <
typename TIdType>
531 void Interpolate(
int numWeights,
const TIdType* ids,
const double* weights, TIdType outId)
533 for (
auto& array : this->Arrays)
535 array->Interpolate(numWeights, ids, weights, outId);
539 template <
typename TIdType>
540 void InterpolateOutput(
int numWeights,
const TIdType* ids,
const double* weights, TIdType outId)
542 for (
auto& array : this->Arrays)
544 array->InterpolateOutput(numWeights, ids, weights, outId);
548 template <
typename TIdType>
549 void Average(
int numPts,
const TIdType* ids, TIdType outId)
551 for (
auto& array : this->Arrays)
553 array->Average(numPts, ids, outId);
557 template <
typename TIdType>
558 void WeightedAverage(
int numPts,
const TIdType* ids,
const double* weights, TIdType outId)
560 for (
auto& array : this->Arrays)
562 array->WeightedAverage(numPts, ids, weights, outId);
566 template <
typename TIdType>
569 for (
auto& array : this->Arrays)
571 array->InterpolateEdge(v0, v1, t, outId);
575 template <
typename TIdType>
578 for (
auto& array : this->Arrays)
580 array->AssignNullValue(outId);
630#ifdef VTK_USE_64BIT_IDS
640 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
648 int numWeights,
const unsigned int* ids,
const double* weights,
unsigned int outId)
655 void Average(
int numPts,
const unsigned int* ids,
unsigned int outId)
663 int numPts,
const unsigned int* ids,
const double* weights,
unsigned int outId)
670 void InterpolateEdge(
unsigned int v0,
unsigned int v1,
double t,
unsigned int outId)
688 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
696 int numWeights,
const unsigned short* ids,
const double* weights,
unsigned short outId)
703 void Average(
int numPts,
const unsigned short* ids,
unsigned short outId)
711 int numPts,
const unsigned short* ids,
const double* weights,
unsigned short outId)
718 void InterpolateEdge(
unsigned short v0,
unsigned short v1,
double t,
unsigned short outId)
732 for (
auto& array : this->Arrays)
745#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.