49#ifndef vtkDeviceDataArray_h
50#define vtkDeviceDataArray_h
53#include "vtkCommonCoreModule.h"
64VTK_ABI_NAMESPACE_BEGIN
65template <
typename ValueTypeT>
68 vtkArrayTypes::VTK_DEVICE_DATA_ARRAY>
70 static_assert(std::is_arithmetic<ValueTypeT>::value,
"ValueTypeT must be a number");
80 using typename Superclass::ValueType;
175 mutable std::vector<ValueType> Host;
176 mutable std::atomic<bool> HostCurrent{
false };
177 mutable std::mutex HostMutex;
178 std::atomic<bool> WriteRefused{
false };
187#ifndef vtkDeviceDataArray_cxx
191#pragma warning(disable : 4910)
Array-Of-Structs implementation of vtkGenericDataArray.
static vtkAOSDataArrayTemplate * New()
virtual void ShallowCopy(vtkAbstractArray *src)
This method will copy the data from the source array to this array.
create and manipulate ordered lists of objects
a data array over GPU memory another library owns
vtkTypeBool ReserveTuples(vtkIdType numTuples) override
Refuse to grow past the device memory.
void Modified() override
Mark the host copy stale, so the next host read copies the device memory again.
static vtkDeviceDataArray * New()
vtkDataArray::MemorySpace GetMemorySpace() override
The device memory, as it is: where it lives, a pointer to it, and a descriptor holding this array (an...
void * GetDeviceVoidPointer(vtkIdType valueIdx) override
The device memory, as it is: where it lives, a pointer to it, and a descriptor holding this array (an...
vtkObjectBase * NewInstanceInternal() const override
bool ReallocateTuples(vtkIdType numTuples)
Concept methods: these succeed only within the device memory.
void ShallowCopy(vtkDataArray *other) override
Share another vtkDeviceDataArray's memory.
ValueType GetValue(vtkIdType valueIdx) const
The vtkGenericDataArray concept methods.
vtkCollection * NewMemoryDescriptors() override
The device memory, as it is: where it lives, a pointer to it, and a descriptor holding this array (an...
bool AllocateTuples(vtkIdType numTuples)
Concept methods: these succeed only within the device memory.
vtkAbstractTypeMacroWithNewInstanceType(SelfType, GenericDataArrayType, vtkAOSDataArrayTemplate< ValueTypeT >, typeid(SelfType).name())
vtkDeviceDataArray< ValueTypeT > SelfType
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
The vtkGenericDataArray concept methods.
~vtkDeviceDataArray() override
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
The vtkGenericDataArray concept methods.
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
The vtkGenericDataArray concept methods.
void * GetVoidPointer(vtkIdType valueIdx) override
The host copy of the values, made on first use.
void DataChanged() override
Tell the array explicitly that the data has changed.
bool SetDescriptor(vtkMemoryDescriptor *descriptor, vtkIdType numberOfTuples, int numberOfComponents)
Hold the memory descriptor describes as numberOfTuples tuples of numberOfComponents interleaved value...
void SetValue(vtkIdType valueIdx, ValueType value)
The vtkGenericDataArray concept methods.
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
The vtkGenericDataArray concept methods.
Describes a memory buffer on host or device, and who keeps it alive.
abstract base class for most VTK objects
Hold a reference to a vtkObjectBase instance.
#define vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the paramet...