 |
VTK
9.1.0
|
Go to the documentation of this file.
28 #ifndef vtkSOADataArrayTemplate_h
29 #define vtkSOADataArrayTemplate_h
32 #include "vtkCommonCoreModule.h"
38 template <
class ValueTypeT>
67 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
80 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
90 for (
size_t cc = 0; cc < this->Data.size(); cc++)
92 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx];
101 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
103 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
112 return this->Data[comp]->GetBuffer()[tupleIdx];
120 this->Data[comp]->GetBuffer()[tupleIdx] =
value;
142 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
203 this->Superclass::InsertTuples(dstIds, srcIds,
source);
222 std::vector<vtkBuffer<ValueType>*>
Data;
241 #endif // header guard
247 #ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
248 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
249 namespace vtkDataArrayPrivate \
251 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<T>, double); \
253 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate<T>
255 #elif defined(VTK_USE_EXTERN_TEMPLATE)
256 #ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
257 #define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
259 #pragma warning(push)
262 #pragma warning(disable : 4910) // extern and dllexport incompatible
268 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
271 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
272 #pragma warning(push)
275 #pragma warning(disable : 4091)
278 #pragma warning(disable : 4231)
291 #pragma warning(disable : 4910) // extern and dllexport incompatible
@ VTK_DATA_ARRAY_ALIGNED_FREE
int GetArrayType() const override
vtkBuffer< ValueType > * AoSCopy
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
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.
~vtkSOADataArrayTemplate() override
void ExportToVoidPointer(void *ptr) override
Export a copy of the data in AoS ordering to the preallocated memory buffer.
Struct-Of-Arrays implementation of vtkGenericDataArray.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
void FillTypedComponent(int compIdx, ValueType value) override
Set component comp of all tuples to value.
vtkTemplateTypeMacro(SelfType, GenericDataArrayType)
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.
vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
abstract superclass for arrays of numeric data
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
static vtkSOADataArrayTemplate< ValueType > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
vtkSOADataArrayTemplate< ValueTypeT > SelfType
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...
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
vtkSOADataArrayTemplate()
ValueType * GetComponentArrayPointer(int comp)
Return a pointer to a contiguous block of memory containing all values for a particular components (i...
@ VTK_DATA_ARRAY_USER_DEFINED
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
void save(Archiver &ar, const std::string &str, const unsigned int vtkNotUsed(version))
list of point or cell ids
void ShallowCopy(vtkDataArray *other) override
void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray *source) override
Abstract superclass for all arrays.
vtkArrayIterator * NewIterator() override
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
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...
std::vector< vtkBuffer< ValueType > * > Data
Abstract superclass to iterate over elements in an vtkAbstractArray.
Superclass::ValueType ValueType
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
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...
static vtkSOADataArrayTemplate * New()
void SetNumberOfComponents(int numComps) override
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.