24#ifndef vtkScaledSOADataArrayTemplate_h
25#define vtkScaledSOADataArrayTemplate_h
29#include "vtkCommonCoreModule.h"
35VTK_ABI_NAMESPACE_BEGIN
36template <
class ValueTypeT>
64 if (scale != this->Scale)
68 vtkErrorMacro(
"Cannot set Scale to 0");
77 ValueType
GetScale()
const {
return this->Scale; }
88 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
101 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
111 for (
size_t cc = 0; cc < this->Data.size(); cc++)
113 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx] * this->Scale;
122 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
124 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc] / this->Scale;
133 return this->Data[comp]->GetBuffer()[tupleIdx] * this->Scale;
141 this->Data[comp]->GetBuffer()[tupleIdx] = value / this->Scale;
163 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
213 switch (
source->GetArrayType())
264 std::vector<vtkBuffer<ValueType>*>
Data;
294#ifdef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
295#define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
296 namespace vtkDataArrayPrivate \
298 VTK_ABI_NAMESPACE_BEGIN \
299 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkScaledSOADataArrayTemplate<T>, double); \
300 VTK_ABI_NAMESPACE_END \
302 VTK_ABI_NAMESPACE_BEGIN \
303 template class VTKCOMMONCORE_EXPORT vtkScaledSOADataArrayTemplate<T>; \
304 VTK_ABI_NAMESPACE_END
306#elif defined(VTK_USE_EXTERN_TEMPLATE)
307#ifndef VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
308#define VTK_SCALED_SOA_DATA_ARRAY_TEMPLATE_EXTERN
313#pragma warning(disable : 4910)
315VTK_ABI_NAMESPACE_BEGIN
324#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
328#pragma warning(disable : 4091)
331#pragma warning(disable : 4231)
344#pragma warning(disable : 4910)
348VTK_ABI_NAMESPACE_BEGIN
Abstract superclass for all arrays.
@ VTK_DATA_ARRAY_USER_DEFINED
@ VTK_DATA_ARRAY_ALIGNED_FREE
virtual void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source)=0
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
virtual void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source)=0
Copy the tuples indexed in srcIds from the source array to the tuple locations starting at index dstS...
@ ScaleSoADataArrayTemplate
Abstract superclass to iterate over elements in an vtkAbstractArray.
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others.
abstract superclass for arrays of numeric data
void Modified() override
Removes out-of-date L2_NORM_RANGE() and L2_NORM_FINITE_RANGE() values.
Base interface for all typed vtkDataArray subclasses.
list of point or cell ids
Struct-Of-Arrays implementation of vtkGenericDataArray with a scaling factor.
void ShallowCopy(vtkDataArray *other) override
Create a shallow copy of other into this, if possible.
void SetNumberOfComponents(int numComps) override
Set/Get the dimension (n) of the components.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
static vtkScaledSOADataArrayTemplate * New()
void SetArray(int comp, ValueType *array, vtkIdType size, bool updateMaxId=false, bool save=false, int deleteMethod=VTK_DATA_ARRAY_FREE)
Use this API to pass externally allocated memory to this instance.
void SetArrayFreeFunction(int comp, void(*callback)(void *))
This method allows the user to specify a custom free function to be called when the array is dealloca...
std::vector< vtkBuffer< ValueType > * > Data
vtkTemplateTypeMacro(SelfType, GenericDataArrayType)
void SetArrayFreeFunction(void(*callback)(void *)) override
This method allows the user to specify a custom free function to be called when the array is dealloca...
ValueType * GetComponentArrayPointer(int comp)
Return a pointer to a contiguous block of memory containing all values for a particular components (i...
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
static vtkScaledSOADataArrayTemplate< ValueType > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
vtkScaledSOADataArrayTemplate()
vtkScaledSOADataArrayTemplate< ValueTypeT > SelfType
void SetScale(ValueType scale)
Set/Get the Scale value for the object.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
~vtkScaledSOADataArrayTemplate() override
void ExportToVoidPointer(void *ptr) override
Export a copy of the data in AoS ordering to the preallocated memory buffer.
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void FillTypedComponent(int compIdx, ValueType value) override
Set component comp of all tuples to value.
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
Superclass::ValueType ValueType
vtkBuffer< ValueType > * AoSCopy
ValueType GetScale() const
Set/Get the Scale value for the object.
void * GetVoidPointer(vtkIdType valueIdx) override
Use of this method is discouraged, it creates a deep copy of the data into a contiguous AoS-ordered b...
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
Template defining traits of native types used by VTK.
#define vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the paramet...
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))