28#ifndef vtkmDataArray_h
29#define vtkmDataArray_h
31#include "vtkAcceleratorsVTKmCoreModule.h"
33#include "vtkmConfigCore.h"
35#include <viskores/VecTraits.h>
36#include <viskores/cont/ArrayHandle.h>
37#include <viskores/cont/UnknownArrayHandle.h>
44VTK_ABI_NAMESPACE_BEGIN
52template <
typename ArrayHandleType>
55template <
typename ArrayHandleType>
61VTK_ABI_NAMESPACE_BEGIN
66 static_assert(std::is_arithmetic<T>::value,
"T must be an integral or floating-point type");
68 using GenericDataArrayType =
76 using typename Superclass::ValueType;
93 "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead")
117 double* ranges, const
unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
120 double range[2], const
unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
123 double* ranges, const
unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
126 double range[2], const
unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
135 friend
fromvtkm::ArrayHandleHelperBase<T>;
136 friend
fromvtkm::ArrayHandleHelperUnknown<T>;
137 template <typename ArrayHandleType>
139 template <typename ArrayHandleType>
142 mutable
std::unique_ptr<
fromvtkm::ArrayHandleHelperBase<T>> Helper;
144 mutable
std::mutex Mutex;
154template <typename T, typename S>
156 const
viskores::cont::ArrayHandle<T, S>& ah)
159 ret->SetVtkmArrayHandle(ah);
164template <
typename TCast,
typename TReal,
typename S>
166 const viskores::cont::ArrayHandle<TCast, viskores::cont::StorageTagCast<TReal, S>>& ah)
169 ret->SetVtkmArrayHandle(ah);
174#ifndef vtkmDataArray_cxx
193#include "vtkmlib/vtkmDataArray.hxx"
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
vtkAbstractArray Superclass
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
Wraps a Viskores ArrayHandle inside a sub-class of vtkGenericDataArray.
bool ComputeVectorRange(double range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff) override
Returns true if the range was computed.
void * GetVoidPointer(vtkIdType valueIdx) override
T * GetPointer(vtkIdType valueIdx)
friend class fromvtkm::ArrayHandleHelperRead
ValueType GetValue(vtkIdType valueIdx) const
Support methods for vtkGenericDataArray.
friend class fromvtkm::ArrayHandleHelperWrite
bool ComputeFiniteVectorRange(double range[2], const unsigned char *ghosts, unsigned char ghostsToSkip=0xff) override
Returns true if the range was computed.
void SetValue(vtkIdType valueIdx, ValueType value)
void SetTypedTuple(vtkIdType tupleIdx, const ValueType *tuple)
vtkDataArray::MemorySpace GetMemorySpace() override
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
T * WritePointer(vtkIdType valueIdx, vtkIdType numValues)
vtkmDataArray< T > SelfType
bool ComputeFiniteScalarRange(double *ranges, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff) override
Computes the range for each component of an array, the length of ranges must be two times the number ...
static vtkmDataArray * New()
VTK_DEPRECATED_IN_9_7_0("Use vtkmDataArray::WritePointer(valueIdx, numValues) or " "vtkAbstractArray::SetNumberOf[Values/Tuples]() instead") void *WriteVoidPointer(vtkIdType valueIdx
void * GetDeviceVoidPointer(vtkIdType valueIdx) override
bool AllocateTuples(vtkIdType numberOfTuples)
concept methods for vtkGenericDataArray
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
void GetTypedTuple(vtkIdType tupleIdx, ValueType *tuple) const
ValueType GetTypedComponent(vtkIdType tupleIdx, int compIdx) const
viskores::cont::UnknownArrayHandle GetVtkmUnknownArrayHandle() const
Get the underlying ArrayHandle.
vtkTemplateTypeMacro(SelfType, GenericDataArrayType)
bool ComputeScalarRange(double *ranges, const unsigned char *ghosts, unsigned char ghostsToSkip=0xff) override
Computes the range for each component of an array, the length of ranges must be two times the number ...
vtkIdType numValues override
bool ReallocateTuples(vtkIdType numberOfTuples)
void SetVtkmArrayHandle(const viskores::cont::UnknownArrayHandle &ah)
Set the Viskores ArrayHandle to be wrapped.
#define vtkArrayDownCast_TemplateFastCastMacro(ArrayT)
Same as vtkArrayDownCast_FastCastMacro, but treats ArrayT as a single-parameter template (the paramet...
vtkmDataArray< typename viskores::VecTraits< T >::BaseComponentType > * make_vtkmDataArray(const viskores::cont::ArrayHandle< T, S > &ah)