33 #ifndef vtkScaledSOADataArrayTemplate_h 34 #define vtkScaledSOADataArrayTemplate_h 37 #include "vtkCommonCoreModule.h" 42 template <
class ValueTypeT>
70 if (
scale != this->Scale)
74 vtkErrorMacro(
"Cannot set Scale to 0");
83 ValueType
GetScale()
const {
return this->Scale; }
94 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
107 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
117 for (
size_t cc = 0; cc < this->Data.size(); cc++)
119 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx] * this->Scale;
128 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
130 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc] / this->Scale;
139 return this->Data[comp]->GetBuffer()[tupleIdx] * this->Scale;
147 this->Data[comp]->GetBuffer()[tupleIdx] =
value / this->Scale;
169 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
193 ValueType* GetComponentArrayPointer(
int comp);
219 switch (
source->GetArrayType())
246 this->Superclass::InsertTuples(dstIds, srcIds,
source);
265 std::vector<vtkBuffer<ValueType>*>
Data;
272 inline void GetTupleIndexFromValueIndex(
vtkIdType valueIdx,
vtkIdType& tupleIdx,
int& comp)
const 288 #endif // header guard 294 #ifdef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING 295 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \ 296 template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate<T> 297 #elif defined(VTK_USE_EXTERN_TEMPLATE) 298 #ifndef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN 299 #define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN 301 #pragma warning(push) 304 #pragma warning(disable : 4910) // extern and dllexport incompatible 310 #endif // VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN 313 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS) 314 #pragma warning(push) 317 #pragma warning(disable : 4091) 320 #pragma warning(disable : 4231) 333 #pragma warning(disable : 4910) // extern and dllexport incompatible Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
void SetScale(ValueType scale)
Set/Get the Scale value for the object.
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
Abstract superclass for all arrays.
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
vtkBuffer< ValueType > * AoSCopy
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
Base interface for all typed vtkDataArray subclasses.
vtkScaledSOADataArrayTemplate< ValueTypeT > SelfType
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph *>::edge_descriptor e, vtkGraph *)
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
std::vector< vtkBuffer< ValueType > * > Data
list of point or cell ids
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
abstract superclass for arrays of numeric data
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
vtkTemplateTypeMacro(SelfType, vtkDataArray)
Abstract superclass to iterate over elements in an vtkAbstractArray.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
vtkArrayDownCast_TemplateFastCastMacro(vtkScaledSOADataArrayTemplate)
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
Superclass::ValueType ValueType
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
ValueType GetScale() const
Set/Get the Scale value for the object.
static vtkScaledSOADataArrayTemplate< ValueType > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
void Modified() override
Removes out-of-date L2_NORM_RANGE() and L2_NORM_FINITE_RANGE() values.
Template defining traits of native types used by VTK.
virtual void ExportToVoidPointer(void *out_ptr)
This method copies the array data to the void pointer specified by the user.