22#ifndef vtkSOADataArrayTemplate_h
23#define vtkSOADataArrayTemplate_h
26#include "vtkCommonCoreModule.h"
32VTK_ABI_NAMESPACE_BEGIN
33template <
class ValueTypeT>
36 vtkArrayTypes::VTK_SOA_DATA_ARRAY>
46 using typename Superclass::ValueType;
67 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
81 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
100 for (
size_t cc = 0; cc < this->
Data.size(); ++cc)
102 this->
Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
129 this->
Data[comp]->GetBuffer()[tupleIdx] = value;
133 this->
AoSData->GetBuffer()[tupleIdx * this->GetNumberOfComponents() + comp] = value;
245 std::vector<vtkBuffer<ValueType>*>
Data;
273#define vtkCreateSOAWrappedArrayInterface(T) \
274 int GetDataType() const override; \
275 T GetDataTypeValueMin() const; \
276 T GetDataTypeValueMax() const; \
277 void GetTypedTuple(vtkIdType i, T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \
278 T GetValue(vtkIdType id) const VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \
279 T* GetValueRange(int comp) VTK_SIZEHINT(2); \
280 T* GetValueRange() VTK_SIZEHINT(2); \
281 void SetTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i && i < GetNumberOfTuples()); \
282 void InsertTypedTuple(vtkIdType i, const T* tuple) VTK_EXPECTS(0 <= i); \
283 vtkIdType InsertNextTypedTuple(const T* tuple); \
284 void SetValue(vtkIdType id, T value) VTK_EXPECTS(0 <= id && id < GetNumberOfValues()); \
285 bool SetNumberOfValues(vtkIdType number) override; \
286 void InsertValue(vtkIdType id, T f) VTK_EXPECTS(0 <= id); \
287 vtkIdType InsertNextValue(T f); \
288 T* GetComponentArrayPointer(int id); \
289 void SetArray(int comp, VTK_ZEROCOPY T* array, vtkIdType size, bool updateMaxId, bool save, \
298#ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
299#define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
300 namespace vtkDataArrayPrivate \
302 VTK_ABI_NAMESPACE_BEGIN \
303 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<T>, double); \
304 VTK_ABI_NAMESPACE_END \
306 VTK_ABI_NAMESPACE_BEGIN \
307 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate<T>; \
308 VTK_ABI_NAMESPACE_END
310#elif defined(VTK_USE_EXTERN_TEMPLATE)
311#ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
312#define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
317#pragma warning(disable : 4910)
319VTK_ABI_NAMESPACE_BEGIN
325VTK_ABI_NAMESPACE_BEGIN
351#elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
355#pragma warning(disable : 4091)
358#pragma warning(disable : 4231)
371#pragma warning(disable : 4910)
375VTK_ABI_NAMESPACE_BEGIN
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
@ 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...
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
Abstract superclass to iterate over elements in an vtkAbstractArray.
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others.
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.
StorageTypeEnum GetStorageType()
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
ValueType * GetComponentArrayPointer(int comp)
Return a pointer to a contiguous block of memory containing all values for a particular components (i...
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.
vtkBuffer< ValueType > * AoSData
static vtkSOADataArrayTemplate * New()
vtkSOADataArrayTemplate()
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
@ VTK_DATA_ARRAY_USER_DEFINED
@ VTK_DATA_ARRAY_ALIGNED_FREE
StorageTypeEnum
Because we still need to support GetVoidPointer() for both reading from and writing to memory we may ...
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
std::vector< vtkBuffer< ValueType > * > Data
vtkSOADataArrayTemplate< ValueTypeT > SelfType
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(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.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
StorageTypeEnum StorageType
void CopyData(vtkSOADataArrayTemplate< ValueType > *src)
void SetNumberOfComponents(int numComps) override
Set/Get the dimension (n) of the components.
#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 VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
#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 version)