22 #ifndef vtkAOSDataArrayTemplate_h
23 #define vtkAOSDataArrayTemplate_h
27 #include "vtkCommonCoreModule.h"
36 VTK_ABI_NAMESPACE_BEGIN
37 template <
typename ArrayType, ComponentIdType TupleSize>
40 typename ForceValueTypeForVtkDataArray =
double>
48 VTK_ABI_NAMESPACE_BEGIN
49 template <
class ValueTypeT>
53 vtkArrayTypes::VTK_AOS_DATA_ARRAY>
57 #else // Fake the superclass for the wrappers.
65 template <
typename ArrayType, vtk::ComponentIdType TupleSize>
68 typename ForceValueTypeForVtkDataArray>
75 using typename Superclass::ArrayTypeTag;
76 using typename Superclass::DataTypeTag;
77 using typename Superclass::ValueType;
98 return this->Buffer->GetBuffer()[valueIdx];
107 this->Buffer->GetBuffer()[valueIdx] =
value;
118 std::copy(this->Buffer->GetBuffer() + valueIdx,
131 std::copy(tuple, tuple + this->NumberOfComponents, this->Buffer->GetBuffer() + valueIdx);
141 tuple[ii] =
static_cast<vtkTypeInt64
>((this->Buffer->GetBuffer())[valueIdx + ii]);
151 this->Buffer->GetBuffer()[valueIdx + ii] =
static_cast<ValueType>(tuple[ii]);
161 tuple[ii] =
static_cast<vtkTypeUInt64
>((this->Buffer->GetBuffer())[valueIdx + ii]);
171 this->Buffer->GetBuffer()[valueIdx + ii] =
static_cast<ValueType>(tuple[ii]);
180 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents())
182 return this->Buffer->GetBuffer()[this->NumberOfComponents * tupleIdx + comp];
191 VTK_EXPECTS(0 <= comp && comp < GetNumberOfComponents())
193 const vtkIdType valueIdx = tupleIdx * this->NumberOfComponents + comp;
233 void* GetVoidPointer(
vtkIdType valueIdx) override;
245 #endif // __VTK_WRAP__
302 this->Superclass::SetTuple(dstTupleIdx, srcTupleIdx, source);
310 this->Superclass::InsertTuple(dstTupleIdx, srcTupleIdx, source);
319 return this->Superclass::InsertNextTuple(srcTupleIdx, source);
347 bool HasStandardMemoryLayout()
const override {
return true; }
358 this->Superclass::InsertTuples(dstIds, srcIds, source);
363 this->Superclass::InsertTuplesStartingAt(dstStart, srcIds, source);
380 bool AllocateTuples(
vtkIdType numTuples);
386 bool ReallocateTuples(
vtkIdType numTuples);
400 VTK_ABI_NAMESPACE_END
405 #define vtkCreateWrappedArrayInterface(T) \
406 vtkCreateWrappedArrayReadInterface(T); \
407 vtkCreateWrappedArrayWriteInterface(T); \
408 T* WritePointer(vtkIdType id, vtkIdType number); \
409 T* GetPointer(vtkIdType id); \
410 void SetArray(VTK_ZEROCOPY T* array, vtkIdType size, int save); \
411 void SetArray(VTK_ZEROCOPY T* array, vtkIdType size, int save, int deleteMethod); \
412 vtkAbstractBuffer* GetBuffer(); \
413 void SetBuffer(vtkAbstractBuffer* buffer, bool updateMaxId = false)
415 #endif // header guard
421 #ifdef VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATING
422 #define VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE(T) \
423 namespace vtkDataArrayPrivate \
425 VTK_ABI_NAMESPACE_BEGIN \
426 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<T>, double); \
427 VTK_ABI_NAMESPACE_END \
429 VTK_ABI_NAMESPACE_BEGIN \
430 template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate<T>; \
431 VTK_ABI_NAMESPACE_END
435 #define VTK_AOS_DATA_ARRAY_TEMPLATE_INSTANTIATE_VALUERANGE(T) \
436 namespace vtkDataArrayPrivate \
438 VTK_ABI_NAMESPACE_BEGIN \
439 VTK_INSTANTIATE_VALUERANGE_ARRAYTYPE(vtkAOSDataArrayTemplate<T>, T); \
440 VTK_ABI_NAMESPACE_END \
450 #elif defined(VTK_USE_EXTERN_TEMPLATE) && !defined(__MINGW32__)
451 #ifndef VTK_AOS_DATA_ARRAY_TEMPLATE_EXTERN
452 #define VTK_AOS_DATA_ARRAY_TEMPLATE_EXTERN
454 #pragma warning(push)
457 #pragma warning(disable : 4910) // extern and dllexport incompatible
459 VTK_ABI_NAMESPACE_BEGIN
461 VTK_ABI_NAMESPACE_END
465 VTK_ABI_NAMESPACE_BEGIN
487 VTK_ABI_NAMESPACE_END
493 #endif // VTK_AOS_DATA_ARRAY_TEMPLATE_EXTERN
496 #elif defined(_MSC_VER) && !defined(VTK_BUILD_SHARED_LIBS)
497 #pragma warning(push)
500 #pragma warning(disable : 4091)
503 #pragma warning(disable : 4231)
516 #pragma warning(disable : 4910) // extern and dllexport incompatible
520 VTK_ABI_NAMESPACE_BEGIN
522 VTK_ABI_NAMESPACE_END
void InsertTuplesStartingAt(vtkIdType dstStart, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations starting at index dstS...
void SetUnsignedTuple(vtkIdType tupleIdx, vtkTypeUInt64 *tuple) override
Get/set the data at tupleIdx by filling in a user-provided array of unsigned integers.
vtkBuffer< ValueTypeT > * GetBuffer()
Return the underlying buffer object.
virtual void ShallowCopy(vtkDataArray *other)
Create a shallow copy of other into this, if possible.
#define vtkCreateGenericWrappedArrayInterface(T)
void SetIntegerTuple(vtkIdType tupleIdx, vtkTypeInt64 *tuple) override
Get/set the data at tupleIdx by filling in a user-provided array of integers.
int GetNumberOfComponents() const
Set/Get the dimension (n) of the components.
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
See documentation from parent class.
Abstract superclass for all arrays.
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.
#define VTK_DECLARE_VALUERANGE_ARRAYTYPE(ArrayType, ValueType)
Specialization of tuple ranges and iterators for vtkAOSDataArrayTemplate.
Base interface for all typed vtkDataArray subclasses.
ValueType * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
Default implementation raises a runtime error.
GetAPIType< ArrayType, ForceValueTypeForVtkDataArray > ValueType
vtkIdType GetNumberOfValues() const
Get the total number of values in the array.
virtual void Fill(double value)
Fill all values of a data array with a specified value.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
void SetArrayFreeFunction(void(*callback)(void *)) override
Default implementation raises a runtime error.
vtkInstantiateTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkArrayIteratorTemplate)
internal storage class used by vtkSOADataArrayTemplate, vtkAOSDataArrayTemplate, and others...
void save(Archiver &ar, const std::string &str, const unsigned int version)
Array-Of-Structs implementation of vtkGenericDataArray.
list of point or cell ids
ValueType * GetPointer(vtkIdType valueIdx)
Default implementation raises a runtime error.
abstract superclass for arrays of numeric data
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
Copy the tuple at tupleIdx into tuple.
void InsertComponent(vtkIdType tupleIdx, int compIdx, double value) override
Insert value at the location specified by tupleIdx and compIdx.
Abstract superclass to iterate over elements in an vtkAbstractArray.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
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 comp) const
Get component comp of the tuple at tupleIdx.
virtual void FillValue(ValueType value)
Set all the values in array to value.
Abstract base class for vtkBuffer providing buffer protocol support.
double * GetTuple(vtkIdType tupleIdx) override
Get the data tuple at tupleIdx.
vtkArrayDownCast_TemplateFastCastMacro(vtkAOSDataArrayTemplate)
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
void DataChanged() override
Tell the array explicitly that the data has changed.
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
See documentation from parent class.
virtual void FillTypedComponent(int compIdx, ValueType value)
Set component comp of all tuples to value.
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
Set this array's tuple at tupleIdx to the values in tuple.
ValueType * Iterator
Legacy support for array-of-structs value iteration.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
void SetValue(vtkIdType valueIdx, ValueType value)
Set the value at valueIdx to value.
virtual void ShallowCopy(vtkAbstractArray *src)
This method will copy the data from the source array to this array.
vtkIdType InsertNextTuple(vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Insert the tuple from srcTupleIdx in the source array at the end of this array.
void GetUnsignedTuple(vtkIdType tupleIdx, vtkTypeUInt64 *tuple) override
Get/set the data at tupleIdx by filling in a user-provided array of unsigned integers.
void GetIntegerTuple(vtkIdType tupleIdx, vtkTypeInt64 *tuple) override
Get/set the data at tupleIdx by filling in a user-provided array of integers.
void SetTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Set the tuple at dstTupleIdx in this array to the tuple at srcTupleIdx in the source array...
#define VTK_DEPRECATED_IN_9_7_0(reason)
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...
void SetVoidArray(void *, vtkIdType, int) override
Default implementation raises a runtime error.
void InsertTuple(vtkIdType dstTupleIdx, vtkIdType srcTupleIdx, vtkAbstractArray *source) override
Insert the tuple at srcTupleIdx in the source array into this array at dstTupleIdx.
vtkExternTemplateMacro(extern template class VTKCOMMONCORE_EXPORT vtkAOSDataArrayTemplate)