45#ifndef vtkArrayListTemplate_h
46#define vtkArrayListTemplate_h
102 for (
int j = 0; j < this->
NumComp; ++j)
104 this->Output[outId * this->NumComp + j] = this->Input[inId * this->NumComp + j];
109 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
111 for (
int j = 0; j < this->
NumComp; ++j)
114 for (
vtkIdType i = 0; i < numWeights; ++i)
116 v += weights[i] *
static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
118 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
124 for (
int j = 0; j < this->
NumComp; ++j)
129 v +=
static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
131 v /=
static_cast<double>(numPts);
132 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
139 for (
int j = 0; j < this->
NumComp; ++j)
144 v += (weights[i] *
static_cast<double>(this->Input[ids[i] * this->NumComp + j]));
146 this->Output[outId * this->NumComp + j] =
static_cast<T
>(v);
154 for (
int j = 0; j < numComp; ++j)
156 v = this->Input[v0 * numComp + j] +
157 t * (this->Input[v1 * numComp + j] - this->Input[v0 * numComp + j]);
158 this->Output[outId * numComp + j] =
static_cast<T
>(v);
164 for (
int j = 0; j < this->
NumComp; ++j)
166 this->Output[outId * this->NumComp + j] = this->
NullValue;
180template <
typename TInput,
typename TOutput>
199 for (
int j = 0; j < this->
NumComp; ++j)
201 this->Output[outId * this->NumComp + j] =
202 static_cast<TOutput
>(this->Input[inId * this->NumComp + j]);
207 int numWeights,
const vtkIdType* ids,
const double* weights,
vtkIdType outId)
override
209 for (
int j = 0; j < this->
NumComp; ++j)
212 for (
vtkIdType i = 0; i < numWeights; ++i)
214 v += weights[i] *
static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
216 this->Output[outId * this->NumComp + j] =
static_cast<TOutput
>(v);
222 for (
int j = 0; j < this->
NumComp; ++j)
227 v +=
static_cast<double>(this->Input[ids[i] * this->NumComp + j]);
229 v /=
static_cast<double>(numPts);
230 this->Output[outId * this->NumComp + j] =
static_cast<TOutput
>(v);
237 for (
int j = 0; j < this->
NumComp; ++j)
242 v += (weights[i] *
static_cast<double>(this->Input[ids[i] * this->NumComp + j]));
244 this->Output[outId * this->NumComp + j] =
static_cast<TOutput
>(v);
252 for (
int j = 0; j < numComp; ++j)
254 v = this->Input[v0 * numComp + j] +
255 t * (this->Input[v1 * numComp + j] - this->Input[v0 * numComp + j]);
256 this->Output[outId * numComp + j] =
static_cast<TOutput
>(v);
262 for (
int j = 0; j < this->
NumComp; ++j)
264 this->Output[outId * this->NumComp + j] = this->
NullValue;
281 ArrayList* list, T* inData, T* outData,
vtkIdType numTuples,
int numComp, T nullValue);
293 double nullValue = 0.0,
vtkTypeBool promote =
true);
314 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
316 (*it)->Copy(inId, outId);
323 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
325 (*it)->Interpolate(numWeights, ids, weights, outId);
332 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
334 (*it)->Average(numPts, ids, outId);
341 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
343 (*it)->WeightedAverage(numPts, ids, weights, outId);
350 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
352 (*it)->InterpolateEdge(v0, v1, t, outId);
359 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
361 (*it)->AssignNullValue(outId);
368 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
377 for (std::vector<BaseArrayPair*>::iterator it =
Arrays.begin(); it !=
Arrays.end(); ++it)
387#include "vtkArrayListTemplate.txx"
Abstract superclass for all arrays.
virtual vtkTypeBool Resize(vtkIdType numTuples)=0
Resize the array to the requested number of tuples and preserve data.
virtual void SetNumberOfTuples(vtkIdType numTuples)=0
Set the number of tuples (a component group) in the array.
virtual void * GetVoidPointer(vtkIdType valueIdx)=0
Return a void pointer.
represent and manipulate attribute data in a dataset
Hold a reference to a vtkObjectBase instance.
Wrapper around std::string to keep symbols short.
vtkAbstractArray * AddArrayPair(vtkIdType numTuples, vtkAbstractArray *inArray, vtkStdString &outArrayName, double nullValue, vtkTypeBool promote)
void Average(int numPts, const vtkIdType *ids, vtkIdType outId)
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId)
void AddSelfInterpolatingArrays(vtkIdType numOutPts, vtkDataSetAttributes *attr, double nullValue=0.0)
void AssignNullValue(vtkIdType outId)
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId)
vtkTypeBool IsExcluded(vtkAbstractArray *da)
std::vector< vtkAbstractArray * > ExcludedArrays
vtkIdType GetNumberOfArrays()
void Copy(vtkIdType inId, vtkIdType outId)
void AddArrays(vtkIdType numOutPts, vtkDataSetAttributes *inPD, vtkDataSetAttributes *outPD, double nullValue=0.0, vtkTypeBool promote=true)
void ExcludeArray(vtkAbstractArray *da)
void Realloc(vtkIdType sze)
std::vector< BaseArrayPair * > Arrays
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId)
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
void AssignNullValue(vtkIdType outId) override
void Average(int numPts, const vtkIdType *ids, vtkIdType outId) override
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId) override
~ArrayPair() override=default
ArrayPair(T *in, T *out, vtkIdType num, int numComp, vtkAbstractArray *outArray, T null)
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void Copy(vtkIdType inId, vtkIdType outId) override
void Realloc(vtkIdType sze) override
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 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
vtkSmartPointer< vtkAbstractArray > OutputArray
void Interpolate(int numWeights, const vtkIdType *ids, const double *weights, vtkIdType outId) override
~RealArrayPair() override=default
void InterpolateEdge(vtkIdType v0, vtkIdType v1, double t, vtkIdType outId) override
void Copy(vtkIdType inId, vtkIdType outId) override
void AssignNullValue(vtkIdType outId) override
void Realloc(vtkIdType sze) override
void Average(int numPts, const vtkIdType *ids, vtkIdType outId) override
RealArrayPair(TInput *in, TOutput *out, vtkIdType num, int numComp, vtkAbstractArray *outArray, TOutput null)
void WeightedAverage(int numPts, const vtkIdType *ids, const double *weights, vtkIdType outId) override
void CreateArrayPair(ArrayList *list, T *inData, T *outData, vtkIdType numTuples, int numComp, T nullValue)