31 #ifndef vtkSOADataArrayTemplate_h
32 #define vtkSOADataArrayTemplate_h
35 #include "vtkCommonCoreModule.h"
41 template <
class ValueTypeT>
70 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
83 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
93 for (
size_t cc = 0; cc < this->Data.size(); cc++)
95 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx];
104 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
106 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
115 return this->Data[comp]->GetBuffer()[tupleIdx];
123 this->Data[comp]->GetBuffer()[tupleIdx] =
value;
145 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
206 this->Superclass::InsertTuples(dstIds, srcIds,
source);
211 this->Superclass::InsertTuplesStartingAt(dstStart, srcIds,
source);
230 std::vector<vtkBuffer<ValueType>*>
Data;
255 #ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
256 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
257 namespace vtkDataArrayPrivate \
259 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<T>, double); \
261 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate<T>
263 #elif defined(VTK_USE_EXTERN_TEMPLATE)
264 #ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
265 #define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
267 #pragma warning(push)
270 #pragma warning(disable : 4910)
279 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
280 #pragma warning(push)
283 #pragma warning(disable : 4091)
286 #pragma warning(disable : 4231)
299 #pragma warning(disable : 4910)
Abstract superclass for all arrays.
@ VTK_DATA_ARRAY_USER_DEFINED
@ VTK_DATA_ARRAY_ALIGNED_FREE
Abstract superclass to iterate over elements in an vtkAbstractArray.
abstract superclass for arrays of numeric data
Base interface for all typed vtkDataArray subclasses.
list of point or cell ids
Struct-Of-Arrays implementation of vtkGenericDataArray.
void ShallowCopy(vtkDataArray *other) override
Create a shallow copy of other into this, if possible.
void ExportToVoidPointer(void *ptr) override
Export a copy of the data in AoS ordering to the preallocated memory buffer.
Superclass::ValueType ValueType
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...
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
vtkTemplateTypeMacro(SelfType, GenericDataArrayType)
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
void FillTypedComponent(int compIdx, ValueType value) override
Set component comp of all tuples to value.
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
See documentation from parent class.
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...
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
~vtkSOADataArrayTemplate() override
vtkBuffer< ValueType > * AoSCopy
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkSOADataArrayTemplate()
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
vtkSOADataArrayTemplate< ValueTypeT > SelfType
static vtkSOADataArrayTemplate< ValueType > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
std::vector< vtkBuffer< ValueType > * > Data
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.
static vtkSOADataArrayTemplate * New()
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...
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
ValueType * GetComponentArrayPointer(int comp)
Return a pointer to a contiguous block of memory containing all values for a particular components (i...
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
void SetNumberOfComponents(int numComps) override
Set/Get the dimension (n) of the components.
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.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))