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");
76 using typename Superclass::ValueType;
109 using Superclass::ComputeScalarRange;
111 double* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
112 using Superclass::ComputeVectorRange;
114 double range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
115 using Superclass::ComputeFiniteScalarRange;
117 double* ranges,
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
118 using Superclass::ComputeFiniteVectorRange;
120 double range[2],
const unsigned char* ghosts,
unsigned char ghostsToSkip = 0xff)
override;
131 template <typename ArrayHandleType>
133 template <typename ArrayHandleType>
136 mutable std::unique_ptr<fromvtkm::ArrayHandleHelperBase<T>> Helper;
138 mutable std::mutex Mutex;
141 void operator=(const vtkmDataArray&) = delete;
148template <typename T, typename S>
150 const viskores::cont::ArrayHandle<T, S>& ah)
153 ret->SetVtkmArrayHandle(ah);
158template <
typename TCast,
typename TReal,
typename S>
160 const viskores::cont::ArrayHandle<TCast, viskores::cont::StorageTagCast<TReal, S>>& ah)
163 ret->SetVtkmArrayHandle(ah);
168#ifndef vtkmDataArray_cxx
187#include "vtkmlib/vtkmDataArray.hxx"
std::integral_constant< int, VTK_OPAQUE > DataTypeTag
std::integral_constant< int, vtkArrayTypes::VTK_ABSTRACT_ARRAY > ArrayTypeTag
Base interface for all typed vtkDataArray subclasses.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
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
ValueType GetValue(vtkIdType valueIdx) const
Support methods for vtkGenericDataArray.
void * WriteVoidPointer(vtkIdType valueIdx, vtkIdType numValues) override
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)
~vtkmDataArray() override
void SetTypedComponent(vtkIdType tupleIdx, int compIdx, ValueType value)
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()
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 ...
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)