mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Rename ArrayHandleVariant to VariantArrayHandle.
This commit is contained in:
parent
b138798604
commit
0a40c620ac
@ -22,10 +22,10 @@
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/ImplicitFunctionHandle.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
@ -319,9 +319,9 @@ class BenchmarkFieldAlgorithms
|
||||
|
||||
using Timer = vtkm::cont::Timer<DeviceAdapterTag>;
|
||||
|
||||
using ValueVariantHandle = vtkm::cont::ArrayHandleVariantBase<ValueTypes>;
|
||||
using InterpVariantHandle = vtkm::cont::ArrayHandleVariantBase<InterpValueTypes>;
|
||||
using IdVariantHandle = vtkm::cont::ArrayHandleVariantBase<vtkm::TypeListTagIndex>;
|
||||
using ValueVariantHandle = vtkm::cont::VariantArrayHandleBase<ValueTypes>;
|
||||
using InterpVariantHandle = vtkm::cont::VariantArrayHandleBase<InterpValueTypes>;
|
||||
using IdVariantHandle = vtkm::cont::VariantArrayHandleBase<vtkm::TypeListTagIndex>;
|
||||
|
||||
private:
|
||||
template <typename Value>
|
||||
@ -484,7 +484,7 @@ private:
|
||||
|
||||
vtkm::cont::ArrayHandle<Value> temp1;
|
||||
vtkm::cont::ArrayHandle<Value> temp2;
|
||||
vtkm::cont::ArrayHandleVariantBase<MathTypes> dinput(this->InputHandle);
|
||||
vtkm::cont::VariantArrayHandleBase<MathTypes> dinput(this->InputHandle);
|
||||
ValueVariantHandle dtemp1(temp1);
|
||||
ValueVariantHandle dtemp2(temp2);
|
||||
|
||||
@ -560,7 +560,7 @@ private:
|
||||
{
|
||||
using MathTypes = vtkm::ListTagBase<vtkm::Vec<vtkm::Float32, 3>, vtkm::Vec<vtkm::Float64, 3>>;
|
||||
|
||||
vtkm::cont::ArrayHandleVariantBase<MathTypes> dinput(this->InputHandle);
|
||||
vtkm::cont::VariantArrayHandleBase<MathTypes> dinput(this->InputHandle);
|
||||
|
||||
vtkm::cont::ArrayHandle<Value, StorageTag> result;
|
||||
|
||||
|
@ -840,7 +840,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Get the number of components in a ArrayHandleVariant, ArrayHandle, or Field's
|
||||
// Get the number of components in a VariantArrayHandle, ArrayHandle, or Field's
|
||||
// ValueType.
|
||||
struct NumberOfComponents
|
||||
{
|
||||
|
@ -146,7 +146,7 @@ class BenchmarkTopologyAlgorithms
|
||||
|
||||
using Timer = vtkm::cont::Timer<DeviceAdapterTag>;
|
||||
|
||||
using ValueVariantHandle = vtkm::cont::ArrayHandleVariantBase<ValueTypes>;
|
||||
using ValueVariantHandle = vtkm::cont::VariantArrayHandleBase<ValueTypes>;
|
||||
|
||||
private:
|
||||
template <typename T, typename Enable = void>
|
||||
|
@ -38,11 +38,11 @@ namespace
|
||||
|
||||
struct FieldMapper
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant& Output;
|
||||
vtkm::cont::VariantArrayHandle& Output;
|
||||
vtkm::worklet::Clip& Worklet;
|
||||
bool IsCellField;
|
||||
|
||||
FieldMapper(vtkm::cont::ArrayHandleVariant& output,
|
||||
FieldMapper(vtkm::cont::VariantArrayHandle& output,
|
||||
vtkm::worklet::Clip& worklet,
|
||||
bool isCellField)
|
||||
: Output(output)
|
||||
@ -124,7 +124,7 @@ int main(int argc, char* argv[])
|
||||
continue;
|
||||
}
|
||||
|
||||
vtkm::cont::ArrayHandleVariant outField;
|
||||
vtkm::cont::VariantArrayHandle outField;
|
||||
FieldMapper fieldMapper(outField, clip, isCellField);
|
||||
inField.GetData().CastAndCall(fieldMapper);
|
||||
output.AddField(vtkm::cont::Field(inField.GetName(), inField.GetAssociation(), outField));
|
||||
|
@ -23,13 +23,14 @@ set(headers
|
||||
ArrayCopy.h
|
||||
ArrayHandle.h
|
||||
ArrayHandleAny.h
|
||||
ArrayHandleCast.h
|
||||
ArrayHandleCartesianProduct.h
|
||||
ArrayHandleCast.h
|
||||
ArrayHandleCompositeVector.h
|
||||
ArrayHandleConcatenate.h
|
||||
ArrayHandleConstant.h
|
||||
ArrayHandleCounting.h
|
||||
ArrayHandleExtractComponent.h
|
||||
ArrayHandleDiscard.h
|
||||
ArrayHandleExtractComponent.h
|
||||
ArrayHandleGroupVec.h
|
||||
ArrayHandleGroupVecVariable.h
|
||||
ArrayHandleImplicit.h
|
||||
@ -40,19 +41,17 @@ set(headers
|
||||
ArrayHandleSwizzle.h
|
||||
ArrayHandleTransform.h
|
||||
ArrayHandleUniformPointCoordinates.h
|
||||
ArrayHandleVariant.h
|
||||
ArrayHandleView.h
|
||||
ArrayHandleVirtual.h
|
||||
ArrayHandleVirtualCoordinates.h
|
||||
ArrayHandleZip.h
|
||||
ArrayPortal.h
|
||||
ArrayPortalToIterators.h
|
||||
ArrayHandleConcatenate.h
|
||||
ArrayRangeCompute.h
|
||||
AssignerMultiBlock.h
|
||||
AtomicArray.h
|
||||
BoundingIntervalHierarchyNode.h
|
||||
BoundingIntervalHierarchy.h
|
||||
BoundingIntervalHierarchyNode.h
|
||||
BoundsCompute.h
|
||||
BoundsGlobalCompute.h
|
||||
CellLocator.h
|
||||
@ -61,9 +60,9 @@ set(headers
|
||||
CellSet.h
|
||||
CellSetExplicit.h
|
||||
CellSetListTag.h
|
||||
CellSetPermutation.h
|
||||
CellSetSingleType.h
|
||||
CellSetStructured.h
|
||||
CellSetPermutation.h
|
||||
ColorTable.h
|
||||
ColorTableSamples.h
|
||||
CoordinateSystem.h
|
||||
@ -83,8 +82,8 @@ set(headers
|
||||
ErrorBadDevice.h
|
||||
ErrorBadType.h
|
||||
ErrorBadValue.h
|
||||
ErrorFilterExecution.h
|
||||
ErrorExecution.h
|
||||
ErrorFilterExecution.h
|
||||
ErrorInternal.h
|
||||
ExecutionAndControlObjectBase.h
|
||||
ExecutionObjectBase.h
|
||||
@ -103,11 +102,12 @@ set(headers
|
||||
Storage.h
|
||||
StorageBasic.h
|
||||
StorageImplicit.h
|
||||
StorageVirtual.h
|
||||
StorageListTag.h
|
||||
StorageVirtual.h
|
||||
Timer.h
|
||||
TryExecute.h
|
||||
TypeString.h
|
||||
VariantArrayHandle.h
|
||||
VirtualObjectHandle.h
|
||||
)
|
||||
|
||||
@ -128,7 +128,6 @@ set(template_sources
|
||||
|
||||
set(sources
|
||||
ArrayHandle.cxx
|
||||
ArrayHandleVariant.cxx
|
||||
AssignerMultiBlock.cxx
|
||||
BoundsCompute.cxx
|
||||
BoundsGlobalCompute.cxx
|
||||
@ -161,6 +160,7 @@ set(sources
|
||||
StorageBasic.cxx
|
||||
StorageVirtual.cxx
|
||||
TryExecute.cxx
|
||||
VariantArrayHandle.cxx
|
||||
)
|
||||
|
||||
# This list of sources has code that uses devices and so might need to be
|
||||
|
@ -25,9 +25,9 @@
|
||||
#include <vtkm/StaticAssert.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
@ -118,12 +118,12 @@ template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(
|
||||
vtkm::cont::ArrayHandle<vtkm::Float64, vtkm::cont::StorageTagBasic>>::StorageTag>&);
|
||||
|
||||
template VTKM_CONT_EXPORT CoordinateSystem::CoordinateSystem(std::string name,
|
||||
const vtkm::cont::ArrayHandleVariant&);
|
||||
const vtkm::cont::VariantArrayHandle&);
|
||||
|
||||
template VTKM_CONT_EXPORT void CoordinateSystem::SetData(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<float, 3>>&);
|
||||
template VTKM_CONT_EXPORT void CoordinateSystem::SetData(
|
||||
const vtkm::cont::ArrayHandle<vtkm::Vec<double, 3>>&);
|
||||
template VTKM_CONT_EXPORT void CoordinateSystem::SetData(const vtkm::cont::ArrayHandleVariant&);
|
||||
template VTKM_CONT_EXPORT void CoordinateSystem::SetData(const vtkm::cont::VariantArrayHandle&);
|
||||
}
|
||||
} // namespace vtkm::cont
|
||||
|
@ -46,7 +46,7 @@ public:
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT CoordinateSystem(std::string name,
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& data);
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& data);
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT CoordinateSystem(std::string name, const ArrayHandle<T, Storage>& data);
|
||||
@ -71,7 +71,7 @@ public:
|
||||
|
||||
VTKM_CONT
|
||||
template <typename TypeList>
|
||||
void SetData(const vtkm::cont::ArrayHandleVariantBase<TypeList>& newdata);
|
||||
void SetData(const vtkm::cont::VariantArrayHandleBase<TypeList>& newdata);
|
||||
|
||||
VTKM_CONT
|
||||
void GetRange(vtkm::Range* range) const
|
||||
|
@ -50,7 +50,7 @@ struct MakeArrayHandleVirtualCoordinatesFunctor
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates MakeArrayHandleVirtualCoordinates(
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& array)
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& array)
|
||||
{
|
||||
vtkm::cont::ArrayHandleVirtualCoordinates output;
|
||||
vtkm::cont::CastAndCall(array.ResetTypes(vtkm::TypeListTagFieldVec3{}),
|
||||
@ -63,7 +63,7 @@ VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates MakeArrayHandleVirtualCoordi
|
||||
template <typename TypeList>
|
||||
VTKM_CONT CoordinateSystem::CoordinateSystem(
|
||||
std::string name,
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& data)
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& data)
|
||||
: Superclass(name, Association::POINTS, detail::MakeArrayHandleVirtualCoordinates(data))
|
||||
{
|
||||
}
|
||||
@ -83,7 +83,7 @@ VTKM_CONT void CoordinateSystem::SetData(const vtkm::cont::ArrayHandle<T, Storag
|
||||
|
||||
template <typename TypeList>
|
||||
VTKM_CONT void CoordinateSystem::SetData(
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& newdata)
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& newdata)
|
||||
{
|
||||
this->SetData(detail::MakeArrayHandleVirtualCoordinates(newdata));
|
||||
}
|
||||
|
@ -23,12 +23,12 @@
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
#include <vtkm/cont/Field.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
VTKM_CONT
|
||||
static void AddPointField(vtkm::cont::DataSet& dataSet,
|
||||
const std::string& fieldName,
|
||||
const vtkm::cont::ArrayHandleVariant& field)
|
||||
const vtkm::cont::VariantArrayHandle& field)
|
||||
{
|
||||
dataSet.AddField(Field(fieldName, vtkm::cont::Field::Association::POINTS, field));
|
||||
}
|
||||
@ -74,7 +74,7 @@ public:
|
||||
VTKM_CONT
|
||||
static void AddCellField(vtkm::cont::DataSet& dataSet,
|
||||
const std::string& fieldName,
|
||||
const vtkm::cont::ArrayHandleVariant& field,
|
||||
const vtkm::cont::VariantArrayHandle& field,
|
||||
const std::string& cellSetName)
|
||||
{
|
||||
dataSet.AddField(
|
||||
@ -119,7 +119,7 @@ public:
|
||||
VTKM_CONT
|
||||
static void AddCellField(vtkm::cont::DataSet& dataSet,
|
||||
const std::string& fieldName,
|
||||
const vtkm::cont::ArrayHandleVariant& field,
|
||||
const vtkm::cont::VariantArrayHandle& field,
|
||||
vtkm::Id cellSetIndex = 0)
|
||||
{
|
||||
std::string cellSetName = dataSet.GetCellSet(cellSetIndex).GetName();
|
||||
|
@ -45,7 +45,7 @@ VTKM_SILENCE_WEAK_VTABLE_WARNING_END
|
||||
|
||||
/// Throws an ErrorBadType exception with the following message:
|
||||
/// Cast failed: \c baseType --> \c derivedType".
|
||||
/// This is generally caused by asking for a casting of a ArrayHandleVariant
|
||||
/// This is generally caused by asking for a casting of a VariantArrayHandle
|
||||
/// with an insufficient type list.
|
||||
//
|
||||
VTKM_CONT_EXPORT void throwFailedDynamicCast(const std::string& baseType,
|
||||
|
@ -27,7 +27,7 @@ namespace cont
|
||||
|
||||
/// constructors for points / whole mesh
|
||||
VTKM_CONT
|
||||
Field::Field(std::string name, Association association, const vtkm::cont::ArrayHandleVariant& data)
|
||||
Field::Field(std::string name, Association association, const vtkm::cont::VariantArrayHandle& data)
|
||||
: Name(name)
|
||||
, FieldAssociation(association)
|
||||
, AssocCellSetName()
|
||||
@ -45,7 +45,7 @@ VTKM_CONT
|
||||
Field::Field(std::string name,
|
||||
Association association,
|
||||
const std::string& cellSetName,
|
||||
const vtkm::cont::ArrayHandleVariant& data)
|
||||
const vtkm::cont::VariantArrayHandle& data)
|
||||
: Name(name)
|
||||
, FieldAssociation(association)
|
||||
, AssocCellSetName(cellSetName)
|
||||
@ -62,7 +62,7 @@ VTKM_CONT
|
||||
Field::Field(std::string name,
|
||||
Association association,
|
||||
vtkm::IdComponent logicalDim,
|
||||
const vtkm::cont::ArrayHandleVariant& data)
|
||||
const vtkm::cont::VariantArrayHandle& data)
|
||||
: Name(name)
|
||||
, FieldAssociation(association)
|
||||
, AssocCellSetName()
|
||||
@ -157,13 +157,13 @@ Field::~Field()
|
||||
|
||||
|
||||
VTKM_CONT
|
||||
const vtkm::cont::ArrayHandleVariant& Field::GetData() const
|
||||
const vtkm::cont::VariantArrayHandle& Field::GetData() const
|
||||
{
|
||||
return this->Data;
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::ArrayHandleVariant& Field::GetData()
|
||||
vtkm::cont::VariantArrayHandle& Field::GetData()
|
||||
{
|
||||
this->ModifiedFlag = true;
|
||||
return this->Data;
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include <vtkm/Types.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/ArrayRangeCompute.h>
|
||||
#include <vtkm/cont/ArrayRangeCompute.hxx>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -71,13 +71,13 @@ public:
|
||||
|
||||
/// constructors for points / whole mesh
|
||||
VTKM_CONT
|
||||
Field(std::string name, Association association, const vtkm::cont::ArrayHandleVariant& data);
|
||||
Field(std::string name, Association association, const vtkm::cont::VariantArrayHandle& data);
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT Field(std::string name,
|
||||
Association association,
|
||||
const vtkm::cont::ArrayHandle<T, Storage>& data)
|
||||
: Field(name, association, vtkm::cont::ArrayHandleVariant{ data })
|
||||
: Field(name, association, vtkm::cont::VariantArrayHandle{ data })
|
||||
{
|
||||
}
|
||||
|
||||
@ -86,14 +86,14 @@ public:
|
||||
Field(std::string name,
|
||||
Association association,
|
||||
const std::string& cellSetName,
|
||||
const vtkm::cont::ArrayHandleVariant& data);
|
||||
const vtkm::cont::VariantArrayHandle& data);
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT Field(std::string name,
|
||||
Association association,
|
||||
const std::string& cellSetName,
|
||||
const vtkm::cont::ArrayHandle<T, Storage>& data)
|
||||
: Field(name, association, cellSetName, vtkm::cont::ArrayHandleVariant{ data })
|
||||
: Field(name, association, cellSetName, vtkm::cont::VariantArrayHandle{ data })
|
||||
{
|
||||
}
|
||||
|
||||
@ -102,14 +102,14 @@ public:
|
||||
Field(std::string name,
|
||||
Association association,
|
||||
vtkm::IdComponent logicalDim,
|
||||
const vtkm::cont::ArrayHandleVariant& data);
|
||||
const vtkm::cont::VariantArrayHandle& data);
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT Field(std::string name,
|
||||
Association association,
|
||||
vtkm::IdComponent logicalDim,
|
||||
const vtkm::cont::ArrayHandle<T, Storage>& data)
|
||||
: Field(name, association, logicalDim, vtkm::cont::ArrayHandleVariant{ data })
|
||||
: Field(name, association, logicalDim, vtkm::cont::VariantArrayHandle{ data })
|
||||
{
|
||||
}
|
||||
|
||||
@ -125,8 +125,8 @@ public:
|
||||
VTKM_CONT Association GetAssociation() const { return this->FieldAssociation; }
|
||||
VTKM_CONT std::string GetAssocCellSet() const { return this->AssocCellSetName; }
|
||||
VTKM_CONT vtkm::IdComponent GetAssocLogicalDim() const { return this->AssocLogicalDim; }
|
||||
const vtkm::cont::ArrayHandleVariant& GetData() const;
|
||||
vtkm::cont::ArrayHandleVariant& GetData();
|
||||
const vtkm::cont::VariantArrayHandle& GetData() const;
|
||||
vtkm::cont::VariantArrayHandle& GetData();
|
||||
|
||||
|
||||
template <typename TypeList>
|
||||
@ -165,7 +165,7 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
void SetData(const vtkm::cont::ArrayHandleVariant& newdata)
|
||||
void SetData(const vtkm::cont::VariantArrayHandle& newdata)
|
||||
{
|
||||
this->Data = newdata;
|
||||
this->ModifiedFlag = true;
|
||||
@ -188,7 +188,7 @@ private:
|
||||
std::string AssocCellSetName; ///< only populate if assoc is cells
|
||||
vtkm::IdComponent AssocLogicalDim; ///< only populate if assoc is logical dim
|
||||
|
||||
vtkm::cont::ArrayHandleVariant Data;
|
||||
vtkm::cont::VariantArrayHandle Data;
|
||||
mutable vtkm::cont::ArrayHandle<vtkm::Range> Range;
|
||||
mutable bool ModifiedFlag = true;
|
||||
|
||||
@ -358,26 +358,26 @@ public:
|
||||
diy::load(bb, assocVal);
|
||||
|
||||
auto assoc = static_cast<vtkm::cont::Field::Association>(assocVal);
|
||||
vtkm::cont::ArrayHandleVariantBase<TypeList> data;
|
||||
vtkm::cont::VariantArrayHandleBase<TypeList> data;
|
||||
if (assoc == vtkm::cont::Field::Association::CELL_SET)
|
||||
{
|
||||
std::string assocCellSetName;
|
||||
diy::load(bb, assocCellSetName);
|
||||
diy::load(bb, data);
|
||||
field =
|
||||
vtkm::cont::Field(name, assoc, assocCellSetName, vtkm::cont::ArrayHandleVariant(data));
|
||||
vtkm::cont::Field(name, assoc, assocCellSetName, vtkm::cont::VariantArrayHandle(data));
|
||||
}
|
||||
else if (assoc == vtkm::cont::Field::Association::LOGICAL_DIM)
|
||||
{
|
||||
vtkm::IdComponent assocLogicalDim;
|
||||
diy::load(bb, assocLogicalDim);
|
||||
diy::load(bb, data);
|
||||
field = vtkm::cont::Field(name, assoc, assocLogicalDim, vtkm::cont::ArrayHandleVariant(data));
|
||||
field = vtkm::cont::Field(name, assoc, assocLogicalDim, vtkm::cont::VariantArrayHandle(data));
|
||||
}
|
||||
else
|
||||
{
|
||||
diy::load(bb, data);
|
||||
field = vtkm::cont::Field(name, assoc, vtkm::cont::ArrayHandleVariant(data));
|
||||
field = vtkm::cont::Field(name, assoc, vtkm::cont::VariantArrayHandle(data));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -21,8 +21,8 @@
|
||||
#include <sstream>
|
||||
#include <typeindex>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/ErrorBadValue.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -31,18 +31,18 @@ namespace cont
|
||||
namespace internal
|
||||
{
|
||||
|
||||
ArrayHandleVariantContainerBase::ArrayHandleVariantContainerBase()
|
||||
VariantArrayHandleContainerBase::VariantArrayHandleContainerBase()
|
||||
{
|
||||
}
|
||||
|
||||
ArrayHandleVariantContainerBase::~ArrayHandleVariantContainerBase()
|
||||
VariantArrayHandleContainerBase::~VariantArrayHandleContainerBase()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
namespace detail
|
||||
{
|
||||
void ThrowCastAndCallException(const vtkm::cont::internal::ArrayHandleVariantContainerBase& ref,
|
||||
void ThrowCastAndCallException(const vtkm::cont::internal::VariantArrayHandleContainerBase& ref,
|
||||
const std::type_info& type)
|
||||
{
|
||||
std::ostringstream out;
|
@ -17,8 +17,8 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_ArrayHandleVariant_h
|
||||
#define vtk_m_cont_ArrayHandleVariant_h
|
||||
#ifndef vtk_m_cont_VariantArrayHandle_h
|
||||
#define vtk_m_cont_VariantArrayHandle_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
#include <vtkm/cont/Logging.h>
|
||||
#include <vtkm/cont/internal/DynamicTransform.h>
|
||||
|
||||
#include <vtkm/cont/internal/ArrayHandleVariantContainer.h>
|
||||
#include <vtkm/cont/internal/VariantArrayHandleContainer.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -39,7 +39,7 @@ namespace cont
|
||||
{
|
||||
/// \brief Holds an array handle without having to specify template parameters.
|
||||
///
|
||||
/// \c ArrayHandleVariant holds an \c ArrayHandle or \c ArrayHandleVirtual
|
||||
/// \c VariantArrayHandle holds an \c ArrayHandle or \c ArrayHandleVirtual
|
||||
/// object using runtime polymorphism to manage different value types and
|
||||
/// storage rather than compile-time templates. This adds a programming
|
||||
/// convenience that helps avoid a proliferation of templates. It also provides
|
||||
@ -47,65 +47,65 @@ namespace cont
|
||||
/// will not be known until runtime.
|
||||
///
|
||||
/// To interface between the runtime polymorphism and the templated algorithms
|
||||
/// in VTK-m, \c ArrayHandleVariant contains a method named \c CastAndCall that
|
||||
/// in VTK-m, \c VariantArrayHandle contains a method named \c CastAndCall that
|
||||
/// will determine the correct type from some known list of types. It returns
|
||||
/// an ArrayHandleVirtual which type erases the storage type by using polymorphism.
|
||||
/// This mechanism is used internally by VTK-m's worklet invocation
|
||||
/// mechanism to determine the type when running algorithms.
|
||||
///
|
||||
/// By default, \c ArrayHandleVariant will assume that the value type in the
|
||||
/// By default, \c VariantArrayHandle will assume that the value type in the
|
||||
/// array matches one of the types specified by \c VTKM_DEFAULT_TYPE_LIST_TAG
|
||||
/// This list can be changed by using the \c ResetTypes. It is
|
||||
/// worthwhile to match these lists closely to the possible types that might be
|
||||
/// used. If a type is missing you will get a runtime error. If there are more
|
||||
/// types than necessary, then the template mechanism will create a lot of
|
||||
/// object code that is never used, and keep in mind that the number of
|
||||
/// combinations grows exponentially when using multiple \c ArrayHandleVariant
|
||||
/// combinations grows exponentially when using multiple \c VariantArrayHandle
|
||||
/// objects.
|
||||
///
|
||||
/// The actual implementation of \c ArrayHandleVariant is in a templated class
|
||||
/// named \c ArrayHandleVariantBase, which is templated on the list of
|
||||
/// The actual implementation of \c VariantArrayHandle is in a templated class
|
||||
/// named \c VariantArrayHandleBase, which is templated on the list of
|
||||
/// component types.
|
||||
///
|
||||
template <typename TypeList>
|
||||
class VTKM_ALWAYS_EXPORT ArrayHandleVariantBase
|
||||
class VTKM_ALWAYS_EXPORT VariantArrayHandleBase
|
||||
{
|
||||
public:
|
||||
VTKM_CONT
|
||||
ArrayHandleVariantBase() = default;
|
||||
VariantArrayHandleBase() = default;
|
||||
|
||||
template <typename T, typename Storage>
|
||||
VTKM_CONT ArrayHandleVariantBase(const vtkm::cont::ArrayHandle<T, Storage>& array)
|
||||
: ArrayContainer(std::make_shared<internal::ArrayHandleVariantContainer<T>>(
|
||||
VTKM_CONT VariantArrayHandleBase(const vtkm::cont::ArrayHandle<T, Storage>& array)
|
||||
: ArrayContainer(std::make_shared<internal::VariantArrayHandleContainer<T>>(
|
||||
vtkm::cont::ArrayHandleAny<T>{ array }))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
explicit VTKM_CONT ArrayHandleVariantBase(
|
||||
explicit VTKM_CONT VariantArrayHandleBase(
|
||||
const vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual>& array)
|
||||
: ArrayContainer(std::make_shared<internal::ArrayHandleVariantContainer<T>>(array))
|
||||
: ArrayContainer(std::make_shared<internal::VariantArrayHandleContainer<T>>(array))
|
||||
{
|
||||
}
|
||||
|
||||
template <typename OtherTypeList>
|
||||
VTKM_CONT explicit ArrayHandleVariantBase(const ArrayHandleVariantBase<OtherTypeList>& src)
|
||||
VTKM_CONT explicit VariantArrayHandleBase(const VariantArrayHandleBase<OtherTypeList>& src)
|
||||
: ArrayContainer(internal::variant::GetContainer::Extract(src))
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_CONT ArrayHandleVariantBase(const ArrayHandleVariantBase& src) = default;
|
||||
VTKM_CONT ArrayHandleVariantBase(ArrayHandleVariantBase&& src) noexcept = default;
|
||||
VTKM_CONT VariantArrayHandleBase(const VariantArrayHandleBase& src) = default;
|
||||
VTKM_CONT VariantArrayHandleBase(VariantArrayHandleBase&& src) noexcept = default;
|
||||
|
||||
VTKM_CONT
|
||||
~ArrayHandleVariantBase() {}
|
||||
~VariantArrayHandleBase() {}
|
||||
|
||||
VTKM_CONT
|
||||
ArrayHandleVariantBase<TypeList>& operator=(const ArrayHandleVariantBase<TypeList>& src) =
|
||||
VariantArrayHandleBase<TypeList>& operator=(const VariantArrayHandleBase<TypeList>& src) =
|
||||
default;
|
||||
|
||||
VTKM_CONT
|
||||
ArrayHandleVariantBase<TypeList>& operator=(ArrayHandleVariantBase<TypeList>&& src) noexcept =
|
||||
VariantArrayHandleBase<TypeList>& operator=(VariantArrayHandleBase<TypeList>&& src) noexcept =
|
||||
default;
|
||||
|
||||
|
||||
@ -167,16 +167,16 @@ public:
|
||||
/// constraints.
|
||||
///
|
||||
template <typename NewTypeList>
|
||||
VTKM_CONT ArrayHandleVariantBase<NewTypeList> ResetTypes(NewTypeList = NewTypeList()) const
|
||||
VTKM_CONT VariantArrayHandleBase<NewTypeList> ResetTypes(NewTypeList = NewTypeList()) const
|
||||
{
|
||||
VTKM_IS_LIST_TAG(NewTypeList);
|
||||
return ArrayHandleVariantBase<NewTypeList>(*this);
|
||||
return VariantArrayHandleBase<NewTypeList>(*this);
|
||||
}
|
||||
|
||||
/// Attempts to cast the held array to a specific value type,
|
||||
/// then call the given functor with the cast array. The types
|
||||
/// tried in the cast are those in the lists defined by the TypeList.
|
||||
/// By default \c ArrayHandleVariant set this to VTKM_DEFAULT_TYPE_LIST_TAG.
|
||||
/// By default \c VariantArrayHandle set this to VTKM_DEFAULT_TYPE_LIST_TAG.
|
||||
///
|
||||
template <typename Functor, typename... Args>
|
||||
VTKM_CONT void CastAndCall(Functor&& f, Args&&...) const;
|
||||
@ -188,9 +188,9 @@ public:
|
||||
/// creating output arrays that should be the same type as some input array.
|
||||
///
|
||||
VTKM_CONT
|
||||
ArrayHandleVariantBase<TypeList> NewInstance() const
|
||||
VariantArrayHandleBase<TypeList> NewInstance() const
|
||||
{
|
||||
ArrayHandleVariantBase<TypeList> instance;
|
||||
VariantArrayHandleBase<TypeList> instance;
|
||||
instance.ArrayContainer = this->ArrayContainer->NewInstance();
|
||||
return instance;
|
||||
}
|
||||
@ -227,28 +227,28 @@ public:
|
||||
|
||||
private:
|
||||
friend struct internal::variant::GetContainer;
|
||||
std::shared_ptr<vtkm::cont::internal::ArrayHandleVariantContainerBase> ArrayContainer;
|
||||
std::shared_ptr<vtkm::cont::internal::VariantArrayHandleContainerBase> ArrayContainer;
|
||||
};
|
||||
|
||||
using ArrayHandleVariant = vtkm::cont::ArrayHandleVariantBase<VTKM_DEFAULT_TYPE_LIST_TAG>;
|
||||
using VariantArrayHandle = vtkm::cont::VariantArrayHandleBase<VTKM_DEFAULT_TYPE_LIST_TAG>;
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct ArrayHandleVariantTry
|
||||
struct VariantArrayHandleTry
|
||||
{
|
||||
template <typename T, typename Functor, typename... Args>
|
||||
void operator()(T,
|
||||
Functor&& f,
|
||||
bool& called,
|
||||
const vtkm::cont::internal::ArrayHandleVariantContainerBase& container,
|
||||
const vtkm::cont::internal::VariantArrayHandleContainerBase& container,
|
||||
Args&&... args) const
|
||||
{
|
||||
if (!called && vtkm::cont::internal::variant::IsVirtualType<T>(&container))
|
||||
{
|
||||
called = true;
|
||||
const auto* derived =
|
||||
static_cast<const vtkm::cont::internal::ArrayHandleVariantContainer<T>*>(&container);
|
||||
static_cast<const vtkm::cont::internal::VariantArrayHandleContainer<T>*>(&container);
|
||||
VTKM_LOG_CAST_SUCC(container, derived);
|
||||
f(derived->Array, std::forward<Args>(args)...);
|
||||
}
|
||||
@ -256,7 +256,7 @@ struct ArrayHandleVariantTry
|
||||
};
|
||||
|
||||
VTKM_CONT_EXPORT void ThrowCastAndCallException(
|
||||
const vtkm::cont::internal::ArrayHandleVariantContainerBase&,
|
||||
const vtkm::cont::internal::VariantArrayHandleContainerBase&,
|
||||
const std::type_info&);
|
||||
} // namespace detail
|
||||
|
||||
@ -264,11 +264,11 @@ VTKM_CONT_EXPORT void ThrowCastAndCallException(
|
||||
|
||||
template <typename TypeList>
|
||||
template <typename Functor, typename... Args>
|
||||
VTKM_CONT void ArrayHandleVariantBase<TypeList>::CastAndCall(Functor&& f, Args&&... args) const
|
||||
VTKM_CONT void VariantArrayHandleBase<TypeList>::CastAndCall(Functor&& f, Args&&... args) const
|
||||
{
|
||||
bool called = false;
|
||||
const auto& ref = *this->ArrayContainer;
|
||||
vtkm::ListForEach(detail::ArrayHandleVariantTry{},
|
||||
vtkm::ListForEach(detail::VariantArrayHandleTry{},
|
||||
TypeList{},
|
||||
std::forward<Functor>(f),
|
||||
called,
|
||||
@ -286,7 +286,7 @@ namespace internal
|
||||
{
|
||||
|
||||
template <typename TypeList>
|
||||
struct DynamicTransformTraits<vtkm::cont::ArrayHandleVariantBase<TypeList>>
|
||||
struct DynamicTransformTraits<vtkm::cont::VariantArrayHandleBase<TypeList>>
|
||||
{
|
||||
using DynamicTag = vtkm::cont::internal::DynamicTransformTagCastAndCall;
|
||||
};
|
||||
@ -303,7 +303,7 @@ namespace diy
|
||||
namespace internal
|
||||
{
|
||||
|
||||
struct ArrayHandleVariantSerializeFunctor
|
||||
struct VariantArrayHandleSerializeFunctor
|
||||
{
|
||||
template <typename ArrayHandleType>
|
||||
void operator()(const ArrayHandleType& ah, BinaryBuffer& bb) const
|
||||
@ -313,11 +313,11 @@ struct ArrayHandleVariantSerializeFunctor
|
||||
}
|
||||
};
|
||||
|
||||
struct ArrayHandleVariantDeserializeFunctor
|
||||
struct VariantArrayHandleDeserializeFunctor
|
||||
{
|
||||
template <typename T, typename TypeList>
|
||||
void operator()(T,
|
||||
vtkm::cont::ArrayHandleVariantBase<TypeList>& dh,
|
||||
vtkm::cont::VariantArrayHandleBase<TypeList>& dh,
|
||||
const std::string& typeString,
|
||||
bool& success,
|
||||
BinaryBuffer& bb) const
|
||||
@ -328,7 +328,7 @@ struct ArrayHandleVariantDeserializeFunctor
|
||||
{
|
||||
ArrayHandleType ah;
|
||||
diy::load(bb, ah);
|
||||
dh = vtkm::cont::ArrayHandleVariantBase<TypeList>(ah);
|
||||
dh = vtkm::cont::VariantArrayHandleBase<TypeList>(ah);
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
@ -337,15 +337,15 @@ struct ArrayHandleVariantDeserializeFunctor
|
||||
} // internal
|
||||
|
||||
template <typename TypeList>
|
||||
struct Serialization<vtkm::cont::ArrayHandleVariantBase<TypeList>>
|
||||
struct Serialization<vtkm::cont::VariantArrayHandleBase<TypeList>>
|
||||
{
|
||||
private:
|
||||
using Type = vtkm::cont::ArrayHandleVariantBase<TypeList>;
|
||||
using Type = vtkm::cont::VariantArrayHandleBase<TypeList>;
|
||||
|
||||
public:
|
||||
static VTKM_CONT void save(BinaryBuffer& bb, const Type& obj)
|
||||
{
|
||||
vtkm::cont::CastAndCall(obj, internal::ArrayHandleVariantSerializeFunctor{}, bb);
|
||||
vtkm::cont::CastAndCall(obj, internal::VariantArrayHandleSerializeFunctor{}, bb);
|
||||
}
|
||||
|
||||
static VTKM_CONT void load(BinaryBuffer& bb, Type& obj)
|
||||
@ -355,12 +355,12 @@ public:
|
||||
|
||||
bool success = false;
|
||||
vtkm::ListForEach(
|
||||
internal::ArrayHandleVariantDeserializeFunctor{}, TypeList{}, obj, typeString, success, bb);
|
||||
internal::VariantArrayHandleDeserializeFunctor{}, TypeList{}, obj, typeString, success, bb);
|
||||
|
||||
if (!success)
|
||||
{
|
||||
throw vtkm::cont::ErrorBadType(
|
||||
"Error deserializing ArrayHandleVariant. Message TypeString: " + typeString);
|
||||
"Error deserializing VariantArrayHandle. Message TypeString: " + typeString);
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -368,4 +368,4 @@ public:
|
||||
} // diy
|
||||
|
||||
|
||||
#endif //vtk_m_virts_ArrayHandleVariant_h
|
||||
#endif //vtk_m_virts_VariantArrayHandle_h
|
@ -23,7 +23,7 @@ set(headers
|
||||
ArrayHandleBasicImpl.h
|
||||
ArrayHandleBasicImpl.hxx
|
||||
ArrayHandleExecutionManager.h
|
||||
ArrayHandleVariantContainer.h
|
||||
VariantArrayHandleContainer.h
|
||||
ArrayManagerExecution.h
|
||||
ArrayManagerExecutionShareWithControl.h
|
||||
ArrayPortalFromIterators.h
|
||||
|
50
vtkm/cont/internal/ArrayHandleVariantContainer.h → vtkm/cont/internal/VariantArrayHandleContainer.h
50
vtkm/cont/internal/ArrayHandleVariantContainer.h → vtkm/cont/internal/VariantArrayHandleContainer.h
@ -17,8 +17,8 @@
|
||||
// Laboratory (LANL), the U.S. Government retains certain rights in
|
||||
// this software.
|
||||
//============================================================================
|
||||
#ifndef vtk_m_cont_ArrayHandleVariantContainer_h
|
||||
#define vtk_m_cont_ArrayHandleVariantContainer_h
|
||||
#ifndef vtk_m_cont_VariantArrayHandleContainer_h
|
||||
#define vtk_m_cont_VariantArrayHandleContainer_h
|
||||
|
||||
#include <vtkm/cont/vtkm_cont_export.h>
|
||||
|
||||
@ -38,19 +38,19 @@ namespace cont
|
||||
|
||||
// Forward declaration needed for GetContainer
|
||||
template <typename TypeList>
|
||||
class ArrayHandleVariantBase;
|
||||
class VariantArrayHandleBase;
|
||||
|
||||
namespace internal
|
||||
{
|
||||
|
||||
/// \brief Base class for ArrayHandleVariantContainer
|
||||
/// \brief Base class for VariantArrayHandleContainer
|
||||
///
|
||||
struct VTKM_CONT_EXPORT ArrayHandleVariantContainerBase
|
||||
struct VTKM_CONT_EXPORT VariantArrayHandleContainerBase
|
||||
{
|
||||
ArrayHandleVariantContainerBase();
|
||||
VariantArrayHandleContainerBase();
|
||||
|
||||
// This must exist so that subclasses are destroyed correctly.
|
||||
virtual ~ArrayHandleVariantContainerBase();
|
||||
virtual ~VariantArrayHandleContainerBase();
|
||||
|
||||
virtual vtkm::Id GetNumberOfValues() const = 0;
|
||||
virtual vtkm::IdComponent GetNumberOfComponents() const = 0;
|
||||
@ -60,35 +60,35 @@ struct VTKM_CONT_EXPORT ArrayHandleVariantContainerBase
|
||||
|
||||
virtual void PrintSummary(std::ostream& out) const = 0;
|
||||
|
||||
virtual std::shared_ptr<ArrayHandleVariantContainerBase> NewInstance() const = 0;
|
||||
virtual std::shared_ptr<VariantArrayHandleContainerBase> NewInstance() const = 0;
|
||||
|
||||
virtual const vtkm::cont::StorageVirtual* GetStorage() const = 0;
|
||||
};
|
||||
|
||||
/// \brief ArrayHandle container that can use C++ run-time type information.
|
||||
///
|
||||
/// The \c ArrayHandleVariantContainer is similar to the
|
||||
/// The \c VariantArrayHandleContainer is similar to the
|
||||
/// \c SimplePolymorphicContainer in that it can contain an object of an
|
||||
/// unknown type. However, this class specifically holds ArrayHandle objects
|
||||
/// (with different template parameters) so that it can polymorphically answer
|
||||
/// simple questions about the object.
|
||||
///
|
||||
template <typename T>
|
||||
struct VTKM_ALWAYS_EXPORT ArrayHandleVariantContainer final : public ArrayHandleVariantContainerBase
|
||||
struct VTKM_ALWAYS_EXPORT VariantArrayHandleContainer final : public VariantArrayHandleContainerBase
|
||||
{
|
||||
vtkm::cont::ArrayHandleVirtual<T> Array;
|
||||
|
||||
ArrayHandleVariantContainer()
|
||||
VariantArrayHandleContainer()
|
||||
: Array()
|
||||
{
|
||||
}
|
||||
|
||||
ArrayHandleVariantContainer(const vtkm::cont::ArrayHandleVirtual<T>& array)
|
||||
VariantArrayHandleContainer(const vtkm::cont::ArrayHandleVirtual<T>& array)
|
||||
: Array(array)
|
||||
{
|
||||
}
|
||||
|
||||
~ArrayHandleVariantContainer<T>() = default;
|
||||
~VariantArrayHandleContainer<T>() = default;
|
||||
|
||||
vtkm::Id GetNumberOfValues() const { return this->Array.GetNumberOfValues(); }
|
||||
|
||||
@ -103,9 +103,9 @@ struct VTKM_ALWAYS_EXPORT ArrayHandleVariantContainer final : public ArrayHandle
|
||||
vtkm::cont::printSummary_ArrayHandle(this->Array, out);
|
||||
}
|
||||
|
||||
std::shared_ptr<ArrayHandleVariantContainerBase> NewInstance() const
|
||||
std::shared_ptr<VariantArrayHandleContainerBase> NewInstance() const
|
||||
{
|
||||
return std::make_shared<ArrayHandleVariantContainer<T>>(this->Array.NewInstance());
|
||||
return std::make_shared<VariantArrayHandleContainer<T>>(this->Array.NewInstance());
|
||||
}
|
||||
|
||||
const vtkm::cont::StorageVirtual* GetStorage() const { return this->Array.GetStorage(); }
|
||||
@ -116,21 +116,21 @@ namespace variant
|
||||
|
||||
// One instance of a template class cannot access the private members of
|
||||
// another instance of a template class. However, I want to be able to copy
|
||||
// construct a ArrayHandleVariant from another ArrayHandleVariant of any other
|
||||
// construct a VariantArrayHandle from another VariantArrayHandle of any other
|
||||
// type. Since you cannot partially specialize friendship, use this accessor
|
||||
// class to get at the internals for the copy constructor.
|
||||
struct GetContainer
|
||||
{
|
||||
template <typename TypeList>
|
||||
VTKM_CONT static const std::shared_ptr<ArrayHandleVariantContainerBase>& Extract(
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& src)
|
||||
VTKM_CONT static const std::shared_ptr<VariantArrayHandleContainerBase>& Extract(
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& src)
|
||||
{
|
||||
return src.ArrayContainer;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT bool IsType(const ArrayHandleVariantContainerBase* container)
|
||||
VTKM_CONT bool IsType(const VariantArrayHandleContainerBase* container)
|
||||
{ //container could be nullptr
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
|
||||
if (!container)
|
||||
@ -145,20 +145,20 @@ VTKM_CONT bool IsType(const ArrayHandleVariantContainerBase* container)
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
VTKM_CONT bool IsVirtualType(const ArrayHandleVariantContainerBase* container)
|
||||
VTKM_CONT bool IsVirtualType(const VariantArrayHandleContainerBase* container)
|
||||
{
|
||||
if (container == nullptr)
|
||||
{ //you can't use typeid on nullptr of polymorphic types
|
||||
return false;
|
||||
}
|
||||
return typeid(ArrayHandleVariantContainer<T>) == typeid(*container);
|
||||
return typeid(VariantArrayHandleContainer<T>) == typeid(*container);
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename S>
|
||||
struct VTKM_ALWAYS_EXPORT Caster
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T, S> operator()(const ArrayHandleVariantContainerBase* container) const
|
||||
vtkm::cont::ArrayHandle<T, S> operator()(const VariantArrayHandleContainerBase* container) const
|
||||
{
|
||||
using ArrayHandleType = vtkm::cont::ArrayHandle<T, S>;
|
||||
if (!IsType<ArrayHandleType>(container))
|
||||
@ -180,7 +180,7 @@ template <typename T>
|
||||
struct VTKM_ALWAYS_EXPORT Caster<T, vtkm::cont::StorageTagVirtual>
|
||||
{
|
||||
vtkm::cont::ArrayHandle<T, vtkm::cont::StorageTagVirtual> operator()(
|
||||
const ArrayHandleVariantContainerBase* container) const
|
||||
const VariantArrayHandleContainerBase* container) const
|
||||
{
|
||||
if (!IsVirtualType<T>(container))
|
||||
{
|
||||
@ -192,7 +192,7 @@ struct VTKM_ALWAYS_EXPORT Caster<T, vtkm::cont::StorageTagVirtual>
|
||||
// Technically, this method returns a copy of the \c ArrayHandle. But
|
||||
// because \c ArrayHandle acts like a shared pointer, it is valid to
|
||||
// do the copy.
|
||||
const auto* derived = static_cast<const ArrayHandleVariantContainer<T>*>(container);
|
||||
const auto* derived = static_cast<const VariantArrayHandleContainer<T>*>(container);
|
||||
VTKM_LOG_CAST_SUCC(container, derived->Array);
|
||||
return derived->Array;
|
||||
}
|
||||
@ -200,7 +200,7 @@ struct VTKM_ALWAYS_EXPORT Caster<T, vtkm::cont::StorageTagVirtual>
|
||||
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
VTKM_CONT ArrayHandleType Cast(const ArrayHandleVariantContainerBase* container)
|
||||
VTKM_CONT ArrayHandleType Cast(const VariantArrayHandleContainerBase* container)
|
||||
{ //container could be nullptr
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
|
||||
using Type = typename ArrayHandleType::ValueType;
|
@ -55,7 +55,7 @@ set(unit_tests
|
||||
UnitTestArrayHandleTransform.cxx
|
||||
UnitTestArrayHandleUniformPointCoordinates.cxx
|
||||
UnitTestArrayHandleConcatenate.cxx
|
||||
UnitTestArrayHandleVariant.cxx
|
||||
UnitTestVariantArrayHandle.cxx
|
||||
UnitTestArrayPortalToIterators.cxx
|
||||
UnitTestCellLocator.cxx
|
||||
UnitTestCellSetExplicit.cxx
|
||||
|
@ -27,11 +27,11 @@
|
||||
#include <vtkm/thirdparty/diy/Configure.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/CellSetStructured.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
|
||||
// clang-format off
|
||||
@ -219,7 +219,7 @@ struct TestEqualArrayHandle
|
||||
template <typename T, typename StorageTag, typename TypeList>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag>& array1,
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& array2,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
array2.CastAndCall(*this, array1, result);
|
||||
@ -227,7 +227,7 @@ struct TestEqualArrayHandle
|
||||
|
||||
template <typename T, typename StorageTag, typename TypeList>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList>& array1,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList>& array1,
|
||||
const vtkm::cont::ArrayHandle<T, StorageTag>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
@ -236,8 +236,8 @@ struct TestEqualArrayHandle
|
||||
|
||||
template <typename TypeList1, typename TypeList2>
|
||||
VTKM_CONT void operator()(
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList1>& array1,
|
||||
const vtkm::cont::ArrayHandleVariantBase<TypeList2>& array2,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList1>& array1,
|
||||
const vtkm::cont::VariantArrayHandleBase<TypeList2>& array2,
|
||||
TestEqualResult& result) const
|
||||
{
|
||||
array2.CastAndCall(*this, array1, result);
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define vtk_m_cont_testing_TestingSerialization_h
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
// clang-format off
|
||||
|
@ -83,7 +83,7 @@ struct IsNoExceptHandle
|
||||
using VirtualType = vtkm::cont::ArrayHandleVirtual<T>;
|
||||
|
||||
//verify the handle type
|
||||
is_noexcept_movable< HandleType >();
|
||||
is_noexcept_movable<HandleType>();
|
||||
is_noexcept_movable<AnyType>();
|
||||
is_noexcept_movable<VirtualType>();
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
#include <vtkm/cont/ArrayHandleVirtualCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleZip.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/testing/TestingSerialization.h>
|
||||
|
||||
@ -78,8 +78,8 @@ using TestTypesList =
|
||||
vtkm::ListTagBase<vtkm::Int8, vtkm::Id, vtkm::FloatDefault, vtkm::Vec<vtkm::FloatDefault, 3>>;
|
||||
|
||||
template <typename T, typename S>
|
||||
inline vtkm::cont::ArrayHandleVariantBase<vtkm::ListTagAppendUnique<TestTypesList, T>>
|
||||
MakeTestArrayHandleVariant(const vtkm::cont::ArrayHandle<T, S>& array)
|
||||
inline vtkm::cont::VariantArrayHandleBase<vtkm::ListTagAppendUnique<TestTypesList, T>>
|
||||
MakeTestVariantArrayHandle(const vtkm::cont::ArrayHandle<T, S>& array)
|
||||
{
|
||||
return array;
|
||||
}
|
||||
@ -91,7 +91,7 @@ struct TestArrayHandleBasic
|
||||
{
|
||||
auto array = RandomArrayHandle<T>::Make(ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -105,7 +105,7 @@ struct TestArrayHandleCartesianProduct
|
||||
RandomArrayHandle<T>::Make(ArraySize),
|
||||
RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -117,7 +117,7 @@ struct TestArrayHandleCast
|
||||
auto array =
|
||||
vtkm::cont::make_ArrayHandleCast<T>(RandomArrayHandle<vtkm::Int8>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -129,7 +129,7 @@ struct TestArrayHandleCompositeVector
|
||||
auto array = vtkm::cont::make_ArrayHandleCompositeVector(RandomArrayHandle<T>::Make(ArraySize),
|
||||
RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -141,7 +141,7 @@ struct TestArrayHandleConcatenate
|
||||
auto array = vtkm::cont::make_ArrayHandleConcatenate(RandomArrayHandle<T>::Make(ArraySize),
|
||||
RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -153,7 +153,7 @@ struct TestArrayHandleConstant
|
||||
T cval = RandomValue<T>::Make();
|
||||
auto array = vtkm::cont::make_ArrayHandleConstant(cval, ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -166,7 +166,7 @@ struct TestArrayHandleCounting
|
||||
T step = RandomValue<T>::Make(0, 5);
|
||||
auto array = vtkm::cont::make_ArrayHandleCounting(start, step, ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -179,7 +179,7 @@ struct TestArrayHandleExtractComponent
|
||||
auto array = vtkm::cont::make_ArrayHandleExtractComponent(
|
||||
RandomArrayHandle<T>::Make(ArraySize), RandomValue<vtkm::IdComponent>::Make(0, numComps - 1));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -196,21 +196,21 @@ struct TestArrayHandleGroupVec
|
||||
{
|
||||
auto array = vtkm::cont::make_ArrayHandleGroupVec<3>(flat);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
auto array = vtkm::cont::make_ArrayHandleGroupVec<4>(flat);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
auto array = vtkm::cont::make_ArrayHandleGroupVec<2>(flat);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -238,7 +238,7 @@ struct TestArrayHandleGroupVecVariable
|
||||
|
||||
// cannot make a DynamicArrayHandle containing ArrayHandleGroupVecVariable
|
||||
// because of the variable number of components of its values.
|
||||
// RunTest(MakeTestArrayHandleVariant(array));
|
||||
// RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -269,7 +269,7 @@ struct TestArrayHandleImplicit
|
||||
ImplicitFunctor<T> functor(RandomValue<T>::Make(2, 9));
|
||||
auto array = vtkm::cont::make_ArrayHandleImplicit(functor, ArraySize);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -278,7 +278,7 @@ void TestArrayHandleIndex()
|
||||
auto size = RandomValue<vtkm::Id>::Make(2, 10);
|
||||
auto array = vtkm::cont::ArrayHandleIndex(size);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
|
||||
struct TestArrayHandlePermutation
|
||||
@ -295,7 +295,7 @@ struct TestArrayHandlePermutation
|
||||
RandomArrayHandle<vtkm::Id>::Make(ArraySize, 0, ArraySize - 1),
|
||||
RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -306,7 +306,7 @@ struct TestArrayHandleReverse
|
||||
{
|
||||
auto array = vtkm::cont::make_ArrayHandleReverse(RandomArrayHandle<T>::Make(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
@ -329,7 +329,7 @@ struct TestArrayHandleSwizzle
|
||||
auto array = make_ArrayHandleSwizzle(RandomArrayHandle<vtkm::Vec<T, 3>>::Make(ArraySize),
|
||||
map2s[RandomValue<int>::Make(0, 5)]);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
@ -338,7 +338,7 @@ struct TestArrayHandleSwizzle
|
||||
auto array = make_ArrayHandleSwizzle(RandomArrayHandle<vtkm::Vec<T, 3>>::Make(ArraySize),
|
||||
map3s[RandomValue<int>::Make(0, 5)]);
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -372,7 +372,7 @@ struct TestArrayHandleTransform
|
||||
auto array = vtkm::cont::make_ArrayHandleTransform(RandomArrayHandle<T>::Make(ArraySize),
|
||||
TransformFunctor{});
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -381,7 +381,7 @@ struct TestArrayHandleTransform
|
||||
auto array = vtkm::cont::make_ArrayHandleTransform(
|
||||
RandomArrayHandle<T>::Make(ArraySize), TransformFunctor{}, InverseTransformFunctor{});
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -404,7 +404,7 @@ void TestArrayHandleUniformPointCoordinates()
|
||||
{
|
||||
auto array = MakeRandomArrayHandleUniformPointCoordinates();
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
|
||||
void TestArrayHandleVirtualCoordinates()
|
||||
@ -432,7 +432,7 @@ void TestArrayHandleVirtualCoordinates()
|
||||
}
|
||||
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
|
||||
struct TestArrayHandleZip
|
||||
@ -443,7 +443,7 @@ struct TestArrayHandleZip
|
||||
auto array = vtkm::cont::make_ArrayHandleZip(RandomArrayHandle<T>::Make(ArraySize),
|
||||
vtkm::cont::ArrayHandleIndex(ArraySize));
|
||||
RunTest(array);
|
||||
RunTest(MakeTestArrayHandleVariant(array));
|
||||
RunTest(MakeTestVariantArrayHandle(array));
|
||||
}
|
||||
};
|
||||
|
||||
|
32
vtkm/cont/testing/UnitTestArrayHandleVariant.cxx → vtkm/cont/testing/UnitTestVariantArrayHandle.cxx
32
vtkm/cont/testing/UnitTestArrayHandleVariant.cxx → vtkm/cont/testing/UnitTestVariantArrayHandle.cxx
@ -18,7 +18,7 @@
|
||||
// this software.
|
||||
//============================================================================
|
||||
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <vtkm/TypeTraits.h>
|
||||
|
||||
@ -47,7 +47,7 @@
|
||||
namespace vtkm
|
||||
{
|
||||
|
||||
// ArrayHandleVariant requires its value type to have a defined VecTraits
|
||||
// VariantArrayHandle requires its value type to have a defined VecTraits
|
||||
// class. One of the tests is to use an "unusual" array of std::string
|
||||
// (which is pretty pointless but might tease out some assumptions).
|
||||
// Make an implementation here. Because I am lazy, this is only a partial
|
||||
@ -124,7 +124,7 @@ struct CheckFunctor
|
||||
};
|
||||
|
||||
template <typename TypeList>
|
||||
void BasicArrayVariantChecks(const vtkm::cont::ArrayHandleVariantBase<TypeList>& array,
|
||||
void BasicArrayVariantChecks(const vtkm::cont::VariantArrayHandleBase<TypeList>& array,
|
||||
vtkm::IdComponent numComponents)
|
||||
{
|
||||
VTKM_TEST_ASSERT(array.GetNumberOfValues() == ARRAY_SIZE,
|
||||
@ -133,7 +133,7 @@ void BasicArrayVariantChecks(const vtkm::cont::ArrayHandleVariantBase<TypeList>&
|
||||
"Dynamic array reports unexpected number of components.");
|
||||
}
|
||||
|
||||
void CheckArrayVariant(vtkm::cont::ArrayHandleVariant array, vtkm::IdComponent numComponents)
|
||||
void CheckArrayVariant(vtkm::cont::VariantArrayHandle array, vtkm::IdComponent numComponents)
|
||||
{
|
||||
BasicArrayVariantChecks(array, numComponents);
|
||||
|
||||
@ -145,7 +145,7 @@ void CheckArrayVariant(vtkm::cont::ArrayHandleVariant array, vtkm::IdComponent n
|
||||
}
|
||||
|
||||
template <typename TypeList>
|
||||
void CheckArrayVariant(const vtkm::cont::ArrayHandleVariantBase<TypeList>& array,
|
||||
void CheckArrayVariant(const vtkm::cont::VariantArrayHandleBase<TypeList>& array,
|
||||
vtkm::IdComponent numComponents)
|
||||
{
|
||||
BasicArrayVariantChecks(array, numComponents);
|
||||
@ -158,7 +158,7 @@ void CheckArrayVariant(const vtkm::cont::ArrayHandleVariantBase<TypeList>& array
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleVariant CreateArrayVariant(T)
|
||||
vtkm::cont::VariantArrayHandle CreateArrayVariant(T)
|
||||
{
|
||||
// Declared static to prevent going out of scope.
|
||||
static T buffer[ARRAY_SIZE];
|
||||
@ -167,7 +167,7 @@ vtkm::cont::ArrayHandleVariant CreateArrayVariant(T)
|
||||
buffer[index] = TestValue(index, T());
|
||||
}
|
||||
|
||||
return vtkm::cont::ArrayHandleVariant(vtkm::cont::make_ArrayHandle(buffer, ARRAY_SIZE));
|
||||
return vtkm::cont::VariantArrayHandle(vtkm::cont::make_ArrayHandle(buffer, ARRAY_SIZE));
|
||||
}
|
||||
|
||||
template <typename ArrayHandleType>
|
||||
@ -175,7 +175,7 @@ void CheckCastToArrayHandle(const ArrayHandleType& array)
|
||||
{
|
||||
VTKM_IS_ARRAY_HANDLE(ArrayHandleType);
|
||||
|
||||
vtkm::cont::ArrayHandleVariant arrayVariant = array;
|
||||
vtkm::cont::VariantArrayHandle arrayVariant = array;
|
||||
VTKM_TEST_ASSERT(!arrayVariant.IsType<vtkm::cont::ArrayHandle<std::string>>(),
|
||||
"Dynamic array reporting is wrong type.");
|
||||
|
||||
@ -227,7 +227,7 @@ void TryNewInstance(T, ArrayVariantType originalArray)
|
||||
template <typename T>
|
||||
void TryDefaultType(T)
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant array = CreateArrayVariant(T());
|
||||
vtkm::cont::VariantArrayHandle array = CreateArrayVariant(T());
|
||||
|
||||
CheckArrayVariant(array, vtkm::VecTraits<T>::NUM_COMPONENTS);
|
||||
|
||||
@ -239,7 +239,7 @@ struct TryBasicVTKmType
|
||||
template <typename T>
|
||||
void operator()(T) const
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant array = CreateArrayVariant(T());
|
||||
vtkm::cont::VariantArrayHandle array = CreateArrayVariant(T());
|
||||
|
||||
CheckArrayVariant(array.ResetTypes(vtkm::TypeListTagAll()), vtkm::VecTraits<T>::NUM_COMPONENTS);
|
||||
|
||||
@ -250,7 +250,7 @@ struct TryBasicVTKmType
|
||||
void TryUnusualType()
|
||||
{
|
||||
// A string is an unlikely type to be declared elsewhere in VTK-m.
|
||||
vtkm::cont::ArrayHandleVariant array = CreateArrayVariant(std::string());
|
||||
vtkm::cont::VariantArrayHandle array = CreateArrayVariant(std::string());
|
||||
|
||||
try
|
||||
{
|
||||
@ -268,7 +268,7 @@ void TryUnusualType()
|
||||
|
||||
void TryUnusualStorage()
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant array = ArrayHandleWithUnusualStorage<vtkm::Id>();
|
||||
vtkm::cont::VariantArrayHandle array = ArrayHandleWithUnusualStorage<vtkm::Id>();
|
||||
|
||||
try
|
||||
{
|
||||
@ -282,7 +282,7 @@ void TryUnusualStorage()
|
||||
|
||||
void TryUnusualTypeAndStorage()
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant array = ArrayHandleWithUnusualStorage<std::string>();
|
||||
vtkm::cont::VariantArrayHandle array = ArrayHandleWithUnusualStorage<std::string>();
|
||||
|
||||
try
|
||||
{
|
||||
@ -353,7 +353,7 @@ void TryCastToArrayHandle()
|
||||
// CheckCastToArrayHandle(vtkm::cont::make_ArrayHandleZip(countingArray, array));
|
||||
}
|
||||
|
||||
void TestArrayHandleVariant()
|
||||
void TestVariantArrayHandle()
|
||||
{
|
||||
std::cout << "Try common types with default type lists." << std::endl;
|
||||
std::cout << "*** vtkm::Id **********************" << std::endl;
|
||||
@ -387,7 +387,7 @@ void TestArrayHandleVariant()
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
int UnitTestArrayHandleVariant(int, char* [])
|
||||
int UnitTestVariantArrayHandle(int, char* [])
|
||||
{
|
||||
return vtkm::cont::testing::Testing::Run(TestArrayHandleVariant);
|
||||
return vtkm::cont::testing::Testing::Run(TestVariantArrayHandle);
|
||||
}
|
@ -119,7 +119,7 @@ inline VTKM_CONT bool ExtractGeometry::DoMapField(
|
||||
const vtkm::filter::FieldMetadata& fieldMeta,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant output;
|
||||
vtkm::cont::VariantArrayHandle output;
|
||||
|
||||
if (fieldMeta.IsPointField())
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ public:
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
vtkm::cont::Field AsField(const vtkm::cont::ArrayHandleVariant& handle) const
|
||||
vtkm::cont::Field AsField(const vtkm::cont::VariantArrayHandle& handle) const
|
||||
{
|
||||
if (this->IsCellField())
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ struct PolicyBase
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy>
|
||||
VTKM_CONT vtkm::cont::ArrayHandleVariantBase<typename DerivedPolicy::FieldTypeList> ApplyPolicy(
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandleBase<typename DerivedPolicy::FieldTypeList> ApplyPolicy(
|
||||
const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&)
|
||||
{
|
||||
@ -60,7 +60,7 @@ VTKM_CONT vtkm::cont::ArrayHandleVariantBase<typename DerivedPolicy::FieldTypeLi
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
template <typename DerivedPolicy, typename FilterType, typename FieldTag>
|
||||
VTKM_CONT vtkm::cont::ArrayHandleVariantBase<
|
||||
VTKM_CONT vtkm::cont::VariantArrayHandleBase<
|
||||
typename vtkm::filter::DeduceFilterFieldTypes<DerivedPolicy, FilterType, FieldTag>::TypeList>
|
||||
ApplyPolicy(const vtkm::cont::Field& field,
|
||||
const vtkm::filter::PolicyBase<DerivedPolicy>&,
|
||||
|
@ -108,7 +108,7 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResult(
|
||||
return clone;
|
||||
}
|
||||
|
||||
/// Use this function if you have a ArrayHandleVariant that holds the data
|
||||
/// Use this function if you have a VariantArrayHandle that holds the data
|
||||
/// for the field. You also need to specify a name and an association for the
|
||||
/// field. If the field is associated with a particular element set (for
|
||||
/// example, a cell association is associated with a cell set), the name of
|
||||
@ -116,7 +116,7 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResult(
|
||||
/// for \c Association::WHOLE_MESH and \c Association::POINTS associations.
|
||||
///
|
||||
inline VTKM_CONT vtkm::cont::DataSet CreateResult(const vtkm::cont::DataSet& inDataSet,
|
||||
const vtkm::cont::ArrayHandleVariant& fieldArray,
|
||||
const vtkm::cont::VariantArrayHandle& fieldArray,
|
||||
const std::string& fieldName,
|
||||
vtkm::cont::Field::Association fieldAssociation,
|
||||
const std::string& elementSetName = "")
|
||||
|
@ -75,7 +75,7 @@ void TestClipStructured()
|
||||
VTKM_TEST_ASSERT(outputData.GetCellSet().GetNumberOfCells() == 8,
|
||||
"Wrong number of cells in the output dataset");
|
||||
|
||||
vtkm::cont::ArrayHandleVariant temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::VariantArrayHandle temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
temp.CopyTo(resultArrayHandle);
|
||||
|
||||
@ -115,7 +115,7 @@ void TestClipStructuredInverted()
|
||||
VTKM_TEST_ASSERT(outputData.GetCellSet().GetNumberOfCells() == 4,
|
||||
"Wrong number of cells in the output dataset");
|
||||
|
||||
vtkm::cont::ArrayHandleVariant temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::VariantArrayHandle temp = outputData.GetField("scalars").GetData();
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
|
||||
temp.CopyTo(resultArrayHandle);
|
||||
|
||||
|
@ -28,9 +28,9 @@
|
||||
#include <vtkm/Types.h>
|
||||
#include <vtkm/VecTraits.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/ArrayPortalToIterators.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/internal/ExportMacros.h>
|
||||
#include <vtkm/io/ErrorIO.h>
|
||||
|
||||
@ -93,9 +93,9 @@ struct StreamIOType<vtkm::UInt8>
|
||||
using Type = vtkm::UInt16;
|
||||
};
|
||||
|
||||
// Since Fields and DataSets store data in the default ArrayHandleVariant, convert
|
||||
// Since Fields and DataSets store data in the default VariantArrayHandle, convert
|
||||
// the data to the closest type supported by default. The following will
|
||||
// need to be updated if ArrayHandleVariant or TypeListTagCommon changes.
|
||||
// need to be updated if VariantArrayHandle or TypeListTagCommon changes.
|
||||
template <typename T>
|
||||
struct ClosestCommonType
|
||||
{
|
||||
@ -179,7 +179,7 @@ struct ClosestFloat<vtkm::UInt64>
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
vtkm::cont::ArrayHandleVariant CreateArrayHandleVariant(const std::vector<T>& vec)
|
||||
vtkm::cont::VariantArrayHandle CreateVariantArrayHandle(const std::vector<T>& vec)
|
||||
{
|
||||
switch (vtkm::VecTraits<T>::NUM_COMPONENTS)
|
||||
{
|
||||
@ -202,7 +202,7 @@ vtkm::cont::ArrayHandleVariant CreateArrayHandleVariant(const std::vector<T>& ve
|
||||
portal.Set(i, static_cast<CommonType>(vec[static_cast<std::size_t>(i)]));
|
||||
}
|
||||
|
||||
return vtkm::cont::ArrayHandleVariant(output);
|
||||
return vtkm::cont::VariantArrayHandle(output);
|
||||
}
|
||||
case 2:
|
||||
case 3:
|
||||
@ -234,12 +234,12 @@ vtkm::cont::ArrayHandleVariant CreateArrayHandleVariant(const std::vector<T>& ve
|
||||
portal.Set(i, outval);
|
||||
}
|
||||
|
||||
return vtkm::cont::ArrayHandleVariant(output);
|
||||
return vtkm::cont::VariantArrayHandle(output);
|
||||
}
|
||||
default:
|
||||
{
|
||||
std::cerr << "Only 1, 2, or 3 components supported. Skipping." << std::endl;
|
||||
return vtkm::cont::ArrayHandleVariant(vtkm::cont::ArrayHandle<vtkm::Float32>());
|
||||
return vtkm::cont::VariantArrayHandle(vtkm::cont::ArrayHandle<vtkm::Float32>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -335,7 +335,7 @@ protected:
|
||||
std::size_t numPoints;
|
||||
this->DataFile->Stream >> numPoints >> dataType >> std::ws;
|
||||
|
||||
vtkm::cont::ArrayHandleVariant points;
|
||||
vtkm::cont::VariantArrayHandle points;
|
||||
this->DoReadArrayVariant(dataType, numPoints, 3, points);
|
||||
|
||||
this->DataSet.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", points));
|
||||
@ -418,7 +418,7 @@ protected:
|
||||
{
|
||||
std::string name;
|
||||
vtkm::cont::ArrayHandle<vtkm::Float32> empty;
|
||||
vtkm::cont::ArrayHandleVariant data(empty);
|
||||
vtkm::cont::VariantArrayHandle data(empty);
|
||||
|
||||
this->DataFile->Stream >> tag;
|
||||
if (tag == "SCALARS")
|
||||
@ -546,7 +546,7 @@ private:
|
||||
|
||||
void ReadScalars(std::size_t numElements,
|
||||
std::string& dataName,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
{
|
||||
std::string dataType, lookupTableName;
|
||||
vtkm::IdComponent numComponents = 1;
|
||||
@ -592,7 +592,7 @@ private:
|
||||
|
||||
void ReadTextureCoordinates(std::size_t numElements,
|
||||
std::string& dataName,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
{
|
||||
vtkm::IdComponent numComponents;
|
||||
std::string dataType;
|
||||
@ -603,7 +603,7 @@ private:
|
||||
|
||||
void ReadVectors(std::size_t numElements,
|
||||
std::string& dataName,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
{
|
||||
std::string dataType;
|
||||
this->DataFile->Stream >> dataName >> dataType >> std::ws;
|
||||
@ -613,7 +613,7 @@ private:
|
||||
|
||||
void ReadTensors(std::size_t numElements,
|
||||
std::string& dataName,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
{
|
||||
std::string dataType;
|
||||
this->DataFile->Stream >> dataName >> dataType >> std::ws;
|
||||
@ -682,7 +682,7 @@ private:
|
||||
public:
|
||||
ReadArrayVariant(VTKDataSetReaderBase* reader,
|
||||
std::size_t numElements,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
: SkipArrayVariant(reader, numElements)
|
||||
, Data(&data)
|
||||
{
|
||||
@ -693,7 +693,7 @@ private:
|
||||
{
|
||||
std::vector<T> buffer(this->NumElements);
|
||||
this->Reader->ReadArray(buffer);
|
||||
*this->Data = internal::CreateArrayHandleVariant(buffer);
|
||||
*this->Data = internal::CreateVariantArrayHandle(buffer);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -705,7 +705,7 @@ private:
|
||||
}
|
||||
|
||||
private:
|
||||
vtkm::cont::ArrayHandleVariant* Data;
|
||||
vtkm::cont::VariantArrayHandle* Data;
|
||||
};
|
||||
|
||||
//Make the Array parsing methods protected so that derived classes
|
||||
@ -737,7 +737,7 @@ protected:
|
||||
void DoReadArrayVariant(std::string dataType,
|
||||
std::size_t numElements,
|
||||
vtkm::IdComponent numComponents,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
{
|
||||
vtkm::io::internal::DataType typeId = vtkm::io::internal::DataTypeId(dataType);
|
||||
vtkm::io::internal::SelectTypeAndCall(
|
||||
@ -846,7 +846,7 @@ private:
|
||||
{
|
||||
public:
|
||||
PermuteCellData(const vtkm::cont::ArrayHandle<vtkm::Id>& permutation,
|
||||
vtkm::cont::ArrayHandleVariant& data)
|
||||
vtkm::cont::VariantArrayHandle& data)
|
||||
: Permutation(permutation)
|
||||
, Data(&data)
|
||||
{
|
||||
@ -867,12 +867,12 @@ private:
|
||||
{
|
||||
outPortal.Set(i, inPortal.Get(permutationPortal.Get(i)));
|
||||
}
|
||||
*this->Data = vtkm::cont::ArrayHandleVariant(out);
|
||||
*this->Data = vtkm::cont::VariantArrayHandle(out);
|
||||
}
|
||||
|
||||
private:
|
||||
const vtkm::cont::ArrayHandle<vtkm::Id> Permutation;
|
||||
vtkm::cont::ArrayHandleVariant* Data;
|
||||
vtkm::cont::VariantArrayHandle* Data;
|
||||
};
|
||||
|
||||
protected:
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
//Read the points.
|
||||
std::string dataType;
|
||||
std::size_t numPoints[3];
|
||||
vtkm::cont::ArrayHandleVariant X, Y, Z;
|
||||
vtkm::cont::VariantArrayHandle X, Y, Z;
|
||||
|
||||
// Always read coordinates as vtkm::FloatDefault
|
||||
std::string readDataType = vtkm::io::internal::DataTypeName<vtkm::FloatDefault>::Name();
|
||||
|
@ -27,9 +27,9 @@
|
||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||
#include <vtkm/cont/ArrayHandleCompositeVector.h>
|
||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/DeviceAdapterListTag.h>
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
@ -32,13 +32,13 @@
|
||||
#include <vtkm/cont/Algorithm.h>
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/ArrayHandleView.h>
|
||||
#include <vtkm/cont/CellSetExplicit.h>
|
||||
#include <vtkm/cont/CoordinateSystem.h>
|
||||
#include <vtkm/cont/DynamicCellSet.h>
|
||||
#include <vtkm/cont/ImplicitFunctionHandle.h>
|
||||
#include <vtkm/cont/Timer.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
#include <utility>
|
||||
#include <vtkm/exec/FunctorBase.h>
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
const InputDomainType& inputDomain = invocation.GetInputDomain();
|
||||
|
||||
// For a DispatcherMapField, the inputDomain must be an ArrayHandle (or
|
||||
// an ArrayHandleVariant that gets cast to one). The size of the domain
|
||||
// an VariantArrayHandle that gets cast to one). The size of the domain
|
||||
// (number of threads/worklet instances) is equal to the size of the
|
||||
// array.
|
||||
auto numInstances = internal::scheduling_range(inputDomain);
|
||||
|
@ -244,7 +244,7 @@ public:
|
||||
const InputDomainType& inputDomain = invocation.GetInputDomain();
|
||||
|
||||
// For a DispatcherStreamingMapField, the inputDomain must be an ArrayHandle (or
|
||||
// an ArrayHandleVariant that gets cast to one). The size of the domain
|
||||
// an VariantArrayHandle that gets cast to one). The size of the domain
|
||||
// (number of threads/worklet instances) is equal to the size of the
|
||||
// array.
|
||||
vtkm::Id fullSize = internal::scheduling_range(inputDomain);
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <vtkm/CellTraits.h>
|
||||
#include <vtkm/TypeTraits.h>
|
||||
#include <vtkm/VectorAnalysis.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
@ -145,7 +145,7 @@ public:
|
||||
|
||||
template <typename CellSetType, typename NormalCompType>
|
||||
void Run(const CellSetType& cellset,
|
||||
const vtkm::cont::ArrayHandleVariantBase<vtkm::TypeListTagFieldVec3>& points,
|
||||
const vtkm::cont::VariantArrayHandleBase<vtkm::TypeListTagFieldVec3>& points,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<NormalCompType, 3>>& normals)
|
||||
{
|
||||
if (this->Normalize)
|
||||
@ -208,7 +208,7 @@ public:
|
||||
|
||||
template <typename CellSetType, typename FaceNormalTypeList, typename NormalCompType>
|
||||
void Run(const CellSetType& cellset,
|
||||
const vtkm::cont::ArrayHandleVariantBase<FaceNormalTypeList>& faceNormals,
|
||||
const vtkm::cont::VariantArrayHandleBase<FaceNormalTypeList>& faceNormals,
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<NormalCompType, 3>>& pointNormals)
|
||||
{
|
||||
vtkm::worklet::DispatcherMapTopology<Worklet>().Invoke(cellset, faceNormals, pointNormals);
|
||||
|
@ -83,7 +83,7 @@ struct SelectRepresentativePoint : public vtkm::worklet::WorkletReduceByKey
|
||||
template <typename InputPointsArrayType, typename KeyType>
|
||||
VTKM_CONT void operator()(const InputPointsArrayType& points,
|
||||
const vtkm::worklet::Keys<KeyType>& keys,
|
||||
vtkm::cont::ArrayHandleVariant& output) const
|
||||
vtkm::cont::VariantArrayHandle& output) const
|
||||
{
|
||||
|
||||
vtkm::cont::ArrayHandle<typename InputPointsArrayType::ValueType> out;
|
||||
@ -95,11 +95,11 @@ struct SelectRepresentativePoint : public vtkm::worklet::WorkletReduceByKey
|
||||
};
|
||||
|
||||
template <typename KeyType, typename InputDynamicPointsArrayType>
|
||||
VTKM_CONT static vtkm::cont::ArrayHandleVariant Run(
|
||||
VTKM_CONT static vtkm::cont::VariantArrayHandle Run(
|
||||
const vtkm::worklet::Keys<KeyType>& keys,
|
||||
const InputDynamicPointsArrayType& inputPoints)
|
||||
{
|
||||
vtkm::cont::ArrayHandleVariant output;
|
||||
vtkm::cont::VariantArrayHandle output;
|
||||
RunTrampoline trampoline;
|
||||
vtkm::cont::CastAndCall(inputPoints, trampoline, keys, output);
|
||||
return output;
|
||||
@ -379,7 +379,7 @@ public:
|
||||
#endif
|
||||
|
||||
/// pass 2 : Choose a representative point from each cluster for the output:
|
||||
vtkm::cont::ArrayHandleVariant repPointArray;
|
||||
vtkm::cont::VariantArrayHandle repPointArray;
|
||||
{
|
||||
vtkm::worklet::Keys<vtkm::Id> keys;
|
||||
keys.BuildArrays(pointCidArray, vtkm::worklet::Keys<vtkm::Id>::SortType::Stable);
|
||||
|
@ -144,7 +144,7 @@ public:
|
||||
|
||||
template <typename T, typename OutputPortalType>
|
||||
void Run(const vtkm::cont::CellSetStructured<2>& input,
|
||||
const vtkm::cont::ArrayHandleVariantBase<T>& pixels,
|
||||
const vtkm::cont::VariantArrayHandleBase<T>& pixels,
|
||||
OutputPortalType& componentsOut) const
|
||||
{
|
||||
using Types = vtkm::ListTagBase<vtkm::UInt8>;
|
||||
|
@ -269,7 +269,7 @@ inline vtkm::cont::DataSet MakeRadiantDataSet::Make3DRadiantDataSet(vtkm::IdComp
|
||||
"distanceToOrigin", vtkm::cont::Field::Association::POINTS, distanceToOrigin));
|
||||
dataSet.AddField(vtkm::cont::Field("distanceToOther",
|
||||
vtkm::cont::Field::Association::POINTS,
|
||||
vtkm::cont::ArrayHandleVariant(distanceToOther)));
|
||||
vtkm::cont::VariantArrayHandle(distanceToOther)));
|
||||
|
||||
CellSet cellSet("cells");
|
||||
cellSet.Fill((dim + 1) * (dim + 1) * (dim + 1), HexTag::Id, HexTraits::NUM_POINTS, connectivity);
|
||||
|
@ -20,7 +20,7 @@
|
||||
#include <vtkm/cont/ArrayCopy.h>
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterTag.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
@ -158,12 +158,12 @@ struct DoVariantTestWorklet
|
||||
std::cout << "Create and run dispatcher with variant arrays." << std::endl;
|
||||
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
|
||||
|
||||
vtkm::cont::ArrayHandleVariant inputVariant(inputHandle);
|
||||
vtkm::cont::VariantArrayHandle inputVariant(inputHandle);
|
||||
|
||||
{ //Verify we can pass by value
|
||||
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
|
||||
vtkm::cont::ArrayHandleVariant outputVariant(outputHandle);
|
||||
vtkm::cont::ArrayHandleVariant inoutVariant(inoutHandle);
|
||||
vtkm::cont::VariantArrayHandle outputVariant(outputHandle);
|
||||
vtkm::cont::VariantArrayHandle inoutVariant(inoutHandle);
|
||||
dispatcher.Invoke(inputVariant, outputVariant, inoutVariant);
|
||||
CheckPortal(outputHandle.GetPortalConstControl());
|
||||
CheckPortal(inoutHandle.GetPortalConstControl());
|
||||
@ -171,8 +171,8 @@ struct DoVariantTestWorklet
|
||||
|
||||
{ //Verify we can pass by pointer
|
||||
vtkm::cont::ArrayCopy(inputHandle, inoutHandle);
|
||||
vtkm::cont::ArrayHandleVariant outputVariant(outputHandle);
|
||||
vtkm::cont::ArrayHandleVariant inoutVariant(inoutHandle);
|
||||
vtkm::cont::VariantArrayHandle outputVariant(outputHandle);
|
||||
vtkm::cont::VariantArrayHandle inoutVariant(inoutHandle);
|
||||
dispatcher.Invoke(&inputVariant, &outputVariant, &inoutVariant);
|
||||
CheckPortal(outputHandle.GetPortalConstControl());
|
||||
CheckPortal(inoutHandle.GetPortalConstControl());
|
||||
|
@ -19,7 +19,7 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterTag.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
@ -94,7 +94,7 @@ struct DoTestWorklet
|
||||
outputHandle = vtkm::cont::ArrayHandle<T>();
|
||||
outputHandle.Allocate(ARRAY_SIZE);
|
||||
|
||||
vtkm::cont::ArrayHandleVariant outputFieldDynamic(outputFieldArray);
|
||||
vtkm::cont::VariantArrayHandle outputFieldDynamic(outputFieldArray);
|
||||
dispatcher.Invoke(counting, inputHandle, outputHandle, outputFieldDynamic);
|
||||
|
||||
std::cout << "Check dynamic array result." << std::endl;
|
||||
|
@ -19,7 +19,7 @@
|
||||
//============================================================================
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleIndex.h>
|
||||
#include <vtkm/cont/ArrayHandleVariant.h>
|
||||
#include <vtkm/cont/VariantArrayHandle.h>
|
||||
#include <vtkm/cont/internal/DeviceAdapterTag.h>
|
||||
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
@ -83,9 +83,9 @@ struct DoTestWholeArrayWorklet
|
||||
|
||||
// This just demonstrates that the WholeArray tags support dynamic arrays.
|
||||
VTKM_CONT
|
||||
void CallWorklet(const vtkm::cont::ArrayHandleVariant& inArray,
|
||||
const vtkm::cont::ArrayHandleVariant& inOutArray,
|
||||
const vtkm::cont::ArrayHandleVariant& outArray) const
|
||||
void CallWorklet(const vtkm::cont::VariantArrayHandle& inArray,
|
||||
const vtkm::cont::VariantArrayHandle& inOutArray,
|
||||
const vtkm::cont::VariantArrayHandle& outArray) const
|
||||
{
|
||||
std::cout << "Create and run dispatcher." << std::endl;
|
||||
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
|
||||
@ -111,9 +111,9 @@ struct DoTestWholeArrayWorklet
|
||||
// Output arrays must be preallocated.
|
||||
outHandle.Allocate(ARRAY_SIZE);
|
||||
|
||||
this->CallWorklet(vtkm::cont::ArrayHandleVariant(inHandle),
|
||||
vtkm::cont::ArrayHandleVariant(inOutHandle),
|
||||
vtkm::cont::ArrayHandleVariant(outHandle));
|
||||
this->CallWorklet(vtkm::cont::VariantArrayHandle(inHandle),
|
||||
vtkm::cont::VariantArrayHandle(inOutHandle),
|
||||
vtkm::cont::VariantArrayHandle(outHandle));
|
||||
|
||||
std::cout << "Check result." << std::endl;
|
||||
CheckPortal(inOutHandle.GetPortalConstControl());
|
||||
@ -127,7 +127,7 @@ struct DoTestAtomicArrayWorklet
|
||||
|
||||
// This just demonstrates that the WholeArray tags support dynamic arrays.
|
||||
VTKM_CONT
|
||||
void CallWorklet(const vtkm::cont::ArrayHandleVariant& inOutArray) const
|
||||
void CallWorklet(const vtkm::cont::VariantArrayHandle& inOutArray) const
|
||||
{
|
||||
std::cout << "Create and run dispatcher." << std::endl;
|
||||
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
|
||||
@ -142,7 +142,7 @@ struct DoTestAtomicArrayWorklet
|
||||
|
||||
vtkm::cont::ArrayHandle<T> inOutHandle = vtkm::cont::make_ArrayHandle(&inOutValue, 1);
|
||||
|
||||
this->CallWorklet(vtkm::cont::ArrayHandleVariant(inOutHandle));
|
||||
this->CallWorklet(vtkm::cont::VariantArrayHandle(inOutHandle));
|
||||
|
||||
std::cout << "Check result." << std::endl;
|
||||
T result = inOutHandle.GetPortalConstControl().Get(0);
|
||||
|
Loading…
Reference in New Issue
Block a user