28 #ifndef vtkSOADataArrayTemplate_h 29 #define vtkSOADataArrayTemplate_h 31 #include "vtkCommonCoreModule.h" 37 template <
class ValueTypeT>
46 typedef typename Superclass::ValueType
ValueType;
65 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
78 this->GetTupleIndexFromValueIndex(valueIdx, tupleIdx, comp);
88 for (
size_t cc=0; cc < this->Data.size(); cc++)
90 tuple[cc] = this->Data[cc]->GetBuffer()[tupleIdx];
99 for (
size_t cc=0; cc < this->Data.size(); ++cc)
101 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
110 return this->Data[comp]->GetBuffer()[tupleIdx];
118 this->Data[comp]->GetBuffer()[tupleIdx] =
value;
140 bool updateMaxId =
false,
bool save=
false,
141 int deleteMethod=VTK_DATA_ARRAY_FREE);
147 ValueType* GetComponentArrayPointer(
int comp);
200 { this->Superclass::InsertTuples(dstIds, srcIds, source); }
218 std::vector<vtkBuffer<ValueType>*>
Data;
227 inline void GetTupleIndexFromValueIndex(
vtkIdType valueIdx,
230 tupleIdx =
static_cast<vtkIdType>(valueIdx *
231 this->NumberOfComponentsReciprocal);
242 #endif // header guard 248 #ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING 249 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \ 250 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate< T > 251 #elif defined(VTK_USE_EXTERN_TEMPLATE) 252 #ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN 253 #define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN 255 #pragma warning (push) 258 #pragma warning (disable: 4910) // extern and dllexport incompatible 263 #pragma warning (pop) 265 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN 268 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS) 269 #pragma warning (push) 272 #pragma warning (disable: 4091) 275 #pragma warning (disable: 4231) 288 #pragma warning (disable: 4910) // extern and dllexport incompatible 293 extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
295 #pragma warning (pop) Struct-Of-Arrays implementation of vtkGenericDataArray.
vtkBuffer< ValueType > * AoSCopy
ValueType GetTypedComponent(vtkIdType tupleIdx, int comp) const
Get component comp of the tuple at tupleIdx.
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
Abstract superclass for all arrays.
vtkTemplateTypeMacro(SelfType, vtkDataArray) enum
Compile time access to the VTK type identifier.
static vtkSOADataArrayTemplate< ValueType > * FastDownCast(vtkAbstractArray *source)
Perform a fast, safe cast from a vtkAbstractArray to a vtkDataArray.
VTK_NEWINSTANCE vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
virtual int GetDataType()=0
Return the underlying data type.
virtual int GetArrayType()
Method for type-checking in FastDownCast implementations.
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.
double NumberOfComponentsReciprocal
#define vtkExternTemplateMacro(decl)
A macro to declare extern templates for all numerical types.
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
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
Abstract superclass to iterate over elements in an vtkAbstractArray.
#define vtkInstantiateTemplateMacro(decl)
A macro to instantiate a template over all numerical types.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
vtkArrayDownCast_TemplateFastCastMacro(vtkTypedDataArray) template< class Scalar > inline typename vtkTypedDataArray< Scalar >
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
boost::graph_traits< vtkGraph *>::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
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
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
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.
void SetNumberOfComponents(int num) override
Set/Get the dimension (n) of the components.
int GetArrayType() override
Method for type-checking in FastDownCast implementations.
Template defining traits of native types used by VTK.
void SetTypedComponent(vtkIdType tupleIdx, int comp, ValueType value)
Set component comp of the tuple at tupleIdx to value.
virtual void ExportToVoidPointer(void *out_ptr)
This method copies the array data to the void pointer specified by the user.