22 #ifndef vtkSOADataArrayTemplate_h
23 #define vtkSOADataArrayTemplate_h
26 #include "vtkCommonCoreModule.h"
33 VTK_ABI_NAMESPACE_BEGIN
34 template <
class ValueTypeT>
38 vtkArrayTypes::VTK_SOA_DATA_ARRAY>
42 #else // Fake the superclass for the wrappers.
52 using typename Superclass::ArrayTypeTag;
53 using typename Superclass::DataTypeTag;
54 using typename Superclass::ValueType;
76 auto div = std::div(valueIdx, static_cast<vtkIdType>(this->NumberOfComponents));
88 auto div = std::div(valueIdx, static_cast<vtkIdType>(this->NumberOfComponents));
105 for (
size_t cc = 0; cc < this->Data.size(); ++cc)
107 this->Data[cc]->GetBuffer()[tupleIdx] = tuple[cc];
116 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents());
121 void SetTypedComponent(
vtkIdType tupleIdx,
int comp, ValueType
value)
122 VTK_EXPECTS(0 <= tupleIdx && GetNumberOfComponents() * tupleIdx + comp < GetNumberOfValues())
123 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents());
128 void FillTypedComponent(
int compIdx, ValueType
value) override;
144 bool save = false,
int deleteMethod = VTK_DATA_ARRAY_FREE);
190 ValueType* GetComponentArrayPointer(
int comp);
201 #endif // __VTK_WRAP__
214 void ExportToVoidPointer(
void* ptr) override;
231 void SetNumberOfComponents(
int numComps) override;
242 this->Superclass::InsertTuples(dstIds, srcIds, source);
247 this->Superclass::InsertTuplesStartingAt(dstStart, srcIds, source);
269 bool AllocateTuples(
vtkIdType numTuples);
275 bool ReallocateTuples(
vtkIdType numTuples);
289 VTK_ABI_NAMESPACE_END
294 #define vtkCreateSOAWrappedArrayInterface(T) \
295 vtkCreateWrappedArrayReadInterface(T); \
296 vtkCreateWrappedArrayWriteInterface(T); \
297 T* GetComponentArrayPointer(int id); \
298 vtkAbstractBuffer* GetComponentBuffer(int comp); \
299 void SetArray(int comp, VTK_ZEROCOPY T* array, vtkIdType size, bool updateMaxId, bool save, \
301 void SetBuffer(int comp, vtkAbstractBuffer* buffer, bool updateMaxId);
303 #endif // header guard
309 #ifdef VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATING
310 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
311 namespace vtkDataArrayPrivate \
313 VTK_ABI_NAMESPACE_BEGIN \
314 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<T>, double); \
315 VTK_ABI_NAMESPACE_END \
317 VTK_ABI_NAMESPACE_BEGIN \
318 template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate<T>; \
319 VTK_ABI_NAMESPACE_END
324 #define VTK_SOA_DATA_ARRAY_TEMPLATE_INSTANTIATE_VALUERANGE(T) \
325 namespace vtkDataArrayPrivate \
327 VTK_ABI_NAMESPACE_BEGIN \
328 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkSOADataArrayTemplate<T>, T); \
329 VTK_ABI_NAMESPACE_END \
339 #elif defined(VTK_USE_EXTERN_TEMPLATE) && !defined(__MINGW32__)
340 #ifndef VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
341 #define VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
343 #pragma warning(push)
346 #pragma warning(disable : 4910) // extern and dllexport incompatible
348 VTK_ABI_NAMESPACE_BEGIN
350 VTK_ABI_NAMESPACE_END
354 VTK_ABI_NAMESPACE_BEGIN
376 VTK_ABI_NAMESPACE_END
382 #endif // VTK_SOA_DATA_ARRAY_TEMPLATE_EXTERN
385 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
386 #pragma warning(push)
389 #pragma warning(disable : 4091)
392 #pragma warning(disable : 4231)
405 #pragma warning(disable : 4910) // extern and dllexport incompatible
409 VTK_ABI_NAMESPACE_BEGIN
411 VTK_ABI_NAMESPACE_END
Struct-Of-Arrays implementation of vtkGenericDataArray.
#define vtkCreateGenericWrappedArrayInterface(T)
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
Abstract superclass for all arrays.
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkSOADataArrayTemplate)
vtkArrayDownCast_TemplateFastCastMacro(vtkSOADataArrayTemplate)
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
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.
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
void save(Archiver &ar, const std::string &str, const unsigned int version)
list of point or cell ids
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
abstract superclass for arrays of numeric data
Abstract superclass to iterate over elements in an vtkAbstractArray.
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
Set component compIdx of the tuple at tupleIdx to value.
vtkIdType GetNumberOfTuples() const
Get the number of complete tuples (a component group) in the array.
vtkTemplateTypeMacro(SelfType, vtkDataArray)
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
Get component compIdx of the tuple at tupleIdx.
Abstract base class for vtkBuffer providing buffer protocol support.
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
ValueType GetValue(vtkIdType valueIdx) const
Get the value at valueIdx.
#define VTK_DEPRECATED_IN_9_7_0(reason)
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
void * GetVoidPointer(vtkIdType valueIdx) override
Default implementation raises a runtime error.
StorageTypeEnum
Because we still need to support GetVoidPointer() for both reading from and writing to memory we may ...