Commit b4e08975 authored by Robert Maynard's avatar Robert Maynard

Convert vtkmAccelerators over to use vtk-m ArrayHandleVirtual.

This primarily means a reduction in the complexity of the
filter policies, and more array conversion logic to handle
when the storage type is 'virtual'
parent 4f1506d9
......@@ -67,122 +67,6 @@ struct FieldTypeOutVTK
{
};
//------------------------------------------------------------------------------
struct ArrayListInVTK : vtkm::ListTagBase<
#if defined(VTKM_FILTER_INCLUDE_AOS)
tovtkm::vtkAOSArrayContainerTag
#endif
#if defined(VTKM_FILTER_INCLUDE_SOA)
,tovtkm::vtkSOAArrayContainerTag
#endif
>
{
};
// Currently vtk-m doesn't offer an easy way to auto generate all these
// permutation
// tag types that are needed to handle the output of the Threshold algorithm
struct TypeListTagPermutationVecCommon
: vtkm::ListTagBase<
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::UInt8, 2>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Int32, 2>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Int64, 2>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Float32, 2>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Float64, 2>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::UInt8, 3>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Int32, 3>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Int64, 3>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Float32, 3>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Float64, 3>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::UInt8, 4>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Int32, 4>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Int64, 4>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Float32, 4>>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Vec<vtkm::Float64, 4>>>
{
};
struct TypeListTagPermutationScalarAll
: vtkm::ListTagBase<vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Int8>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::UInt8>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Int16>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::UInt16>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Int32>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::UInt32>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Int64>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::UInt64>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Float32>,
vtkm::cont::internal::StorageTagPermutation<
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::Float64>>
{
};
struct TypeListTagPermutationVTK
: vtkm::ListTagJoin<tovtkm::TypeListTagPermutationVecCommon,
tovtkm::TypeListTagPermutationScalarAll>
{
};
struct TypeListTagVTMOut : vtkm::ListTagBase<vtkm::cont::StorageTagBasic
#if defined(VTKM_FILTER_INCLUDE_AOS)
,tovtkm::vtkAOSArrayContainerTag
#endif
#if defined(VTKM_FILTER_INCLUDE_SOA)
,tovtkm::vtkSOAArrayContainerTag
#endif
>
{
};
struct ArrayListOutVTK
: vtkm::ListTagJoin<TypeListTagVTMOut, TypeListTagPermutationVTK>
{
};
//------------------------------------------------------------------------------
struct PointListInVTK
: vtkm::ListTagBase<
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
tovtkm::vtkAOSArrayContainerTag
#if defined(VTKM_FILTER_INCLUDE_SOA)
,
tovtkm::vtkSOAArrayContainerTag
#endif
>
{
};
struct PointListOutVTK
: vtkm::ListTagBase<
vtkm::cont::ArrayHandleUniformPointCoordinates::StorageTag,
vtkm::cont::StorageTagBasic,
tovtkm::vtkAOSArrayContainerTag>
{
};
//------------------------------------------------------------------------------
struct CellListStructuredInVTK
: vtkm::ListTagBase<vtkm::cont::CellSetStructured<3>, vtkm::cont::CellSetStructured<2>>
......@@ -226,15 +110,12 @@ class vtkmInputFilterPolicy
: public vtkm::filter::PolicyBase<vtkmInputFilterPolicy>
{
public:
typedef tovtkm::FieldTypeInVTK FieldTypeList;
typedef tovtkm::ArrayListInVTK FieldStorageList;
using FieldTypeList = tovtkm::FieldTypeInVTK;
typedef tovtkm::CellListStructuredInVTK StructuredCellSetList;
typedef tovtkm::CellListUnstructuredInVTK UnstructuredCellSetList;
typedef tovtkm::CellListAllInVTK AllCellSetList;
using StructuredCellSetList = tovtkm::CellListStructuredInVTK;
using UnstructuredCellSetList = tovtkm::CellListUnstructuredInVTK;
using AllCellSetList = tovtkm::CellListAllInVTK;
typedef vtkm::TypeListTagFieldVec3 CoordinateTypeList;
typedef tovtkm::PointListInVTK CoordinateStorageList;
};
//------------------------------------------------------------------------------
......@@ -242,15 +123,12 @@ class vtkmOutputFilterPolicy
: public vtkm::filter::PolicyBase<vtkmOutputFilterPolicy>
{
public:
typedef tovtkm::FieldTypeOutVTK FieldTypeList;
typedef tovtkm::ArrayListOutVTK FieldStorageList;
using FieldTypeList = tovtkm::FieldTypeOutVTK;
typedef tovtkm::CellListStructuredOutVTK StructuredCellSetList;
typedef tovtkm::CellListUnstructuredOutVTK UnstructuredCellSetList;
typedef tovtkm::CellListAllOutVTK AllCellSetList;
using StructuredCellSetList = tovtkm::CellListStructuredOutVTK;
using UnstructuredCellSetList = tovtkm::CellListUnstructuredOutVTK;
using AllCellSetList = tovtkm::CellListAllOutVTK;
typedef vtkm::TypeListTagFieldVec3 CoordinateTypeList;
typedef tovtkm::PointListOutVTK CoordinateStorageList;
};
#endif
......
......@@ -56,15 +56,11 @@ class vtkmGradientFilterPolicy
: public vtkm::filter::PolicyBase<vtkmGradientFilterPolicy>
{
public:
typedef GradientTypes FieldTypeList;
typedef tovtkm::TypeListTagVTMOut FieldStorageList;
using FieldTypeList = GradientTypes;
typedef tovtkm::CellListStructuredInVTK StructuredCellSetList;
typedef tovtkm::CellListUnstructuredInVTK UnstructuredCellSetList;
typedef tovtkm::CellListAllInVTK AllCellSetList;
typedef vtkm::TypeListTagFieldVec3 CoordinateTypeList;
typedef tovtkm::PointListInVTK CoordinateStorageList;
using StructuredCellSetList = tovtkm::CellListStructuredInVTK;
using UnstructuredCellSetList = tovtkm::CellListUnstructuredInVTK;
using AllCellSetList = tovtkm::CellListAllInVTK;
};
vtkm::cont::DataSet CopyDataSetStructure(const vtkm::cont::DataSet& ds)
......
......@@ -38,41 +38,6 @@
vtkStandardNewMacro(vtkmWarpScalar)
namespace {
// This class is pretty similar to vtkmInputFilterPolicy except that it adds
// the support for ArrayHandle and ArrayHandleConstant
class vtkmWarpScalarFilterPolicy : public
vtkm::filter::PolicyBase<vtkmWarpScalarFilterPolicy>
{
public:
using FieldTypeList = tovtkm::FieldTypeInVTK;
using vecType = vtkm::Vec<vtkm::FloatDefault, 3>;
struct TypeListVTKMWarpScalarTags : vtkm::ListTagBase<
vtkm::cont::ArrayHandle<vtkm::FloatDefault>::StorageTag,
vtkm::cont::ArrayHandleConstant<vecType>::StorageTag,
vtkm::cont::ArrayHandleConstant<vtkm::FloatDefault>::StorageTag,
#if defined(VTKM_FILTER_INCLUDE_AOS)
tovtkm::vtkAOSArrayContainerTag
#endif
#if defined(VTKM_FILTER_INCLUDE_SOA)
,tovtkm::vtkSOAArrayContainerTag
#endif
>
{
};
using FieldStorageList = TypeListVTKMWarpScalarTags;
using StructuredCellSetList = tovtkm::CellListStructuredInVTK;
using UnstructuredCellSetList = tovtkm::CellListUnstructuredInVTK;
using AllCellSetList = tovtkm::CellListAllInVTK;
using CoordinateTypeList = vtkm::TypeListTagFieldVec3;
using CoordinateStorageList = tovtkm::PointListInVTK;
};
}
//------------------------------------------------------------------------------
vtkmWarpScalar::vtkmWarpScalar() : vtkWarpScalar()
{
......@@ -198,7 +163,7 @@ int vtkmWarpScalar::RequestData(vtkInformation* vtkNotUsed(request),
warpScalar.SetScalarFactorField(std::string(inScalars->GetName()));
}
vtkmWarpScalarFilterPolicy policy;
vtkmInputFilterPolicy policy;
auto result = warpScalar.Execute(in, policy);
vtkDataArray* warpScalarResult = fromvtkm::Convert(result.GetField("warpscalar",
vtkm::cont::Field::Association::POINTS));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment