 |
VTK
9.0.1
|
Go to the documentation of this file.
28 #ifndef vtkSOADataArrayTemplate_h
29 #define vtkSOADataArrayTemplate_h
32 #include "vtkCommonCoreModule.h"
37 template <
class ValueTypeT>
66 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
79 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
89 for (
size_t cc = 0; cc < this->Data.size(); cc++)
91 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx];
100 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
102 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
111 return this->Data[comp]->GetBuffer()[tupleIdx];
119 this->Data[comp]->GetBuffer()[tupleIdx] =
value;
141 bool save =
false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
164 ValueType* GetComponentArrayPointer(
int comp);
190 switch (
source->GetArrayType())
217 this->Superclass::InsertTuples(dstIds, srcIds,
source);
236 std::vector<vtkBuffer<ValueType>*>
Data;
243 inline void GetTupleIndexFromValueIndex(
vtkIdType valueIdx,
vtkIdType& tupleIdx,
int& comp)
const
255 #endif // header guard
261 #ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
262 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
263 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate<T>
264 #elif defined(VTK_USE_EXTERN_TEMPLATE)
265 #ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
266 #define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
268 #pragma warning(push)
271 #pragma warning(disable : 4910) // extern and dllexport incompatible
277 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
280 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
281 #pragma warning(push)
284 #pragma warning(disable : 4091)
287 #pragma warning(disable : 4231)
300 #pragma warning(disable : 4910) // extern and dllexport incompatible
@ VTK_DATA_ARRAY_ALIGNED_FREE
int GetArrayType() const override
Method for type-checking in FastDownCast implementations.
vtkBuffer< ValueType > * AoSCopy
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
Template defining traits of native types used by VTK.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
Struct-Of-Arrays implementation of vtkGenericDataArray.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
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
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...
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
bool AllocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
@ VTK_DATA_ARRAY_USER_DEFINED
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
list of point or cell ids
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
Abstract superclass for all arrays.
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
virtual void ExportToVoidPointer(void *out_ptr)
This method copies the array data to the void pointer specified by the user.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
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 *)
bool ReallocateTuples(vtkIdType numTuples)
Allocate space for numTuples.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
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.