22 #ifndef vtkSOADataArrayTemplate_h
23 #define vtkSOADataArrayTemplate_h
26 #include "vtkCommonCoreModule.h"
32 VTK_ABI_NAMESPACE_BEGIN
33 template <
class ValueTypeT>
62 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
75 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
85 if (this->StorageType == StorageTypeEnum::SOA)
87 for (
size_t cc = 0; cc < this->Data.size(); cc++)
89 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx];
94 ValueType* buffer = this->AoSData->GetBuffer();
105 if (this->StorageType == StorageTypeEnum::SOA)
107 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
109 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
114 ValueType* buffer = this->AoSData->GetBuffer();
125 if (this->StorageType == StorageTypeEnum::SOA)
127 return this->Data[comp]->GetBuffer()[tupleIdx];
137 if (this->StorageType == StorageTypeEnum::SOA)
139 this->Data[comp]->GetBuffer()[tupleIdx] =
value;
166 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
189 ValueType* GetComponentArrayPointer(
int comp);
227 this->Superclass::InsertTuples(dstIds, srcIds, source);
232 this->Superclass::InsertTuplesStartingAt(dstStart, srcIds, source);
256 std::vector<vtkBuffer<ValueType>*>
Data;
277 inline void GetTupleIndexFromValueIndex(
vtkIdType valueIdx,
vtkIdType& tupleIdx,
int& comp)
const
289 VTK_ABI_NAMESPACE_END
290 #endif // header guard
296 #ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
297 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
298 namespace vtkDataArrayPrivate \
300 VTK_ABI_NAMESPACE_BEGIN \
301 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<T>, double); \
302 VTK_ABI_NAMESPACE_END \
304 VTK_ABI_NAMESPACE_BEGIN \
305 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate<T>; \
306 VTK_ABI_NAMESPACE_END
308 #elif defined(VTK_USE_EXTERN_TEMPLATE)
309 #ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
310 #define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
312 #pragma warning(push)
315 #pragma warning(disable : 4910) // extern and dllexport incompatible
317 VTK_ABI_NAMESPACE_BEGIN
322 VTK_ABI_NAMESPACE_END
323 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
326 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
327 #pragma warning(push)
330 #pragma warning(disable : 4091)
333 #pragma warning(disable : 4231)
346 #pragma warning(disable : 4910) // extern and dllexport incompatible
350 VTK_ABI_NAMESPACE_BEGIN
355 VTK_ABI_NAMESPACE_END
Struct-Of-Arrays implementation of vtkGenericDataArray.
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
StorageTypeEnum StorageType
Abstract superclass for all arrays.
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
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.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
vtkBuffer< ValueType > * AoSData
list of point or cell ids
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
vtkSOADataArrayTemplate< ValueTypeT > SelfType
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
abstract superclass for arrays of numeric data
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))
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...
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
static vtkDataArray * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
Superclass::ValueType ValueType
std::vector< vtkBuffer< ValueType > * > Data
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
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 GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
StorageTypeEnum
Because we still need to support GetVoidPointer() for both reading from and writing to memory we may ...
virtual void ExportToVoidPointer(void *out_ptr)
This method copies the array data to the void pointer specified by the user.