Use WholeArrayIn instead of ExecObject for MarchingCubes worklets

The two worklets for marching cubes use tables stored in arrays that
have random access. Previously, they arrays were passed using the
ExecObject tag in ControlSignature along with ExecutionWholeArrayConst.
This changes to using a WholeArrayIn tag and just passing the
ArrayHandle directly to the Invoke method. The end result is the same,
but the code is a bit cleaner.
This commit is contained in:
Kenneth Moreland 2015-12-03 16:52:44 -07:00
parent 2ac8456b5e
commit 6f03f72b49
3 changed files with 18 additions and 11 deletions

@ -41,6 +41,10 @@ struct TypeListTagId2 : vtkm::ListTagBase<vtkm::Id2> { };
///
struct TypeListTagId3 : vtkm::ListTagBase<vtkm::Id3> { };
/// A list containing the type vtkm::IdComponent
///
struct TypeListTagIdComponent : vtkm::ListTagBase<vtkm::IdComponent> { };
/// A list containing types used to index arrays. Contains vtkm::Id, vtkm::Id2,
/// and vtkm::Id3.
///

@ -24,7 +24,6 @@
#include <vtkm/VectorAnalysis.h>
#include <vtkm/exec/CellDerivative.h>
#include <vtkm/exec/ExecutionWholeArray.h>
#include <vtkm/exec/ParametricCoordinates.h>
#include <vtkm/cont/ArrayHandle.h>
@ -57,10 +56,11 @@ public:
class ClassifyCell : public vtkm::worklet::WorkletMapPointToCell
{
public:
typedef void ControlSignature(FieldInPoint<Scalar> inNodes,
TopologyIn topology,
FieldOutCell<> outNumTriangles,
ExecObject numTrianglesTable);
typedef void ControlSignature(
FieldInPoint<Scalar> inNodes,
TopologyIn topology,
FieldOutCell<> outNumTriangles,
WholeArrayIn<IdComponentType> numTrianglesTable);
typedef void ExecutionSignature(_1, _3, _4);
typedef _2 InputDomain;
@ -108,7 +108,7 @@ public:
FieldOutCell<> interpolationIds,
FieldOutCell<> vertexOut, // Vertices for output triangles
FieldOutCell<> normalsOut, // Estimated normals (one per tri vertex)
ExecObject TriTable // An array portal with the triangle table
WholeArrayIn<IdComponentType> TriTable // An array portal with the triangle table
);
typedef void ExecutionSignature(
CellShape, _2, _3, _4, _5, _6, _7, _8, VisitIndex, FromIndices);
@ -249,9 +249,6 @@ public:
vtkm::cont::make_ArrayHandle(vtkm::worklet::internal::triTable,
256*16);
typedef vtkm::exec::ExecutionWholeArrayConst<vtkm::IdComponent, VTKM_DEFAULT_STORAGE_TAG, DeviceAdapter>
TableArrayExecObjectType;
vtkm::cont::ArrayHandle<vtkm::IdComponent> numOutputTrisPerCell;
// Call the ClassifyCell functor to compute the Marching Cubes case numbers
@ -266,7 +263,7 @@ public:
classifyCellDispatcher.Invoke(field,
cellSet,
numOutputTrisPerCell,
TableArrayExecObjectType(numTrianglesTable));
numTrianglesTable);
IsosurfaceGenerate isosurface(isovalue,
numOutputTrisPerCell,
@ -283,7 +280,7 @@ public:
vtkm::cont::make_ArrayHandleGroupVec<3>(this->InterpolationIds),
vtkm::cont::make_ArrayHandleGroupVec<3>(vertices),
vtkm::cont::make_ArrayHandleGroupVec<3>(normals),
TableArrayExecObjectType(triangleTableArray));
triangleTableArray);
}
template<typename ArrayHandleIn, typename ArrayHandleOut>

@ -117,6 +117,12 @@ public:
/// ControlSignature tags to specify the types of worklet arguments.
typedef vtkm::TypeListTagId3 Id3Type;
/// \brief A type list containing the type vtkm::IdComponent.
///
/// This is a convenience type to use as template arguments to \c
/// ControlSignature tags to specify the types of worklet arguments.
typedef vtkm::TypeListTagIdComponent IdComponentType;
/// \brief A list of types commonly used for indexing.
///
/// This is a convenience type to use as template arguments to \c