mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Replace ExecutionWholeArray with WholeArray
This commit is contained in:
parent
de7162ab8f
commit
3e10b504e6
@ -29,14 +29,16 @@ namespace vtkm
|
||||
namespace exec
|
||||
{
|
||||
|
||||
/// The following classes have been deprecated and are meant to be used
|
||||
/// internally only. Please use the \c WholeArrayIn, \c WholeArrayOut, and
|
||||
/// \c WholeArrayInOut \c ControlSignature tags instead.
|
||||
|
||||
/// \c ExecutionWholeArray is an execution object that allows an array handle
|
||||
/// content to be a parameter in an execution environment
|
||||
/// function. This can be used to allow worklets to have a shared search
|
||||
/// structure
|
||||
/// structure.
|
||||
///
|
||||
template <typename T,
|
||||
typename StorageTag = VTKM_DEFAULT_STORAGE_TAG,
|
||||
typename DeviceAdapterTag = VTKM_DEFAULT_DEVICE_ADAPTER_TAG>
|
||||
template <typename T, typename StorageTag, typename DeviceAdapterTag>
|
||||
class ExecutionWholeArray : public vtkm::exec::ExecutionObjectBase
|
||||
{
|
||||
public:
|
||||
@ -86,9 +88,7 @@ private:
|
||||
/// function. This can be used to allow worklets to have a shared search
|
||||
/// structure
|
||||
///
|
||||
template <typename T,
|
||||
typename StorageTag = VTKM_DEFAULT_STORAGE_TAG,
|
||||
typename DeviceAdapterTag = VTKM_DEFAULT_DEVICE_ADAPTER_TAG>
|
||||
template <typename T, typename StorageTag, typename DeviceAdapterTag>
|
||||
class ExecutionWholeArrayConst : public vtkm::exec::ExecutionObjectBase
|
||||
{
|
||||
public:
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <vtkm/rendering/CanvasRayTracer.h>
|
||||
|
||||
#include <vtkm/cont/TryExecute.h>
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
#include <vtkm/rendering/Canvas.h>
|
||||
#include <vtkm/rendering/Color.h>
|
||||
#include <vtkm/rendering/raytracing/Ray.h>
|
||||
@ -51,19 +50,21 @@ public:
|
||||
FieldIn<>,
|
||||
FieldIn<>,
|
||||
FieldIn<>,
|
||||
ExecObject,
|
||||
ExecObject);
|
||||
WholeArrayOut<vtkm::ListTagBase<vtkm::Float32>>,
|
||||
WholeArrayOut<vtkm::ListTagBase<vtkm::Vec<vtkm::Float32, 4>>>);
|
||||
typedef void ExecutionSignature(_1, _2, _3, _4, _5, _6, _7, WorkIndex);
|
||||
template <typename Precision, typename ColorPortalType>
|
||||
VTKM_EXEC void operator()(
|
||||
const vtkm::Id& pixelIndex,
|
||||
ColorPortalType& colorBufferIn,
|
||||
const Precision& inDepth,
|
||||
const vtkm::Vec<Precision, 3>& origin,
|
||||
const vtkm::Vec<Precision, 3>& dir,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>& depthBuffer,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<vtkm::Float32, 4>>& colorBuffer,
|
||||
const vtkm::Id& index) const
|
||||
template <typename Precision,
|
||||
typename ColorPortalType,
|
||||
typename DepthBufferPortalType,
|
||||
typename ColorBufferPortalType>
|
||||
VTKM_EXEC void operator()(const vtkm::Id& pixelIndex,
|
||||
ColorPortalType& colorBufferIn,
|
||||
const Precision& inDepth,
|
||||
const vtkm::Vec<Precision, 3>& origin,
|
||||
const vtkm::Vec<Precision, 3>& dir,
|
||||
DepthBufferPortalType& depthBuffer,
|
||||
ColorBufferPortalType& colorBuffer,
|
||||
const vtkm::Id& index) const
|
||||
{
|
||||
vtkm::Vec<Precision, 3> intersection = origin + inDepth * dir;
|
||||
vtkm::Vec<vtkm::Float32, 4> point;
|
||||
@ -140,14 +141,13 @@ public:
|
||||
{
|
||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||
vtkm::worklet::DispatcherMapField<SurfaceConverter, Device>(SurfaceConverter(ViewProjMat))
|
||||
.Invoke(
|
||||
Rays.PixelIdx,
|
||||
Colors,
|
||||
Rays.Distance,
|
||||
Rays.Origin,
|
||||
Rays.Dir,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>(Canvas->GetDepthBuffer()),
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<vtkm::Float32, 4>>(Canvas->GetColorBuffer()));
|
||||
.Invoke(Rays.PixelIdx,
|
||||
Colors,
|
||||
Rays.Distance,
|
||||
Rays.Origin,
|
||||
Rays.Dir,
|
||||
Canvas->GetDepthBuffer(),
|
||||
Canvas->GetColorBuffer());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/CellSetPermutation.h>
|
||||
#include <vtkm/cont/DataSet.h>
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
#include <vtkm/rendering/raytracing/MeshConnectivityBuilder.h>
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/DispatcherMapTopology.h>
|
||||
@ -276,17 +275,21 @@ public:
|
||||
public:
|
||||
VTKM_CONT
|
||||
UniqueTriangles() {}
|
||||
typedef void ControlSignature(ExecObject, ExecObject);
|
||||
|
||||
typedef void ControlSignature(WholeArrayIn<vtkm::ListTagBase<vtkm::Vec<vtkm::Id, 4>>>,
|
||||
WholeArrayOut<vtkm::ListTagBase<vtkm::UInt8>>);
|
||||
typedef void ExecutionSignature(_1, _2, WorkIndex);
|
||||
|
||||
VTKM_EXEC
|
||||
bool IsTwin(const vtkm::Vec<vtkm::Id, 4>& a, const vtkm::Vec<vtkm::Id, 4>& b) const
|
||||
{
|
||||
return (a[1] == b[1] && a[2] == b[2] && a[3] == b[3]);
|
||||
}
|
||||
VTKM_EXEC
|
||||
void operator()(vtkm::exec::ExecutionWholeArrayConst<vtkm::Vec<vtkm::Id, 4>>& indices,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::UInt8>& outputFlags,
|
||||
const vtkm::Id& index) const
|
||||
|
||||
template <typename IndicesPortalType, typename OutputFlagsPortalType>
|
||||
VTKM_EXEC void operator()(const IndicesPortalType& indices,
|
||||
OutputFlagsPortalType& outputFlags,
|
||||
const vtkm::Id& index) const
|
||||
{
|
||||
if (index == 0)
|
||||
return;
|
||||
@ -612,9 +615,7 @@ public:
|
||||
flags.Allocate(outputTriangles);
|
||||
vtkm::worklet::DispatcherMapField<MemSet<vtkm::UInt8>>(MemSet<vtkm::UInt8>(1)).Invoke(flags);
|
||||
//Unique triangles will have a flag = 1
|
||||
vtkm::worklet::DispatcherMapField<UniqueTriangles>().Invoke(
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Vec<vtkm::Id, 4>>(outputIndices),
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::UInt8>(flags));
|
||||
vtkm::worklet::DispatcherMapField<UniqueTriangles>().Invoke(outputIndices, flags);
|
||||
|
||||
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> subset;
|
||||
vtkm::cont::DeviceAdapterAlgorithm<Device>::CopyIf(outputIndices, flags, subset);
|
||||
|
@ -157,7 +157,7 @@ class EdgePlotter : public vtkm::worklet::WorkletMapField
|
||||
public:
|
||||
using AtomicPackedFrameBufferHandle = vtkm::exec::AtomicArray<vtkm::Int64, DeviceTag>;
|
||||
|
||||
typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, WholeArrayIn<Scalar>);
|
||||
typedef void ControlSignature(FieldIn<Id2Type>, WholeArrayIn<Vec3>, WholeArrayIn<Scalar>);
|
||||
typedef void ExecutionSignature(_1, _2, _3);
|
||||
using InputDomain = _1;
|
||||
|
||||
@ -393,14 +393,16 @@ public:
|
||||
VTKM_CONT
|
||||
BufferConverter() {}
|
||||
|
||||
typedef void ControlSignature(FieldIn<>, ExecObject, ExecObject);
|
||||
typedef void ControlSignature(FieldIn<>,
|
||||
WholeArrayOut<vtkm::ListTagBase<vtkm::Float32>>,
|
||||
WholeArrayOut<vtkm::ListTagBase<vtkm::Vec<vtkm::Float32, 4>>>);
|
||||
typedef void ExecutionSignature(_1, _2, _3, WorkIndex);
|
||||
|
||||
VTKM_EXEC
|
||||
void operator()(const vtkm::Int64& packedValue,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>& depthBuffer,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<vtkm::Float32, 4>>& colorBuffer,
|
||||
const vtkm::Id& index) const
|
||||
template <typename DepthBufferPortalType, typename ColorBufferPortalType>
|
||||
VTKM_EXEC void operator()(const vtkm::Int64& packedValue,
|
||||
DepthBufferPortalType& depthBuffer,
|
||||
ColorBufferPortalType& colorBuffer,
|
||||
const vtkm::Id& index) const
|
||||
{
|
||||
PackedValue packed;
|
||||
packed.Raw = packedValue;
|
||||
@ -551,9 +553,7 @@ private:
|
||||
|
||||
BufferConverter converter;
|
||||
vtkm::worklet::DispatcherMapField<BufferConverter, DeviceTag>(converter).Invoke(
|
||||
FrameBuffer,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>(Canvas->GetDepthBuffer()),
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<vtkm::Float32, 4>>(Canvas->GetColorBuffer()));
|
||||
FrameBuffer, Canvas->GetDepthBuffer(), Canvas->GetColorBuffer());
|
||||
}
|
||||
|
||||
VTKM_CONT
|
||||
|
@ -316,22 +316,22 @@ public:
|
||||
{
|
||||
this->FlatBVH = flatBVH.PrepareForOutput((LeafCount - 1) * 4, Device());
|
||||
}
|
||||
typedef void ControlSignature(ExecObject,
|
||||
ExecObject,
|
||||
ExecObject,
|
||||
ExecObject,
|
||||
ExecObject,
|
||||
ExecObject);
|
||||
typedef void ControlSignature(WholeArrayIn<Scalar>,
|
||||
WholeArrayIn<Scalar>,
|
||||
WholeArrayIn<Scalar>,
|
||||
WholeArrayIn<Scalar>,
|
||||
WholeArrayIn<Scalar>,
|
||||
WholeArrayIn<Scalar>);
|
||||
typedef void ExecutionSignature(WorkIndex, _1, _2, _3, _4, _5, _6);
|
||||
template <typename StrorageType>
|
||||
VTKM_EXEC_CONT void operator()(
|
||||
const vtkm::Id workIndex,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32, StrorageType>& xmin,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32, StrorageType>& ymin,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32, StrorageType>& zmin,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32, StrorageType>& xmax,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32, StrorageType>& ymax,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32, StrorageType>& zmax) const
|
||||
|
||||
template <typename InputPortalType>
|
||||
VTKM_EXEC_CONT void operator()(const vtkm::Id workIndex,
|
||||
const InputPortalType& xmin,
|
||||
const InputPortalType& ymin,
|
||||
const InputPortalType& zmin,
|
||||
const InputPortalType& xmax,
|
||||
const InputPortalType& ymax,
|
||||
const InputPortalType& zmax) const
|
||||
{
|
||||
//move up into the inner nodes
|
||||
vtkm::Id currentNode = LeafCount - 1 + workIndex;
|
||||
@ -780,12 +780,7 @@ VTKM_CONT void LinearBVHBuilder::RunOnDevice(LinearBVH& linearBVH, Device device
|
||||
vtkm::worklet::DispatcherMapField<PropagateAABBs<Device>, Device>(
|
||||
PropagateAABBs<Device>(
|
||||
bvh.parent, bvh.leftChild, bvh.rightChild, primitiveCount, linearBVH.FlatBVH, atomicCounters))
|
||||
.Invoke(vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.xmins),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.ymins),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.zmins),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.xmaxs),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.ymaxs),
|
||||
vtkm::exec::ExecutionWholeArrayConst<vtkm::Float32>(*bvh.zmaxs));
|
||||
.Invoke(*bvh.xmins, *bvh.ymins, *bvh.zmins, *bvh.xmaxs, *bvh.ymaxs, *bvh.zmaxs);
|
||||
|
||||
time = timer.GetElapsedTime();
|
||||
logger->AddLogData("propagate_aabbs", time);
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
VTKM_CONT
|
||||
MortonNeighbor() {}
|
||||
typedef void ControlSignature(WholeArrayIn<>,
|
||||
ExecObject,
|
||||
WholeArrayInOut<Id3Type>,
|
||||
WholeArrayIn<>,
|
||||
WholeArrayIn<>,
|
||||
WholeArrayIn<>,
|
||||
@ -146,18 +146,18 @@ public:
|
||||
|
||||
|
||||
template <typename MortonPortalType,
|
||||
typename FaceIdPairsPortalType,
|
||||
typename ConnPortalType,
|
||||
typename ShapePortalType,
|
||||
typename OffsetPortalType,
|
||||
typename ExternalFaceFlagType>
|
||||
VTKM_EXEC inline void operator()(
|
||||
const MortonPortalType& mortonCodes,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<vtkm::Id, 3>>& faceIdPairs,
|
||||
const vtkm::Id& index,
|
||||
const ConnPortalType& connectivity,
|
||||
const ShapePortalType& shapes,
|
||||
const OffsetPortalType& offsets,
|
||||
ExternalFaceFlagType& flags) const
|
||||
VTKM_EXEC inline void operator()(const MortonPortalType& mortonCodes,
|
||||
FaceIdPairsPortalType& faceIdPairs,
|
||||
const vtkm::Id& index,
|
||||
const ConnPortalType& connectivity,
|
||||
const ShapePortalType& shapes,
|
||||
const OffsetPortalType& offsets,
|
||||
ExternalFaceFlagType& flags) const
|
||||
{
|
||||
if (index == 0)
|
||||
{
|
||||
@ -330,14 +330,16 @@ public:
|
||||
class WriteFaceConn : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, WholeArrayOut<IdType>);
|
||||
typedef void ExecutionSignature(_1, _2, _3);
|
||||
|
||||
VTKM_CONT
|
||||
WriteFaceConn() {}
|
||||
typedef void ControlSignature(FieldIn<>, WholeArrayIn<>, ExecObject);
|
||||
typedef void ExecutionSignature(_1, _2, _3);
|
||||
template <typename FaceOffsetsPortalType>
|
||||
|
||||
template <typename FaceOffsetsPortalType, typename FaceConnectivityPortalType>
|
||||
VTKM_EXEC inline void operator()(const vtkm::Vec<vtkm::Id, 3>& faceIdPair,
|
||||
const FaceOffsetsPortalType& faceOffsets,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Id>& faceConn) const
|
||||
FaceConnectivityPortalType& faceConn) const
|
||||
{
|
||||
vtkm::Id cellId = faceIdPair[0];
|
||||
BOUNDS_CHECK(faceOffsets, cellId);
|
||||
@ -570,8 +572,7 @@ public:
|
||||
|
||||
// scatter the coonectivity into the original order
|
||||
vtkm::worklet::DispatcherMapField<WriteFaceConn>(WriteFaceConn())
|
||||
.Invoke(
|
||||
cellFaceId, this->FaceOffsets, vtkm::exec::ExecutionWholeArray<vtkm::Id>(faceConnectivity));
|
||||
.Invoke(cellFaceId, this->FaceOffsets, faceConnectivity);
|
||||
|
||||
|
||||
FaceConnectivity = faceConnectivity;
|
||||
@ -628,8 +629,7 @@ public:
|
||||
|
||||
// scatter the coonectivity into the original order
|
||||
vtkm::worklet::DispatcherMapField<WriteFaceConn>(WriteFaceConn())
|
||||
.Invoke(
|
||||
cellFaceId, this->FaceOffsets, vtkm::exec::ExecutionWholeArray<vtkm::Id>(faceConnectivity));
|
||||
.Invoke(cellFaceId, this->FaceOffsets, faceConnectivity);
|
||||
|
||||
FaceConnectivity = faceConnectivity;
|
||||
OutsideTriangles = externalTriangles;
|
||||
@ -754,12 +754,7 @@ protected:
|
||||
.Invoke(faceConnectivity);
|
||||
|
||||
vtkm::worklet::DispatcherMapField<MortonNeighbor, DeviceAdapter>(MortonNeighbor())
|
||||
.Invoke(faceMortonCodes,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<vtkm::Id, 3>>(cellFaceId),
|
||||
conn,
|
||||
shapes,
|
||||
shapeOffsets,
|
||||
faceConnectivity);
|
||||
.Invoke(faceMortonCodes, cellFaceId, conn, shapes, shapeOffsets, faceConnectivity);
|
||||
|
||||
vtkm::Float64 time = timer.GetElapsedTime();
|
||||
Logger::GetInstance()->AddLogData("gen_face_conn", time);
|
||||
|
@ -22,8 +22,6 @@
|
||||
|
||||
#include <vtkm/Math.h>
|
||||
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
|
||||
#include <vtkm/cont/ArrayHandle.h>
|
||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||
#include <vtkm/cont/ArrayHandlePermutation.h>
|
||||
@ -363,16 +361,16 @@ struct KernelSplatterFilterUniformGrid
|
||||
class UpdateVoxelSplats : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<>, FieldIn<>, ExecObject);
|
||||
typedef void ControlSignature(FieldIn<>, FieldIn<>, WholeArrayOut<Scalar>);
|
||||
typedef void ExecutionSignature(_1, _2, _3);
|
||||
|
||||
VTKM_CONT
|
||||
UpdateVoxelSplats() {}
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
void operator()(const vtkm::Id& voxelIndex,
|
||||
const vtkm::Float64& splatValue,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>& execArg) const
|
||||
template <typename ExecArgPortalType>
|
||||
VTKM_EXEC_CONT void operator()(const vtkm::Id& voxelIndex,
|
||||
const vtkm::Float64& splatValue,
|
||||
ExecArgPortalType& execArg) const
|
||||
{
|
||||
execArg.Set(voxelIndex, static_cast<vtkm::Float32>(splatValue));
|
||||
}
|
||||
@ -594,9 +592,7 @@ struct KernelSplatterFilterUniformGrid
|
||||
vtkm::worklet::DispatcherMapField<UpdateVoxelSplats> scatterDispatcher;
|
||||
|
||||
START_TIMER_BLOCK(UpdateVoxelSplats)
|
||||
scatterDispatcher.Invoke(uniqueVoxelIds,
|
||||
voxelSplatSums,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Float32>(scalarSplatOutput));
|
||||
scatterDispatcher.Invoke(uniqueVoxelIds, voxelSplatSums, scalarSplatOutput);
|
||||
END_TIMER_BLOCK(UpdateVoxelSplats)
|
||||
debug::OutputArrayDebug(scalarSplatOutput, "scalarSplatOutput");
|
||||
//
|
||||
|
@ -33,8 +33,6 @@
|
||||
#include <vtkm/worklet/ScatterUniform.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
|
||||
namespace vtkm
|
||||
{
|
||||
|
||||
@ -166,9 +164,9 @@ public:
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<IdType> seedId,
|
||||
FieldIn<> position,
|
||||
ExecObject numIndices,
|
||||
ExecObject validPoint,
|
||||
ExecObject streamLines);
|
||||
WholeArrayOut<IdComponentType> numIndices,
|
||||
WholeArrayOut<IdComponentType> validPoint,
|
||||
WholeArrayOut<Vec3> streamLines);
|
||||
typedef void ExecutionSignature(_1, _2, _3, _4, _5, VisitIndex);
|
||||
typedef _1 InputDomain;
|
||||
|
||||
@ -200,13 +198,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
VTKM_EXEC
|
||||
void operator()(vtkm::Id& seedId,
|
||||
vtkm::Vec<FieldType, 3>& seedPos,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::IdComponent>& numIndices,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::IdComponent>& validPoint,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<FieldType, 3>>& slLists,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
template <typename IdComponentPortalType, typename FieldVec3PortalType>
|
||||
VTKM_EXEC void operator()(vtkm::Id& seedId,
|
||||
vtkm::Vec<FieldType, 3>& seedPos,
|
||||
IdComponentPortalType& numIndices,
|
||||
IdComponentPortalType& validPoint,
|
||||
FieldVec3PortalType& slLists,
|
||||
vtkm::IdComponent visitIndex) const
|
||||
{
|
||||
// Set initial offset into the output streams array
|
||||
vtkm::Vec<FieldType, 3> pos = seedPos;
|
||||
@ -403,11 +401,7 @@ public:
|
||||
typedef typename vtkm::worklet::DispatcherMapField<MakeStreamLines> MakeStreamLinesDispatcher;
|
||||
MakeStreamLinesDispatcher makeStreamLinesDispatcher(makeStreamLines);
|
||||
makeStreamLinesDispatcher.Invoke(
|
||||
seedIdArray,
|
||||
seedPosArray,
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::IdComponent>(numIndices, numCells),
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::IdComponent>(validPoint, maxConnectivityLen),
|
||||
vtkm::exec::ExecutionWholeArray<vtkm::Vec<FieldType, 3>>(streamArray, maxConnectivityLen));
|
||||
seedIdArray, seedPosArray, numIndices, validPoint, streamArray);
|
||||
|
||||
// Size of connectivity based on size of returned streamlines
|
||||
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndicesOut;
|
||||
|
@ -24,35 +24,34 @@
|
||||
#include <vtkm/worklet/DispatcherMapField.h>
|
||||
#include <vtkm/worklet/WorkletMapField.h>
|
||||
|
||||
#include <vtkm/exec/ExecutionWholeArray.h>
|
||||
|
||||
#include <vtkm/cont/testing/Testing.h>
|
||||
|
||||
class TestExecObjectWorklet : public vtkm::worklet::WorkletMapField
|
||||
struct TestExecObjectWorklet
|
||||
{
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<>, ExecObject, ExecObject, FieldOut<>);
|
||||
typedef void ExecutionSignature(_1, _2, _3, _4);
|
||||
|
||||
template <typename T, typename StorageTag>
|
||||
VTKM_EXEC void operator()(const vtkm::Id& index,
|
||||
const vtkm::exec::ExecutionWholeArrayConst<T, StorageTag>& execIn,
|
||||
vtkm::exec::ExecutionWholeArray<T, StorageTag>& execOut,
|
||||
T& out) const
|
||||
template <typename T>
|
||||
class Worklet : public vtkm::worklet::WorkletMapField
|
||||
{
|
||||
if (!test_equal(execIn.Get(index), TestValue(index, T()) + T(100)))
|
||||
public:
|
||||
typedef void ControlSignature(FieldIn<IdType>,
|
||||
WholeArrayIn<vtkm::ListTagBase<T>>,
|
||||
WholeArrayOut<vtkm::ListTagBase<T>>,
|
||||
FieldOut<vtkm::ListTagBase<T>>);
|
||||
typedef void ExecutionSignature(_1, _2, _3, _4);
|
||||
|
||||
template <typename InPortalType, typename OutPortalType>
|
||||
VTKM_EXEC void operator()(const vtkm::Id& index,
|
||||
const InPortalType& execIn,
|
||||
OutPortalType& execOut,
|
||||
T& out) const
|
||||
{
|
||||
this->RaiseError("Got wrong input value.");
|
||||
if (!test_equal(execIn.Get(index), TestValue(index, T()) + T(100)))
|
||||
{
|
||||
this->RaiseError("Got wrong input value.");
|
||||
}
|
||||
out = execIn.Get(index) - T(100);
|
||||
execOut.Set(index, out);
|
||||
}
|
||||
out = execIn.Get(index) - T(100);
|
||||
execOut.Set(index, out);
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
VTKM_EXEC void operator()(const vtkm::Id&, const T1&, const T2&, const T3&) const
|
||||
{
|
||||
this->RaiseError("Cannot call this worklet with different types.");
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
namespace map_exec_field
|
||||
@ -78,13 +77,11 @@ struct DoTestWorklet
|
||||
vtkm::cont::ArrayHandle<T> inputHandle = vtkm::cont::make_ArrayHandle(inputArray, ARRAY_SIZE);
|
||||
vtkm::cont::ArrayHandle<T> outputHandle;
|
||||
vtkm::cont::ArrayHandle<T> outputFieldArray;
|
||||
outputHandle.Allocate(ARRAY_SIZE);
|
||||
|
||||
std::cout << "Create and run dispatcher." << std::endl;
|
||||
vtkm::worklet::DispatcherMapField<WorkletType> dispatcher;
|
||||
dispatcher.Invoke(counting,
|
||||
vtkm::exec::ExecutionWholeArrayConst<T>(inputHandle),
|
||||
vtkm::exec::ExecutionWholeArray<T>(outputHandle, ARRAY_SIZE),
|
||||
outputFieldArray);
|
||||
vtkm::worklet::DispatcherMapField<typename WorkletType::template Worklet<T>> dispatcher;
|
||||
dispatcher.Invoke(counting, inputHandle, outputHandle, outputFieldArray);
|
||||
|
||||
std::cout << "Check result." << std::endl;
|
||||
CheckPortal(outputHandle.GetPortalConstControl());
|
||||
@ -94,12 +91,10 @@ struct DoTestWorklet
|
||||
// Clear out output arrays.
|
||||
outputFieldArray = vtkm::cont::ArrayHandle<T>();
|
||||
outputHandle = vtkm::cont::ArrayHandle<T>();
|
||||
outputHandle.Allocate(ARRAY_SIZE);
|
||||
|
||||
vtkm::cont::DynamicArrayHandle outputFieldDynamic(outputFieldArray);
|
||||
dispatcher.Invoke(counting,
|
||||
vtkm::exec::ExecutionWholeArrayConst<T>(inputHandle),
|
||||
vtkm::exec::ExecutionWholeArray<T>(outputHandle, ARRAY_SIZE),
|
||||
outputFieldDynamic);
|
||||
dispatcher.Invoke(counting, inputHandle, outputHandle, outputFieldDynamic);
|
||||
|
||||
std::cout << "Check dynamic array result." << std::endl;
|
||||
CheckPortal(outputHandle.GetPortalConstControl());
|
||||
@ -110,7 +105,7 @@ struct DoTestWorklet
|
||||
void TestWorkletMapFieldExecArg()
|
||||
{
|
||||
typedef vtkm::cont::DeviceAdapterTraits<VTKM_DEFAULT_DEVICE_ADAPTER_TAG> DeviceAdapterTraits;
|
||||
std::cout << "Testing Worklet with ExecutionWholeArray on device adapter: "
|
||||
std::cout << "Testing Worklet with WholeArray on device adapter: "
|
||||
<< DeviceAdapterTraits::GetName() << std::endl;
|
||||
|
||||
std::cout << "--- Worklet accepting all types." << std::endl;
|
||||
|
Loading…
Reference in New Issue
Block a user