Deprecate ArrayHandle::ExecutionTypes

The newer version of `ArrayHandle` no longer supports different types of
portals for different devices. Thus, the `ReadPortalType` and
`WritePortalType` are sufficient for all types of portals across all
devices.

This significantly simplifies supporting execution objects on devices,
and thus this change also includes many changes to various execution
objects to remove their dependence on the device adapter tag.
This commit is contained in:
Kenneth Moreland 2021-02-01 08:03:11 -07:00
parent 5cc292080d
commit c55d15f397
98 changed files with 840 additions and 1106 deletions

@ -302,7 +302,7 @@ public:
// TODO: Deprecate this // TODO: Deprecate this
template <typename Device> template <typename Device>
struct ExecutionTypes struct VTKM_DEPRECATED(1.6, "Use ReadPortalType and WritePortalType.") ExecutionTypes
{ {
using Portal = WritePortalType; using Portal = WritePortalType;
using PortalConst = ReadPortalType; using PortalConst = ReadPortalType;

@ -228,19 +228,6 @@ using GetWritePortalType =
template <typename ArrayT> template <typename ArrayT>
using GetReadPortalType = typename std::decay<ArrayT>::type::ReadPortalType; using GetReadPortalType = typename std::decay<ArrayT>::type::ReadPortalType;
template <typename ArrayT,
typename Device,
typename Portal =
typename std::decay<ArrayT>::type::template ExecutionTypes<Device>::Portal,
typename PortalConst =
typename std::decay<ArrayT>::type::template ExecutionTypes<Device>::PortalConst>
using GetPortalExecutionType =
typename brigand::if_<vtkm::internal::PortalSupportsSets<Portal>, Portal, PortalConst>::type;
template <typename ArrayT, typename Device>
using GetPortalConstExecutionType =
typename std::decay<ArrayT>::type::template ExecutionTypes<Device>::PortalConst;
// Get portal objects: // Get portal objects:
// See note above -- we swap in const portals sometimes. // See note above -- we swap in const portals sometimes.
template <typename ArrayT> template <typename ArrayT>

@ -144,6 +144,12 @@ class VTKM_ALWAYS_EXPORT CellSetExplicit : public CellSet
using NumIndicesArrayType = using NumIndicesArrayType =
vtkm::cont::ArrayHandleDecorator<detail::NumIndicesDecorator, OffsetsArrayType>; vtkm::cont::ArrayHandleDecorator<detail::NumIndicesDecorator, OffsetsArrayType>;
// Should this be unified with ConnectivityType?
using ExecConnectivityType =
vtkm::exec::ConnectivityExplicit<typename ShapesArrayType::ReadPortalType,
typename ConnectivityArrayType::ReadPortalType,
typename OffsetsArrayType::ReadPortalType>;
}; };
using ConnTypes = using ConnTypes =
@ -216,7 +222,7 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets); const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets);
template <typename Device, typename VisitTopology, typename IncidentTopology> template <typename Device, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes struct VTKM_DEPRECATED(1.6, "Use ExecConnectivityType.") ExecutionTypes
{ {
private: private:
VTKM_IS_DEVICE_ADAPTER_TAG(Device); VTKM_IS_DEVICE_ADAPTER_TAG(Device);
@ -229,29 +235,32 @@ public:
using ConnAT = typename Chooser::ConnectivityArrayType; using ConnAT = typename Chooser::ConnectivityArrayType;
using OffsetsAT = typename Chooser::OffsetsArrayType; using OffsetsAT = typename Chooser::OffsetsArrayType;
using ShapesET = typename ShapesAT::template ExecutionTypes<Device>;
using ConnET = typename ConnAT::template ExecutionTypes<Device>;
using OffsetsET = typename OffsetsAT::template ExecutionTypes<Device>;
public: public:
using ShapesPortalType = typename ShapesET::PortalConst; using ShapesPortalType = typename ShapesAT::ReadPortalType;
using ConnectivityPortalType = typename ConnET::PortalConst; using ConnectivityPortalType = typename ConnAT::ReadPortalType;
using OffsetsPortalType = typename OffsetsET::PortalConst; using OffsetsPortalType = typename OffsetsAT::ReadPortalType;
using ExecObjectType = using ExecObjectType =
vtkm::exec::ConnectivityExplicit<ShapesPortalType, ConnectivityPortalType, OffsetsPortalType>; vtkm::exec::ConnectivityExplicit<ShapesPortalType, ConnectivityPortalType, OffsetsPortalType>;
}; };
template <typename Device, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType using ExecConnectivityType =
PrepareForInput(Device, VisitTopology, IncidentTopology, vtkm::cont::Token&) const; typename ConnectivityChooser<VisitTopology, IncidentTopology>::ExecConnectivityType;
template <typename Device, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(
vtkm::cont::DeviceAdapterId,
VisitTopology,
IncidentTopology,
vtkm::cont::Token&) const;
template <typename VisitTopology, typename IncidentTopology>
VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.") VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.")
VTKM_CONT typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType VTKM_CONT ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(
PrepareForInput(Device device, vtkm::cont::DeviceAdapterId device,
VisitTopology visitTopology, VisitTopology visitTopology,
IncidentTopology incidentTopology) const IncidentTopology incidentTopology) const
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
return this->PrepareForInput(device, visitTopology, incidentTopology, token); return this->PrepareForInput(device, visitTopology, incidentTopology, token);

@ -370,27 +370,23 @@ void CellSetExplicit<SST, CST, OST>
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
template <typename SST, typename CST, typename OST> template <typename SST, typename CST, typename OST>
template <typename Device, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT VTKM_CONT
auto CellSetExplicit<SST, CST, OST> auto CellSetExplicit<SST, CST, OST>
::PrepareForInput(Device, VisitTopology, IncidentTopology, vtkm::cont::Token& token) const ::PrepareForInput(vtkm::cont::DeviceAdapterId device, VisitTopology, IncidentTopology, vtkm::cont::Token& token) const
-> typename ExecutionTypes<Device, -> ExecConnectivityType<VisitTopology, IncidentTopology>
VisitTopology,
IncidentTopology>::ExecObjectType
{ {
this->BuildConnectivity(Device{}, VisitTopology{}, IncidentTopology{}); this->BuildConnectivity(device, VisitTopology{}, IncidentTopology{});
const auto& connectivity = this->GetConnectivity(VisitTopology{}, const auto& connectivity = this->GetConnectivity(VisitTopology{},
IncidentTopology{}); IncidentTopology{});
VTKM_ASSERT(connectivity.ElementsValid); VTKM_ASSERT(connectivity.ElementsValid);
using ExecObjType = typename ExecutionTypes<Device, using ExecObjType = ExecConnectivityType<VisitTopology, IncidentTopology>;
VisitTopology,
IncidentTopology>::ExecObjectType;
return ExecObjType(connectivity.Shapes.PrepareForInput(Device{}, token), return ExecObjType(connectivity.Shapes.PrepareForInput(device, token),
connectivity.Connectivity.PrepareForInput(Device{}, token), connectivity.Connectivity.PrepareForInput(device, token),
connectivity.Offsets.PrepareForInput(Device{}, token)); connectivity.Offsets.PrepareForInput(device, token));
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

@ -76,36 +76,36 @@ public:
}; };
public: public:
template <typename CellSetPermutationType, typename Device> template <typename CellSetPermutationType>
static VTKM_CONT vtkm::cont::ArrayHandle<vtkm::IdComponent> GetNumIndicesArray( static VTKM_CONT vtkm::cont::ArrayHandle<vtkm::IdComponent> GetNumIndicesArray(
const CellSetPermutationType& cs, const CellSetPermutationType& cs,
Device) vtkm::cont::DeviceAdapterId device)
{ {
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices; vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
vtkm::cont::Invoker{ Device{} }(WriteNumIndices{}, cs, numIndices); vtkm::cont::Invoker{ device }(WriteNumIndices{}, cs, numIndices);
return numIndices; return numIndices;
} }
template <typename NumIndicesStorageType, typename Device> template <typename NumIndicesStorageType>
static VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Id> GetOffsetsArray( static VTKM_CONT vtkm::cont::ArrayHandle<vtkm::Id> GetOffsetsArray(
const vtkm::cont::ArrayHandle<vtkm::IdComponent, NumIndicesStorageType>& numIndices, const vtkm::cont::ArrayHandle<vtkm::IdComponent, NumIndicesStorageType>& numIndices,
vtkm::Id& connectivityLength /* outparam */, vtkm::Id& connectivityLength /* outparam */,
Device) vtkm::cont::DeviceAdapterId)
{ {
return vtkm::cont::ConvertNumIndicesToOffsets(numIndices, connectivityLength); return vtkm::cont::ConvertNumIndicesToOffsets(numIndices, connectivityLength);
} }
template <typename CellSetPermutationType, typename OffsetsStorageType, typename Device> template <typename CellSetPermutationType, typename OffsetsStorageType>
static vtkm::cont::ArrayHandle<vtkm::Id> GetConnectivityArray( static vtkm::cont::ArrayHandle<vtkm::Id> GetConnectivityArray(
const CellSetPermutationType& cs, const CellSetPermutationType& cs,
const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageType>& offsets, const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageType>& offsets,
vtkm::Id connectivityLength, vtkm::Id connectivityLength,
Device) vtkm::cont::DeviceAdapterId device)
{ {
vtkm::cont::ArrayHandle<vtkm::Id> connectivity; vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
connectivity.Allocate(connectivityLength); connectivity.Allocate(connectivityLength);
auto connWrap = vtkm::cont::make_ArrayHandleGroupVecVariable(connectivity, offsets); auto connWrap = vtkm::cont::make_ArrayHandleGroupVecVariable(connectivity, offsets);
vtkm::cont::Invoker{ Device{} }(WriteConnectivity{}, cs, connWrap); vtkm::cont::Invoker{ device }(WriteConnectivity{}, cs, connWrap);
return connectivity; return connectivity;
} }
}; };
@ -133,17 +133,17 @@ class RConnBuilderInput
public: public:
using ConnectivityArrays = vtkm::cont::internal::RConnBuilderInputData<>; using ConnectivityArrays = vtkm::cont::internal::RConnBuilderInputData<>;
template <typename Device> static ConnectivityArrays Get(const CellSetPermutationType& cellset,
static ConnectivityArrays Get(const CellSetPermutationType& cellset, Device) vtkm::cont::DeviceAdapterId device)
{ {
using Helper = RConnTableHelpers; using Helper = RConnTableHelpers;
ConnectivityArrays conn; ConnectivityArrays conn;
vtkm::Id connectivityLength = 0; vtkm::Id connectivityLength = 0;
conn.NumIndices = Helper::GetNumIndicesArray(cellset, Device{}); conn.NumIndices = Helper::GetNumIndicesArray(cellset, device);
conn.Offsets = Helper::GetOffsetsArray(conn.NumIndices, connectivityLength, Device{}); conn.Offsets = Helper::GetOffsetsArray(conn.NumIndices, connectivityLength, device);
conn.Connectivity = conn.Connectivity =
Helper::GetConnectivityArray(cellset, conn.Offsets, connectivityLength, Device{}); Helper::GetConnectivityArray(cellset, conn.Offsets, connectivityLength, device);
return conn; return conn;
} }
@ -175,8 +175,8 @@ public:
using ConnectivityArrays = vtkm::cont::internal:: using ConnectivityArrays = vtkm::cont::internal::
RConnBuilderInputData<ConnectivityStorageTag, OffsetsStorageTag, NumIndicesStorageTag>; RConnBuilderInputData<ConnectivityStorageTag, OffsetsStorageTag, NumIndicesStorageTag>;
template <typename Device> static ConnectivityArrays Get(const CellSetPermutationType& cellset,
static ConnectivityArrays Get(const CellSetPermutationType& cellset, Device) vtkm::cont::DeviceAdapterId device)
{ {
using Helper = RConnTableHelpers; using Helper = RConnTableHelpers;
@ -197,14 +197,14 @@ public:
// Need to generate the offsets from scratch so that they're ordered for the // Need to generate the offsets from scratch so that they're ordered for the
// lower-bounds binary searches in ReverseConnectivityBuilder. // lower-bounds binary searches in ReverseConnectivityBuilder.
conn.Offsets = Helper::GetOffsetsArray(conn.NumIndices, connectivityLength, Device{}); conn.Offsets = Helper::GetOffsetsArray(conn.NumIndices, connectivityLength, device);
// Need to create a copy of this containing *only* the permuted cell defs, // Need to create a copy of this containing *only* the permuted cell defs,
// in order, since the ReverseConnectivityBuilder will process every entry // in order, since the ReverseConnectivityBuilder will process every entry
// in the connectivity array and we don't want the removed cells to be // in the connectivity array and we don't want the removed cells to be
// included. // included.
conn.Connectivity = conn.Connectivity =
Helper::GetConnectivityArray(cellset, conn.Offsets, connectivityLength, Device{}); Helper::GetConnectivityArray(cellset, conn.Offsets, connectivityLength, device);
return conn; return conn;
} }
@ -225,8 +225,8 @@ public:
typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag, typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag,
typename vtkm::cont::ArrayHandleConstant<vtkm::IdComponent>::StorageTag>; typename vtkm::cont::ArrayHandleConstant<vtkm::IdComponent>::StorageTag>;
template <typename Device> static ConnectivityArrays Get(const CellSetPermutationType& cellset,
static ConnectivityArrays Get(const CellSetPermutationType& cellset, Device) vtkm::cont::DeviceAdapterId device)
{ {
vtkm::Id numberOfCells = cellset.GetNumberOfCells(); vtkm::Id numberOfCells = cellset.GetNumberOfCells();
vtkm::IdComponent numPointsInCell = vtkm::IdComponent numPointsInCell =
@ -237,7 +237,7 @@ public:
conn.NumIndices = make_ArrayHandleConstant(numPointsInCell, numberOfCells); conn.NumIndices = make_ArrayHandleConstant(numPointsInCell, numberOfCells);
conn.Offsets = ArrayHandleCounting<vtkm::Id>(0, numPointsInCell, numberOfCells + 1); conn.Offsets = ArrayHandleCounting<vtkm::Id>(0, numPointsInCell, numberOfCells + 1);
conn.Connectivity = conn.Connectivity =
RConnTableHelpers::GetConnectivityArray(cellset, conn.Offsets, connectivityLength, Device{}); RConnTableHelpers::GetConnectivityArray(cellset, conn.Offsets, connectivityLength, device);
return conn; return conn;
} }
@ -405,64 +405,62 @@ public:
return this->FullCellSet.GetNumberOfPoints(); return this->FullCellSet.GetNumberOfPoints();
} }
template <typename Device, typename VisitTopology, typename IncidentTopology> private:
struct ExecutionTypes; template <typename VisitTopology, typename IncidentTopology>
struct ConnectivityChooser;
template <typename Device> template <>
struct ExecutionTypes<Device, vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint> struct ConnectivityChooser<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(Device); using ExecPortalType = typename PermutationArrayHandleType::ReadPortalType;
using OrigExecObjectType =
typename OriginalCellSetType::template ExecConnectivityType<vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint>;
using ExecPortalType = using ExecConnectivityType =
typename PermutationArrayHandleType::template ExecutionTypes<Device>::PortalConst;
using OrigExecObjectType = typename OriginalCellSetType::template ExecutionTypes<
Device,
vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint>::ExecObjectType;
using ExecObjectType =
vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<ExecPortalType, OrigExecObjectType>; vtkm::exec::ConnectivityPermutedVisitCellsWithPoints<ExecPortalType, OrigExecObjectType>;
}; };
template <typename Device> template <>
struct ExecutionTypes<Device, vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell> struct ConnectivityChooser<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(Device); using ConnectivityPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
using NumIndicesPortalType =
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType;
using OffsetPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
using ConnectivityPortalType = using ExecConnectivityType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::PortalConst;
using NumIndicesPortalType = typename vtkm::cont::ArrayHandle<
vtkm::IdComponent>::template ExecutionTypes<Device>::PortalConst;
using OffsetPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::PortalConst;
using ExecObjectType =
vtkm::exec::ConnectivityPermutedVisitPointsWithCells<ConnectivityPortalType, vtkm::exec::ConnectivityPermutedVisitPointsWithCells<ConnectivityPortalType,
OffsetPortalType>; OffsetPortalType>;
}; };
template <typename Device> public:
VTKM_CONT typename ExecutionTypes<Device, template <typename Device, typename VisitTopology, typename IncidentTopology>
vtkm::TopologyElementTagCell, struct VTKM_DEPRECATED(1.6, "Use ExecConnectivityType.") ExecutionTypes
vtkm::TopologyElementTagPoint>::ExecObjectType {
PrepareForInput(Device device, using ExecObjectType =
typename ConnectivityChooser<VisitTopology, IncidentTopology>::ExecConnectivityType;
};
template <typename VisitTopology, typename IncidentTopology>
using ExecConnectivityType =
typename ConnectivityChooser<VisitTopology, IncidentTopology>::ExecConnectivityType;
VTKM_CONT ExecConnectivityType<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>
PrepareForInput(vtkm::cont::DeviceAdapterId device,
vtkm::TopologyElementTagCell visitTopology, vtkm::TopologyElementTagCell visitTopology,
vtkm::TopologyElementTagPoint incidentTopology, vtkm::TopologyElementTagPoint incidentTopology,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
using ConnectivityType = typename ExecutionTypes<Device, using ConnectivityType =
vtkm::TopologyElementTagCell, ExecConnectivityType<vtkm::TopologyElementTagCell, vtkm::TopologyElementTagPoint>;
vtkm::TopologyElementTagPoint>::ExecObjectType;
return ConnectivityType( return ConnectivityType(
this->ValidCellIds.PrepareForInput(device, token), this->ValidCellIds.PrepareForInput(device, token),
this->FullCellSet.PrepareForInput(device, visitTopology, incidentTopology, token)); this->FullCellSet.PrepareForInput(device, visitTopology, incidentTopology, token));
} }
template <typename Device> VTKM_CONT ExecConnectivityType<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>
VTKM_CONT typename ExecutionTypes<Device, PrepareForInput(vtkm::cont::DeviceAdapterId device,
vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell>::ExecObjectType
PrepareForInput(Device device,
vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell, vtkm::TopologyElementTagCell,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
@ -474,17 +472,18 @@ public:
this->VisitPointsWithCells, connTable, this->GetNumberOfPoints(), device); this->VisitPointsWithCells, connTable, this->GetNumberOfPoints(), device);
} }
using ConnectivityType = typename ExecutionTypes<Device, using ConnectivityType =
vtkm::TopologyElementTagPoint, ExecConnectivityType<vtkm::TopologyElementTagPoint, vtkm::TopologyElementTagCell>;
vtkm::TopologyElementTagCell>::ExecObjectType;
return ConnectivityType(this->VisitPointsWithCells.Connectivity.PrepareForInput(device, token), return ConnectivityType(this->VisitPointsWithCells.Connectivity.PrepareForInput(device, token),
this->VisitPointsWithCells.Offsets.PrepareForInput(device, token)); this->VisitPointsWithCells.Offsets.PrepareForInput(device, token));
} }
template <typename Device, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.") VTKM_CONT VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.")
typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(
PrepareForInput(Device device, VisitTopology visitTopology, IncidentTopology incidentTopology) vtkm::cont::DeviceAdapterId device,
VisitTopology visitTopology,
IncidentTopology incidentTopology)
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
return this->PrepareForInput(device, visitTopology, incidentTopology, token); return this->PrepareForInput(device, visitTopology, incidentTopology, token);

@ -104,26 +104,32 @@ public:
template <typename TopologyElement> template <typename TopologyElement>
SchedulingRangeType GetSchedulingRange(TopologyElement) const; SchedulingRangeType GetSchedulingRange(TopologyElement) const;
template <typename VisitTopology, typename IncidentTopology>
using ExecConnectivityType =
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology> template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes struct VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.")
ExecutionTypes
{ {
VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapter); VTKM_IS_DEVICE_ADAPTER_TAG(DeviceAdapter);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(VisitTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology); VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
using ExecObjectType = using ExecObjectType = ExecConnectivityType<VisitTopology, IncidentTopology>;
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
}; };
template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(vtkm::cont::DeviceAdapterId,
PrepareForInput(DeviceAdapter, VisitTopology, IncidentTopology, vtkm::cont::Token&) const; VisitTopology,
IncidentTopology,
vtkm::cont::Token&) const;
template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.") VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.")
typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(
PrepareForInput(DeviceAdapter device, vtkm::cont::DeviceAdapterId device,
VisitTopology visitTopology, VisitTopology visitTopology,
IncidentTopology incidentTopology) const IncidentTopology incidentTopology) const
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
return this->PrepareForInput(device, visitTopology, incidentTopology, token); return this->PrepareForInput(device, visitTopology, incidentTopology, token);

@ -25,16 +25,15 @@ typename CellSetStructured<DIMENSION>::SchedulingRangeType
} }
template <vtkm::IdComponent DIMENSION> template <vtkm::IdComponent DIMENSION>
template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology> template <typename VisitTopology, typename IncidentTopology>
typename CellSetStructured<DIMENSION>:: typename CellSetStructured<DIMENSION>::template ExecConnectivityType<VisitTopology,
template ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType IncidentTopology>
CellSetStructured<DIMENSION>::PrepareForInput(DeviceAdapter, CellSetStructured<DIMENSION>::PrepareForInput(vtkm::cont::DeviceAdapterId,
VisitTopology, VisitTopology,
IncidentTopology, IncidentTopology,
vtkm::cont::Token&) const vtkm::cont::Token&) const
{ {
using ConnectivityType = using ConnectivityType = ExecConnectivityType<VisitTopology, IncidentTopology>;
typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType;
return ConnectivityType(this->Structure); return ConnectivityType(this->Structure);
} }

@ -83,7 +83,7 @@ public:
template <typename Device> template <typename Device>
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
typename ArrayHandleVirtualCoordinates::ExecutionTypes<Device>::PortalConst typename ArrayHandleVirtualCoordinates::ReadPortalType
PrepareForInput(Device device, vtkm::cont::Token& token) const PrepareForInput(Device device, vtkm::cont::Token& token) const
{ {
return this->ToArray().PrepareForInput(device, token); return this->ToArray().PrepareForInput(device, token);
@ -91,7 +91,7 @@ public:
template <typename Device> template <typename Device>
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
typename ArrayHandleVirtualCoordinates::ExecutionTypes<Device>::Portal typename ArrayHandleVirtualCoordinates::WritePortalType
PrepareForInPlace(Device device, vtkm::cont::Token& token) const PrepareForInPlace(Device device, vtkm::cont::Token& token) const
{ {
return this->ToArray().PrepareForInPlace(device, token); return this->ToArray().PrepareForInPlace(device, token);
@ -99,7 +99,7 @@ public:
template <typename Device> template <typename Device>
VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.")
typename ArrayHandleVirtualCoordinates::ExecutionTypes<Device>::Portal typename ArrayHandleVirtualCoordinates::WritePortalType
PrepareForOutput(vtkm::Id numberOfValues, Device device, vtkm::cont::Token& token) const PrepareForOutput(vtkm::Id numberOfValues, Device device, vtkm::cont::Token& token) const
{ {
return this->ToArray().PrepareForOutput(numberOfValues, device, token); return this->ToArray().PrepareForOutput(numberOfValues, device, token);

@ -45,8 +45,7 @@ struct Transport
/// For example, for an \c ArrayHandle, the \c ExecObjectType is the portal /// For example, for an \c ArrayHandle, the \c ExecObjectType is the portal
/// used in the execution environment. /// used in the execution environment.
/// ///
using ExecObjectType = using ExecObjectType = typename ContObjectType::ReadPortalType;
typename ContObjectType::template ExecutionTypes<DeviceAdapterTag>::PortalConst;
/// \brief Send data to the execution environment. /// \brief Send data to the execution environment.
/// ///

@ -53,7 +53,7 @@ struct TryArrayInType
using ArrayHandleType = vtkm::cont::ArrayHandle<T>; using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
ArrayHandleType handle = vtkm::cont::make_ArrayHandle(array, ARRAY_SIZE, vtkm::CopyFlag::Off); ArrayHandleType handle = vtkm::cont::make_ArrayHandle(array, ARRAY_SIZE, vtkm::CopyFlag::Off);
using PortalType = typename ArrayHandleType::template ExecutionTypes<Device>::PortalConst; using PortalType = typename ArrayHandleType::ReadPortalType;
vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayIn, ArrayHandleType, Device> vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayIn, ArrayHandleType, Device>
transport; transport;

@ -51,7 +51,7 @@ struct TryArrayInOutType
using ArrayHandleType = vtkm::cont::ArrayHandle<T>; using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
ArrayHandleType handle = vtkm::cont::make_ArrayHandle(array, ARRAY_SIZE, vtkm::CopyFlag::Off); ArrayHandleType handle = vtkm::cont::make_ArrayHandle(array, ARRAY_SIZE, vtkm::CopyFlag::Off);
using PortalType = typename ArrayHandleType::template ExecutionTypes<Device>::Portal; using PortalType = typename ArrayHandleType::WritePortalType;
vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayInOut, ArrayHandleType, Device> vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayInOut, ArrayHandleType, Device>
transport; transport;

@ -45,7 +45,7 @@ struct TryArrayOutType
using ArrayHandleType = vtkm::cont::ArrayHandle<T>; using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
ArrayHandleType handle; ArrayHandleType handle;
using PortalType = typename ArrayHandleType::template ExecutionTypes<Device>::Portal; using PortalType = typename ArrayHandleType::WritePortalType;
vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayOut, ArrayHandleType, Device> vtkm::cont::arg::Transport<vtkm::cont::arg::TransportTagArrayOut, ArrayHandleType, Device>
transport; transport;

@ -62,8 +62,9 @@ void TransportWholeCellSetIn(Device)
using IncidentTopology = vtkm::TopologyElementTagPoint; using IncidentTopology = vtkm::TopologyElementTagPoint;
using VisitTopology = vtkm::TopologyElementTagCell; using VisitTopology = vtkm::TopologyElementTagCell;
using ExecObjectType = typename vtkm::cont::CellSetExplicit<>:: using ExecObjectType =
template ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType; typename vtkm::cont::CellSetExplicit<>::template ExecConnectivityType<VisitTopology,
IncidentTopology>;
vtkm::cont::arg::Transport< vtkm::cont::arg::Transport<
vtkm::cont::arg::TransportTagCellSetIn<VisitTopology, IncidentTopology>, vtkm::cont::arg::TransportTagCellSetIn<VisitTopology, IncidentTopology>,

@ -156,11 +156,11 @@ struct ConnIdxToCellIdCalcSingleType
vtkm::Id operator()(vtkm::Id inIdx) const { return inIdx / this->CellSize; } vtkm::Id operator()(vtkm::Id inIdx) const { return inIdx / this->CellSize; }
}; };
template <typename ConnTableT, typename RConnTableT, typename Device> template <typename ConnTableT, typename RConnTableT>
void ComputeRConnTable(RConnTableT& rConnTable, void ComputeRConnTable(RConnTableT& rConnTable,
const ConnTableT& connTable, const ConnTableT& connTable,
vtkm::Id numberOfPoints, vtkm::Id numberOfPoints,
Device) vtkm::cont::DeviceAdapterId device)
{ {
if (rConnTable.ElementsValid) if (rConnTable.ElementsValid)
{ {
@ -174,13 +174,13 @@ void ComputeRConnTable(RConnTableT& rConnTable,
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
const auto offInPortal = connTable.Offsets.PrepareForInput(Device{}, token); const auto offInPortal = connTable.Offsets.PrepareForInput(device, token);
PassThrough idxCalc{}; PassThrough idxCalc{};
ConnIdxToCellIdCalc<decltype(offInPortal)> cellIdCalc{ offInPortal }; ConnIdxToCellIdCalc<decltype(offInPortal)> cellIdCalc{ offInPortal };
vtkm::cont::internal::ReverseConnectivityBuilder builder; vtkm::cont::internal::ReverseConnectivityBuilder builder;
builder.Run(conn, rConn, rOffsets, idxCalc, cellIdCalc, numberOfPoints, rConnSize, Device()); builder.Run(conn, rConn, rOffsets, idxCalc, cellIdCalc, numberOfPoints, rConnSize, device);
} }
rConnTable.Shapes = vtkm::cont::make_ArrayHandleConstant( rConnTable.Shapes = vtkm::cont::make_ArrayHandleConstant(
@ -189,14 +189,14 @@ void ComputeRConnTable(RConnTableT& rConnTable,
} }
// Specialize for CellSetSingleType: // Specialize for CellSetSingleType:
template <typename RConnTableT, typename ConnectivityStorageTag, typename Device> template <typename RConnTableT, typename ConnectivityStorageTag>
void ComputeRConnTable(RConnTableT& rConnTable, void ComputeRConnTable(RConnTableT& rConnTable,
const ConnectivityExplicitInternals< // SingleType specialization types: const ConnectivityExplicitInternals< // SingleType specialization types:
typename vtkm::cont::ArrayHandleConstant<vtkm::UInt8>::StorageTag, typename vtkm::cont::ArrayHandleConstant<vtkm::UInt8>::StorageTag,
ConnectivityStorageTag, ConnectivityStorageTag,
typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag>& connTable, typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag>& connTable,
vtkm::Id numberOfPoints, vtkm::Id numberOfPoints,
Device) vtkm::cont::DeviceAdapterId device)
{ {
if (rConnTable.ElementsValid) if (rConnTable.ElementsValid)
{ {
@ -221,7 +221,7 @@ void ComputeRConnTable(RConnTableT& rConnTable,
ConnIdxToCellIdCalcSingleType cellIdCalc{ cellSize }; ConnIdxToCellIdCalcSingleType cellIdCalc{ cellSize };
vtkm::cont::internal::ReverseConnectivityBuilder builder; vtkm::cont::internal::ReverseConnectivityBuilder builder;
builder.Run(conn, rConn, rOffsets, idxCalc, cellIdCalc, numberOfPoints, rConnSize, Device()); builder.Run(conn, rConn, rOffsets, idxCalc, cellIdCalc, numberOfPoints, rConnSize, device);
rConnTable.Shapes = vtkm::cont::make_ArrayHandleConstant( rConnTable.Shapes = vtkm::cont::make_ArrayHandleConstant(
static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints); static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints);

@ -10,10 +10,10 @@
#ifndef vtk_m_cont_internal_ReverseConnectivityBuilder_h #ifndef vtk_m_cont_internal_ReverseConnectivityBuilder_h
#define vtk_m_cont_internal_ReverseConnectivityBuilder_h #define vtk_m_cont_internal_ReverseConnectivityBuilder_h
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandle.h> #include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ArrayHandleCast.h> #include <vtkm/cont/ArrayHandleCast.h>
#include <vtkm/cont/ArrayHandleConstant.h> #include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/AtomicArray.h> #include <vtkm/cont/AtomicArray.h>
#include <vtkm/exec/FunctorBase.h> #include <vtkm/exec/FunctorBase.h>
@ -133,8 +133,7 @@ public:
typename RConnArray, typename RConnArray,
typename ROffsetsArray, typename ROffsetsArray,
typename RConnToConnIdxCalc, typename RConnToConnIdxCalc,
typename ConnIdxToCellIdxCalc, typename ConnIdxToCellIdxCalc>
typename Device>
inline void Run(const ConnArray& conn, inline void Run(const ConnArray& conn,
RConnArray& rConn, RConnArray& rConn,
ROffsetsArray& rOffsets, ROffsetsArray& rOffsets,
@ -142,12 +141,10 @@ public:
const ConnIdxToCellIdxCalc& cellIdCalc, const ConnIdxToCellIdxCalc& cellIdCalc,
vtkm::Id numberOfPoints, vtkm::Id numberOfPoints,
vtkm::Id rConnSize, vtkm::Id rConnSize,
Device) vtkm::cont::DeviceAdapterId device)
{ {
using Algo = vtkm::cont::DeviceAdapterAlgorithm<Device>;
vtkm::cont::Token connToken; vtkm::cont::Token connToken;
auto connPortal = conn.PrepareForInput(Device(), connToken); auto connPortal = conn.PrepareForInput(device, connToken);
auto zeros = vtkm::cont::make_ArrayHandleConstant(vtkm::IdComponent{ 0 }, numberOfPoints); auto zeros = vtkm::cont::make_ArrayHandleConstant(vtkm::IdComponent{ 0 }, numberOfPoints);
// Compute RConn offsets by atomically building a histogram and doing an // Compute RConn offsets by atomically building a histogram and doing an
@ -159,26 +156,27 @@ public:
// (out) RIdxOffsets: 0 3 5 6 9 11 12 // (out) RIdxOffsets: 0 3 5 6 9 11 12
vtkm::cont::ArrayHandle<vtkm::IdComponent> rNumIndices; vtkm::cont::ArrayHandle<vtkm::IdComponent> rNumIndices;
{ // allocate and zero the numIndices array: { // allocate and zero the numIndices array:
Algo::Copy(zeros, rNumIndices); vtkm::cont::Algorithm::Copy(device, zeros, rNumIndices);
} }
{ // Build histogram: { // Build histogram:
vtkm::cont::AtomicArray<vtkm::IdComponent> atomicCounter{ rNumIndices }; vtkm::cont::AtomicArray<vtkm::IdComponent> atomicCounter{ rNumIndices };
vtkm::cont::Token token; vtkm::cont::Token token;
auto ac = atomicCounter.PrepareForExecution(Device(), token); auto ac = atomicCounter.PrepareForExecution(device, token);
using BuildHisto = using BuildHisto =
rcb::BuildHistogram<decltype(ac), decltype(connPortal), RConnToConnIdxCalc>; rcb::BuildHistogram<decltype(ac), decltype(connPortal), RConnToConnIdxCalc>;
BuildHisto histoGen{ ac, connPortal, rConnToConnCalc }; BuildHisto histoGen{ ac, connPortal, rConnToConnCalc };
Algo::Schedule(histoGen, rConnSize); vtkm::cont::Algorithm::Schedule(device, histoGen, rConnSize);
} }
{ // Compute offsets: { // Compute offsets:
Algo::ScanExtended(vtkm::cont::make_ArrayHandleCast<vtkm::Id>(rNumIndices), rOffsets); vtkm::cont::Algorithm::ScanExtended(
device, vtkm::cont::make_ArrayHandleCast<vtkm::Id>(rNumIndices), rOffsets);
} }
{ // Reset the numIndices array to 0's: { // Reset the numIndices array to 0's:
Algo::Copy(zeros, rNumIndices); vtkm::cont::Algorithm::Copy(device, zeros, rNumIndices);
} }
// Fill the connectivity table: // Fill the connectivity table:
@ -197,9 +195,9 @@ public:
{ {
vtkm::cont::AtomicArray<vtkm::IdComponent> atomicCounter{ rNumIndices }; vtkm::cont::AtomicArray<vtkm::IdComponent> atomicCounter{ rNumIndices };
vtkm::cont::Token token; vtkm::cont::Token token;
auto ac = atomicCounter.PrepareForExecution(Device(), token); auto ac = atomicCounter.PrepareForExecution(device, token);
auto rOffsetPortal = rOffsets.PrepareForInput(Device(), token); auto rOffsetPortal = rOffsets.PrepareForInput(device, token);
auto rConnPortal = rConn.PrepareForOutput(rConnSize, Device(), token); auto rConnPortal = rConn.PrepareForOutput(rConnSize, device, token);
using GenRConnT = rcb::GenerateRConn<decltype(ac), using GenRConnT = rcb::GenerateRConn<decltype(ac),
decltype(connPortal), decltype(connPortal),
@ -209,7 +207,7 @@ public:
ConnIdxToCellIdxCalc>; ConnIdxToCellIdxCalc>;
GenRConnT rConnGen{ ac, connPortal, rOffsetPortal, rConnPortal, rConnToConnCalc, cellIdCalc }; GenRConnT rConnGen{ ac, connPortal, rOffsetPortal, rConnPortal, rConnToConnCalc, cellIdCalc };
Algo::Schedule(rConnGen, rConnSize); vtkm::cont::Algorithm::Schedule(device, rConnGen, rConnSize);
} }
} }
}; };

@ -417,11 +417,8 @@ private:
class ScanExclusiveOperator class ScanExclusiveOperator
{ {
private: private:
using ArrayPortalIn = using ArrayPortalIn = typename ArrayHandle<T, StorageIn>::ReadPortalType;
typename ArrayHandle<T, using ArrayPortalOut = typename ArrayHandle<T, StorageOut>::WritePortalType;
StorageIn>::template ExecutionTypes<DeviceAdapterTagKokkos>::PortalConst;
using ArrayPortalOut =
typename ArrayHandle<T, StorageOut>::template ExecutionTypes<DeviceAdapterTagKokkos>::Portal;
public: public:
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION
@ -547,11 +544,8 @@ private:
class ScanInclusiveOperator class ScanInclusiveOperator
{ {
private: private:
using ArrayPortalIn = using ArrayPortalIn = typename ArrayHandle<T, StorageIn>::ReadPortalType;
typename ArrayHandle<T, using ArrayPortalOut = typename ArrayHandle<T, StorageOut>::WritePortalType;
StorageIn>::template ExecutionTypes<DeviceAdapterTagKokkos>::PortalConst;
using ArrayPortalOut =
typename ArrayHandle<T, StorageOut>::template ExecutionTypes<DeviceAdapterTagKokkos>::Portal;
public: public:
KOKKOS_INLINE_FUNCTION KOKKOS_INLINE_FUNCTION

@ -210,8 +210,8 @@ private:
std::cout << "Check out execution array behavior." << std::endl; std::cout << "Check out execution array behavior." << std::endl;
{ //as input { //as input
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::PortalConst typename vtkm::cont::ArrayHandle<T>::ReadPortalType executionPortal =
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token); arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
static_cast<void>(executionPortal); static_cast<void>(executionPortal);
@ -224,8 +224,8 @@ private:
std::cout << "Check out inplace." << std::endl; std::cout << "Check out inplace." << std::endl;
{ //as inplace { //as inplace
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal typename vtkm::cont::ArrayHandle<T>::WritePortalType executionPortal =
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
static_cast<void>(executionPortal); static_cast<void>(executionPortal);
@ -302,8 +302,8 @@ private:
std::cout << "Check out execution array behavior." << std::endl; std::cout << "Check out execution array behavior." << std::endl;
{ //as input { //as input
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::PortalConst typename vtkm::cont::ArrayHandle<T>::ReadPortalType executionPortal =
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token); arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
static_cast<void>(executionPortal); static_cast<void>(executionPortal);
@ -316,8 +316,8 @@ private:
std::cout << "Check out inplace." << std::endl; std::cout << "Check out inplace." << std::endl;
{ //as inplace { //as inplace
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal typename vtkm::cont::ArrayHandle<T>::WritePortalType executionPortal =
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
static_cast<void>(executionPortal); static_cast<void>(executionPortal);
@ -385,8 +385,7 @@ private:
std::cout << "Check out execution array behavior." << std::endl; std::cout << "Check out execution array behavior." << std::endl;
{ //as input { //as input
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::PortalConst typename vtkm::cont::ArrayHandle<T>::ReadPortalType executionPortal;
executionPortal;
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token); executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
@ -399,8 +398,7 @@ private:
std::cout << "Check out inplace." << std::endl; std::cout << "Check out inplace." << std::endl;
{ //as inplace { //as inplace
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal typename vtkm::cont::ArrayHandle<T>::WritePortalType executionPortal;
executionPortal;
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
@ -451,8 +449,7 @@ private:
std::cout << "Check out execution array behavior." << std::endl; std::cout << "Check out execution array behavior." << std::endl;
{ //as input { //as input
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::PortalConst typename vtkm::cont::ArrayHandle<T>::ReadPortalType executionPortal;
executionPortal;
executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token); executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
@ -465,8 +462,7 @@ private:
std::cout << "Check out inplace." << std::endl; std::cout << "Check out inplace." << std::endl;
{ //as inplace { //as inplace
vtkm::cont::Token token; vtkm::cont::Token token;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal typename vtkm::cont::ArrayHandle<T>::WritePortalType executionPortal;
executionPortal;
executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token);
token.DetachFromAll(); token.DetachFromAll();
@ -510,8 +506,7 @@ private:
"ArrayHandle has wrong number of entries."); "ArrayHandle has wrong number of entries.");
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
using ExecutionPortalType = using ExecutionPortalType = typename vtkm::cont::ArrayHandle<T>::WritePortalType;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal;
ExecutionPortalType executionPortal = ExecutionPortalType executionPortal =
arrayHandle.PrepareForOutput(ARRAY_SIZE * 2, DeviceAdapterTag(), token); arrayHandle.PrepareForOutput(ARRAY_SIZE * 2, DeviceAdapterTag(), token);
@ -540,8 +535,7 @@ private:
std::cout << "Try in place operation." << std::endl; std::cout << "Try in place operation." << std::endl;
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
using ExecutionPortalType = using ExecutionPortalType = typename vtkm::cont::ArrayHandle<T>::WritePortalType;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal;
// Reset array data. // Reset array data.
Algorithm::Schedule(AssignTestValue<T, ExecutionPortalType>{ arrayHandle.PrepareForOutput( Algorithm::Schedule(AssignTestValue<T, ExecutionPortalType>{ arrayHandle.PrepareForOutput(
@ -587,8 +581,7 @@ private:
"ArrayHandle has wrong number of entries."); "ArrayHandle has wrong number of entries.");
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
using ExecutionPortalType = using ExecutionPortalType = typename vtkm::cont::ArrayHandle<T>::WritePortalType;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal;
ExecutionPortalType executionPortal = ExecutionPortalType executionPortal =
arrayHandle.PrepareForOutput(ARRAY_SIZE * 2, DeviceAdapterTag(), token); arrayHandle.PrepareForOutput(ARRAY_SIZE * 2, DeviceAdapterTag(), token);
@ -607,8 +600,7 @@ private:
std::cout << "Try in place operation." << std::endl; std::cout << "Try in place operation." << std::endl;
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
using ExecutionPortalType = using ExecutionPortalType = typename vtkm::cont::ArrayHandle<T>::WritePortalType;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapterTag>::Portal;
// Reset array data. // Reset array data.
Algorithm::Schedule(AssignTestValue<T, ExecutionPortalType>{ arrayHandle.PrepareForOutput( Algorithm::Schedule(AssignTestValue<T, ExecutionPortalType>{ arrayHandle.PrepareForOutput(

@ -520,7 +520,7 @@ struct TestingBitField
struct ArrayHandleBitFieldChecker : vtkm::exec::FunctorBase struct ArrayHandleBitFieldChecker : vtkm::exec::FunctorBase
{ {
using PortalType = typename ArrayHandleBitField::ExecutionTypes<DeviceAdapterTag>::Portal; using PortalType = vtkm::cont::ArrayHandleBitField::WritePortalType;
PortalType Portal; PortalType Portal;
bool InvertReference; bool InvertReference;

@ -29,11 +29,10 @@ class LocatorWorklet : public vtkm::worklet::WorkletMapField
{ {
public: public:
using AxisHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>; using AxisHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
using AxisPortalType = typename AxisHandle::template ExecutionTypes<DeviceAdapter>::PortalConst; using AxisPortalType = typename AxisHandle::ReadPortalType;
using RectilinearType = using RectilinearType =
vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>; vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>;
using RectilinearPortalType = using RectilinearPortalType = typename RectilinearType::ReadPortalType;
typename RectilinearType::template ExecutionTypes<DeviceAdapter>::PortalConst;
LocatorWorklet(vtkm::Bounds& bounds, LocatorWorklet(vtkm::Bounds& bounds,
vtkm::Id3& dims, vtkm::Id3& dims,

@ -73,9 +73,8 @@ private:
using ScalarArrayHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault, StorageTag>; using ScalarArrayHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault, StorageTag>;
using FloatCastHandle = vtkm::cont::ArrayHandleCast<vtkm::FloatDefault, IdArrayHandle>; using FloatCastHandle = vtkm::cont::ArrayHandleCast<vtkm::FloatDefault, IdArrayHandle>;
using IdPortalType = typename IdArrayHandle::template ExecutionTypes<DeviceAdapterTag>::Portal; using IdPortalType = typename IdArrayHandle::WritePortalType;
using IdPortalConstType = using IdPortalConstType = typename IdArrayHandle::ReadPortalType;
typename IdArrayHandle::template ExecutionTypes<DeviceAdapterTag>::PortalConst;
using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapterTag>; using Algorithm = vtkm::cont::DeviceAdapterAlgorithm<DeviceAdapterTag>;
@ -172,7 +171,7 @@ public:
struct OverlapKernel struct OverlapKernel
{ {
using ArrayType = ArrayHandle<bool>; using ArrayType = ArrayHandle<bool>;
using PortalType = typename ArrayType::template ExecutionTypes<DeviceAdapterTag>::Portal; using PortalType = typename ArrayType::WritePortalType;
PortalType TrackerPortal; PortalType TrackerPortal;
PortalType ValidPortal; PortalType ValidPortal;
@ -788,7 +787,7 @@ private:
{ {
using BoolArray = ArrayHandle<bool>; using BoolArray = ArrayHandle<bool>;
using BoolPortal = typename BoolArray::template ExecutionTypes<DeviceAdapterTag>::Portal; using BoolPortal = typename BoolArray::WritePortalType;
BoolArray tracker; BoolArray tracker;
BoolArray valid; BoolArray valid;
@ -832,7 +831,7 @@ private:
static const vtkm::Id3 dims{ DIM_SIZE, DIM_SIZE, DIM_SIZE }; static const vtkm::Id3 dims{ DIM_SIZE, DIM_SIZE, DIM_SIZE };
using BoolArray = ArrayHandle<bool>; using BoolArray = ArrayHandle<bool>;
using BoolPortal = typename BoolArray::template ExecutionTypes<DeviceAdapterTag>::Portal; using BoolPortal = typename BoolArray::WritePortalType;
BoolArray tracker; BoolArray tracker;
BoolArray valid; BoolArray valid;

@ -156,9 +156,8 @@ struct ExtractComponentTests
InputArray composite = this->BuildInputArray(); InputArray composite = this->BuildInputArray();
ExtractArray extract(composite, component); ExtractArray extract(composite, component);
using Portal = typename ExtractArray::template ExecutionTypes<DeviceTag>::Portal; using Portal = typename ExtractArray::WritePortalType;
using RefPortal = using RefPortal = typename ReferenceCompositeArray::ReadPortalType;
typename ReferenceCompositeArray::template ExecutionTypes<DeviceTag>::PortalConst;
{ {
vtkm::cont::Token token; vtkm::cont::Token token;

@ -56,7 +56,7 @@ struct ImplicitTests
//verify that the execution portal works //verify that the execution portal works
vtkm::cont::Token token; vtkm::cont::Token token;
using Device = vtkm::cont::DeviceAdapterTagSerial; using Device = vtkm::cont::DeviceAdapterTagSerial;
using CEPortal = typename ImplicitHandle::template ExecutionTypes<Device>::PortalConst; using CEPortal = typename ImplicitHandle::ReadPortalType;
CEPortal execPortal = implicit.PrepareForInput(Device(), token); CEPortal execPortal = implicit.PrepareForInput(Device(), token);
for (int i = 0; i < ARRAY_SIZE; ++i) for (int i = 0; i < ARRAY_SIZE; ++i)
{ {

@ -55,14 +55,12 @@ struct CheckPermutationFunctor : vtkm::exec::FunctorBase
}; };
template <typename PermutedArrayHandleType, typename Device> template <typename PermutedArrayHandleType, typename Device>
VTKM_CONT CheckPermutationFunctor< VTKM_CONT CheckPermutationFunctor<typename PermutedArrayHandleType::ReadPortalType>
typename PermutedArrayHandleType::template ExecutionTypes<Device>::PortalConst>
make_CheckPermutationFunctor(const PermutedArrayHandleType& permutedArray, make_CheckPermutationFunctor(const PermutedArrayHandleType& permutedArray,
Device, Device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
using PermutedPortalType = using PermutedPortalType = typename PermutedArrayHandleType::ReadPortalType;
typename PermutedArrayHandleType::template ExecutionTypes<Device>::PortalConst;
CheckPermutationFunctor<PermutedPortalType> functor; CheckPermutationFunctor<PermutedPortalType> functor;
functor.PermutedPortal = permutedArray.PrepareForInput(Device(), token); functor.PermutedPortal = permutedArray.PrepareForInput(Device(), token);
return functor; return functor;
@ -86,14 +84,12 @@ struct InPlacePermutationFunctor : vtkm::exec::FunctorBase
}; };
template <typename PermutedArrayHandleType, typename Device> template <typename PermutedArrayHandleType, typename Device>
VTKM_CONT InPlacePermutationFunctor< VTKM_CONT InPlacePermutationFunctor<typename PermutedArrayHandleType::WritePortalType>
typename PermutedArrayHandleType::template ExecutionTypes<Device>::Portal>
make_InPlacePermutationFunctor(PermutedArrayHandleType& permutedArray, make_InPlacePermutationFunctor(PermutedArrayHandleType& permutedArray,
Device, Device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
using PermutedPortalType = using PermutedPortalType = typename PermutedArrayHandleType::WritePortalType;
typename PermutedArrayHandleType::template ExecutionTypes<Device>::Portal;
InPlacePermutationFunctor<PermutedPortalType> functor; InPlacePermutationFunctor<PermutedPortalType> functor;
functor.PermutedPortal = permutedArray.PrepareForInPlace(Device(), token); functor.PermutedPortal = permutedArray.PrepareForInPlace(Device(), token);
return functor; return functor;
@ -137,14 +133,12 @@ struct OutputPermutationFunctor : vtkm::exec::FunctorBase
}; };
template <typename PermutedArrayHandleType, typename Device> template <typename PermutedArrayHandleType, typename Device>
VTKM_CONT OutputPermutationFunctor< VTKM_CONT OutputPermutationFunctor<typename PermutedArrayHandleType::WritePortalType>
typename PermutedArrayHandleType::template ExecutionTypes<Device>::Portal>
make_OutputPermutationFunctor(PermutedArrayHandleType& permutedArray, make_OutputPermutationFunctor(PermutedArrayHandleType& permutedArray,
Device, Device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
using PermutedPortalType = using PermutedPortalType = typename PermutedArrayHandleType::WritePortalType;
typename PermutedArrayHandleType::template ExecutionTypes<Device>::Portal;
OutputPermutationFunctor<PermutedPortalType> functor; OutputPermutationFunctor<PermutedPortalType> functor;
functor.PermutedPortal = permutedArray.PrepareForOutput(ARRAY_SIZE, Device(), token); functor.PermutedPortal = permutedArray.PrepareForOutput(ARRAY_SIZE, Device(), token);
return functor; return functor;

@ -146,7 +146,7 @@ struct SwizzleTests
bool operator()(DeviceTag, SwizzleHandleType& swizzle) const bool operator()(DeviceTag, SwizzleHandleType& swizzle) const
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
using Portal = typename SwizzleHandleType::template ExecutionTypes<DeviceTag>::Portal; using Portal = typename SwizzleHandleType::WritePortalType;
WriteTestFunctor<Portal> functor(swizzle.PrepareForInPlace(DeviceTag(), token)); WriteTestFunctor<Portal> functor(swizzle.PrepareForInPlace(DeviceTag(), token));
Algo::Schedule(functor, swizzle.GetNumberOfValues()); Algo::Schedule(functor, swizzle.GetNumberOfValues());
return true; return true;

@ -54,18 +54,15 @@ struct CheckTransformFunctor : vtkm::exec::FunctorBase
}; };
template <typename OriginalArrayHandleType, typename TransformedArrayHandleType, typename Device> template <typename OriginalArrayHandleType, typename TransformedArrayHandleType, typename Device>
VTKM_CONT CheckTransformFunctor< VTKM_CONT CheckTransformFunctor<typename OriginalArrayHandleType::ReadPortalType,
typename OriginalArrayHandleType::template ExecutionTypes<Device>::PortalConst, typename TransformedArrayHandleType::ReadPortalType>
typename TransformedArrayHandleType::template ExecutionTypes<Device>::PortalConst>
make_CheckTransformFunctor(const OriginalArrayHandleType& originalArray, make_CheckTransformFunctor(const OriginalArrayHandleType& originalArray,
const TransformedArrayHandleType& transformedArray, const TransformedArrayHandleType& transformedArray,
Device, Device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
using OriginalPortalType = using OriginalPortalType = typename OriginalArrayHandleType::ReadPortalType;
typename OriginalArrayHandleType::template ExecutionTypes<Device>::PortalConst; using TransformedPortalType = typename TransformedArrayHandleType::ReadPortalType;
using TransformedPortalType =
typename TransformedArrayHandleType::template ExecutionTypes<Device>::PortalConst;
CheckTransformFunctor<OriginalPortalType, TransformedPortalType> functor; CheckTransformFunctor<OriginalPortalType, TransformedPortalType> functor;
functor.OriginalPortal = originalArray.PrepareForInput(Device(), token); functor.OriginalPortal = originalArray.PrepareForInput(Device(), token);
functor.TransformedPortal = transformedArray.PrepareForInput(Device(), token); functor.TransformedPortal = transformedArray.PrepareForInput(Device(), token);

@ -272,14 +272,11 @@ private:
using VisitType = vtkm::TopologyElementTagCell; using VisitType = vtkm::TopologyElementTagCell;
using IncidentType = vtkm::TopologyElementTagPoint; using IncidentType = vtkm::TopologyElementTagPoint;
using NodePortal = typename NodeArrayHandle::template ExecutionTypes<DeviceAdapter>::PortalConst; using NodePortal = typename NodeArrayHandle::ReadPortalType;
using CellIdPortal = using CellIdPortal = typename CellIdArrayHandle::ReadPortalType;
typename CellIdArrayHandle::template ExecutionTypes<DeviceAdapter>::PortalConst; using CellSetPortal =
using CellSetPortal = typename CellSetType:: typename CellSetType::template ExecConnectivityType<VisitType, IncidentType>;
template ExecutionTypes<DeviceAdapter, VisitType, IncidentType>::ExecObjectType; using CoordsPortal = typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType;
using CoordsPortal =
typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
NodePortal Nodes; NodePortal Nodes;
CellIdPortal CellIds; CellIdPortal CellIds;

@ -39,9 +39,8 @@ private:
using AxisHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>; using AxisHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
using RectilinearType = using RectilinearType =
vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>; vtkm::cont::ArrayHandleCartesianProduct<AxisHandle, AxisHandle, AxisHandle>;
using AxisPortalType = typename AxisHandle::template ExecutionTypes<DeviceAdapter>::PortalConst; using AxisPortalType = typename AxisHandle::ReadPortalType;
using RectilinearPortalType = using RectilinearPortalType = typename RectilinearType::ReadPortalType;
typename RectilinearType::template ExecutionTypes<DeviceAdapter>::PortalConst;
public: public:
VTKM_CONT VTKM_CONT

@ -87,12 +87,10 @@ private:
using FloatVec3 = vtkm::internal::cl_uniform_bins::FloatVec3; using FloatVec3 = vtkm::internal::cl_uniform_bins::FloatVec3;
template <typename T> template <typename T>
using ArrayPortalConst = using ArrayPortalConst = typename vtkm::cont::ArrayHandle<T>::ReadPortalType;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<DeviceAdapter>::PortalConst;
using CoordsPortalType = using CoordsPortalType =
typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ExecutionTypes< typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType;
DeviceAdapter>::PortalConst;
using CellSetP2CExecType = using CellSetP2CExecType =
decltype(std::declval<CellSetType>().PrepareForInput(DeviceAdapter{}, decltype(std::declval<CellSetType>().PrepareForInput(DeviceAdapter{},

@ -28,7 +28,7 @@ class VTKM_ALWAYS_EXPORT ConnectivityExtrude
{ {
private: private:
using Int32HandleType = vtkm::cont::ArrayHandle<vtkm::Int32>; using Int32HandleType = vtkm::cont::ArrayHandle<vtkm::Int32>;
using Int32PortalType = typename Int32HandleType::template ExecutionTypes<Device>::PortalConst; using Int32PortalType = typename Int32HandleType::ReadPortalType;
public: public:
using ConnectivityPortalType = Int32PortalType; using ConnectivityPortalType = Int32PortalType;
@ -98,7 +98,7 @@ class ReverseConnectivityExtrude
{ {
private: private:
using Int32HandleType = vtkm::cont::ArrayHandle<vtkm::Int32>; using Int32HandleType = vtkm::cont::ArrayHandle<vtkm::Int32>;
using Int32PortalType = typename Int32HandleType::template ExecutionTypes<Device>::PortalConst; using Int32PortalType = typename Int32HandleType::ReadPortalType;
public: public:
using ConnectivityPortalType = Int32PortalType; using ConnectivityPortalType = Int32PortalType;

@ -33,7 +33,7 @@ class ExecutionWholeArray
public: public:
using ValueType = T; using ValueType = T;
using HandleType = vtkm::cont::ArrayHandle<T, StorageTag>; using HandleType = vtkm::cont::ArrayHandle<T, StorageTag>;
using PortalType = typename HandleType::template ExecutionTypes<DeviceAdapterTag>::Portal; using PortalType = typename HandleType::WritePortalType;
VTKM_CONT VTKM_CONT
ExecutionWholeArray() ExecutionWholeArray()
@ -97,7 +97,7 @@ class ExecutionWholeArrayConst
public: public:
using ValueType = T; using ValueType = T;
using HandleType = vtkm::cont::ArrayHandle<T, StorageTag>; using HandleType = vtkm::cont::ArrayHandle<T, StorageTag>;
using PortalType = typename HandleType::template ExecutionTypes<DeviceAdapterTag>::PortalConst; using PortalType = typename HandleType::ReadPortalType;
VTKM_CONT VTKM_CONT
ExecutionWholeArrayConst() ExecutionWholeArrayConst()

@ -31,10 +31,8 @@ class VTKM_ALWAYS_EXPORT PointLocatorSparseGrid : public vtkm::exec::PointLocato
{ {
public: public:
using CoordPortalType = using CoordPortalType =
typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::template ExecutionTypes< typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType;
DeviceAdapter>::PortalConst; using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
using IdPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
PointLocatorSparseGrid() = default; PointLocatorSparseGrid() = default;

@ -40,8 +40,7 @@ namespace
struct TestExecObject struct TestExecObject
{ {
using PortalType = using PortalType = vtkm::cont::ArrayHandle<vtkm::Id>::WritePortalType;
vtkm::cont::ArrayHandle<vtkm::Id>::ExecutionTypes<vtkm::cont::DeviceAdapterTagCuda>::Portal;
VTKM_EXEC_CONT VTKM_EXEC_CONT
TestExecObject(PortalType portal) TestExecObject(PortalType portal)

@ -36,8 +36,7 @@ struct TwoLevelUniformGridExecutionObject
template <typename T> template <typename T>
using ArrayPortalConst = using ArrayPortalConst = typename vtkm::cont::ArrayHandle<T>::ReadPortalType;
typename vtkm::cont::ArrayHandle<T>::template ExecutionTypes<Device>::PortalConst;
Grid TopLevel; Grid TopLevel;

@ -92,8 +92,7 @@ public:
class Texture2DSamplerExecutionObject class Texture2DSamplerExecutionObject
{ {
public: public:
using TextureExecPortal = using TextureExecPortal = typename TextureDataHandle::ReadPortalType;
typename TextureDataHandle::template ExecutionTypes<Device>::PortalConst;
VTKM_CONT VTKM_CONT
Texture2DSamplerExecutionObject() Texture2DSamplerExecutionObject()

@ -303,7 +303,7 @@ public:
} }
private: private:
using ColorMapPortalConst = typename ColorMapHandle::ExecutionTypes<DeviceTag>::PortalConst; using ColorMapPortalConst = typename ColorMapHandle::ReadPortalType;
VTKM_EXEC VTKM_EXEC
void TransformWorldToViewport(vtkm::Vec3f_32& point) const void TransformWorldToViewport(vtkm::Vec3f_32& point) const

@ -124,8 +124,8 @@ class LinearBVHBuilder::GatherVecCast : public vtkm::worklet::WorkletMapField
private: private:
using Vec4IdArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Id4>; using Vec4IdArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Id4>;
using Vec4IntArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Vec4i_32>; using Vec4IntArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Vec4i_32>;
using PortalConst = typename Vec4IdArrayHandle::ExecutionTypes<DeviceAdapterTag>::PortalConst; using PortalConst = typename Vec4IdArrayHandle::ReadPortalType;
using Portal = typename Vec4IntArrayHandle::ExecutionTypes<DeviceAdapterTag>::Portal; using Portal = typename Vec4IntArrayHandle::WritePortalType;
private: private:
PortalConst InputPortal; PortalConst InputPortal;

@ -147,9 +147,9 @@ class CylinderLeafIntersector
{ {
public: public:
using IdHandle = vtkm::cont::ArrayHandle<vtkm::Id3>; using IdHandle = vtkm::cont::ArrayHandle<vtkm::Id3>;
using IdArrayPortal = typename IdHandle::ExecutionTypes<Device>::PortalConst; using IdArrayPortal = typename IdHandle::ReadPortalType;
using FloatHandle = vtkm::cont::ArrayHandle<vtkm::Float32>; using FloatHandle = vtkm::cont::ArrayHandle<vtkm::Float32>;
using FloatPortal = typename FloatHandle::ExecutionTypes<Device>::PortalConst; using FloatPortal = typename FloatHandle::ReadPortalType;
IdArrayPortal CylIds; IdArrayPortal CylIds;
FloatPortal Radii; FloatPortal Radii;

@ -158,8 +158,8 @@ class VTKM_ALWAYS_EXPORT MeshConnUnstructured : public MeshConnectivityBase
protected: protected:
using IdHandle = typename vtkm::cont::ArrayHandle<vtkm::Id>; using IdHandle = typename vtkm::cont::ArrayHandle<vtkm::Id>;
using UCharHandle = typename vtkm::cont::ArrayHandle<vtkm::UInt8>; using UCharHandle = typename vtkm::cont::ArrayHandle<vtkm::UInt8>;
using IdConstPortal = typename IdHandle::ExecutionTypes<Device>::PortalConst; using IdConstPortal = typename IdHandle::ReadPortalType;
using UCharConstPortal = typename UCharHandle::ExecutionTypes<Device>::PortalConst; using UCharConstPortal = typename UCharHandle::ReadPortalType;
// Constant Portals for the execution Environment // Constant Portals for the execution Environment
//FaceConn //FaceConn
@ -230,10 +230,10 @@ class MeshConnSingleType : public MeshConnectivityBase
{ {
protected: protected:
using IdHandle = typename vtkm::cont::ArrayHandle<vtkm::Id>; using IdHandle = typename vtkm::cont::ArrayHandle<vtkm::Id>;
using IdConstPortal = typename IdHandle::ExecutionTypes<Device>::PortalConst; using IdConstPortal = typename IdHandle::ReadPortalType;
using CountingHandle = typename vtkm::cont::ArrayHandleCounting<vtkm::Id>; using CountingHandle = typename vtkm::cont::ArrayHandleCounting<vtkm::Id>;
using CountingPortal = typename CountingHandle::ExecutionTypes<Device>::PortalConst; using CountingPortal = typename CountingHandle::ReadPortalType;
// Constant Portals for the execution Environment // Constant Portals for the execution Environment
IdConstPortal FaceConnPortal; IdConstPortal FaceConnPortal;
IdConstPortal CellConnectivityPortal; IdConstPortal CellConnectivityPortal;

@ -104,7 +104,7 @@ class QuadLeafIntersector
public: public:
using IdType = vtkm::Vec<vtkm::Id, 5>; using IdType = vtkm::Vec<vtkm::Id, 5>;
using IdHandle = vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 5>>; using IdHandle = vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 5>>;
using IdArrayPortal = typename IdHandle::ExecutionTypes<Device>::PortalConst; using IdArrayPortal = typename IdHandle::ReadPortalType;
IdArrayPortal QuadIds; IdArrayPortal QuadIds;
QuadLeafIntersector() {} QuadLeafIntersector() {}

@ -125,9 +125,9 @@ class SphereLeafIntersector
{ {
public: public:
using IdHandle = vtkm::cont::ArrayHandle<vtkm::Id>; using IdHandle = vtkm::cont::ArrayHandle<vtkm::Id>;
using IdArrayPortal = typename IdHandle::ExecutionTypes<Device>::PortalConst; using IdArrayPortal = typename IdHandle::ReadPortalType;
using FloatHandle = vtkm::cont::ArrayHandle<vtkm::Float32>; using FloatHandle = vtkm::cont::ArrayHandle<vtkm::Float32>;
using FloatPortal = typename FloatHandle::ExecutionTypes<Device>::PortalConst; using FloatPortal = typename FloatHandle::ReadPortalType;
IdArrayPortal PointIds; IdArrayPortal PointIds;
FloatPortal Radii; FloatPortal Radii;

@ -34,7 +34,7 @@ class WaterTightLeafIntersector
{ {
public: public:
using Id4Handle = vtkm::cont::ArrayHandle<vtkm::Id4>; using Id4Handle = vtkm::cont::ArrayHandle<vtkm::Id4>;
using Id4ArrayPortal = typename Id4Handle::ExecutionTypes<Device>::PortalConst; using Id4ArrayPortal = typename Id4Handle::ReadPortalType;
Id4ArrayPortal Triangles; Id4ArrayPortal Triangles;
public: public:
@ -87,7 +87,7 @@ class MollerTriLeafIntersector
//protected: //protected:
public: public:
using Id4Handle = vtkm::cont::ArrayHandle<vtkm::Id4>; using Id4Handle = vtkm::cont::ArrayHandle<vtkm::Id4>;
using Id4ArrayPortal = typename Id4Handle::ExecutionTypes<Device>::PortalConst; using Id4ArrayPortal = typename Id4Handle::ReadPortalType;
Id4ArrayPortal Triangles; Id4ArrayPortal Triangles;
public: public:

@ -44,8 +44,8 @@ protected:
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>; using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
using CartesianArrayHandle = using CartesianArrayHandle =
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>; vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
using DefaultConstHandle = typename DefaultHandle::ExecutionTypes<Device>::PortalConst; using DefaultConstHandle = typename DefaultHandle::ReadPortalType;
using CartesianConstPortal = typename CartesianArrayHandle::ExecutionTypes<Device>::PortalConst; using CartesianConstPortal = typename CartesianArrayHandle::ReadPortalType;
DefaultConstHandle CoordPortals[3]; DefaultConstHandle CoordPortals[3];
CartesianConstPortal Coordinates; CartesianConstPortal Coordinates;
@ -187,7 +187,7 @@ class UniformLocator
{ {
protected: protected:
using UniformArrayHandle = vtkm::cont::ArrayHandleUniformPointCoordinates; using UniformArrayHandle = vtkm::cont::ArrayHandleUniformPointCoordinates;
using UniformConstPortal = typename UniformArrayHandle::ExecutionTypes<Device>::PortalConst; using UniformConstPortal = typename UniformArrayHandle::ReadPortalType;
vtkm::Id3 PointDimensions; vtkm::Id3 PointDimensions;
vtkm::Vec3f_32 Origin; vtkm::Vec3f_32 Origin;
@ -298,7 +298,7 @@ class Sampler : public vtkm::worklet::WorkletMapField
{ {
private: private:
using ColorArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Vec4f_32>; using ColorArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Vec4f_32>;
using ColorArrayPortal = typename ColorArrayHandle::ExecutionTypes<DeviceAdapterTag>::PortalConst; using ColorArrayPortal = typename ColorArrayHandle::ReadPortalType;
ColorArrayPortal ColorMap; ColorArrayPortal ColorMap;
vtkm::Id ColorMapSize; vtkm::Id ColorMapSize;
vtkm::Float32 MinScalar; vtkm::Float32 MinScalar;
@ -495,7 +495,7 @@ class SamplerCellAssoc : public vtkm::worklet::WorkletMapField
{ {
private: private:
using ColorArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Vec4f_32>; using ColorArrayHandle = typename vtkm::cont::ArrayHandle<vtkm::Vec4f_32>;
using ColorArrayPortal = typename ColorArrayHandle::ExecutionTypes<DeviceAdapterTag>::PortalConst; using ColorArrayPortal = typename ColorArrayHandle::ReadPortalType;
ColorArrayPortal ColorMap; ColorArrayPortal ColorMap;
vtkm::Id ColorMapSize; vtkm::Id ColorMapSize;
vtkm::Float32 MinScalar; vtkm::Float32 MinScalar;

@ -123,12 +123,9 @@ template <typename Device>
class ExecutionConnectivityExplicit class ExecutionConnectivityExplicit
{ {
private: private:
using UInt8Portal = using UInt8Portal = typename vtkm::cont::ArrayHandle<vtkm::UInt8>::WritePortalType;
typename vtkm::cont::ArrayHandle<vtkm::UInt8>::template ExecutionTypes<Device>::Portal; using IdComponentPortal = typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::WritePortalType;
using IdComponentPortal = using IdPortal = typename vtkm::cont::ArrayHandle<vtkm::Id>::WritePortalType;
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::template ExecutionTypes<Device>::Portal;
using IdPortal =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::Portal;
public: public:
VTKM_CONT VTKM_CONT

@ -66,30 +66,27 @@ public:
VTKM_CONT VTKM_CONT
vtkm::Id GetNumberOfValues() const { return this->SortedValuesMap.GetNumberOfValues(); } vtkm::Id GetNumberOfValues() const { return this->SortedValuesMap.GetNumberOfValues(); }
template <typename Device> using ExecLookup = vtkm::exec::internal::ReduceByKeyLookupBase<
struct ExecutionTypes typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType,
{ typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType>;
using IdPortal =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::PortalConst;
using IdComponentPortal = typename vtkm::cont::ArrayHandle<
vtkm::IdComponent>::template ExecutionTypes<Device>::PortalConst;
using Lookup = vtkm::exec::internal::ReduceByKeyLookupBase<IdPortal, IdComponentPortal>; template <typename Device>
struct VTKM_DEPRECATED(1.6, "Use ExecLookup.") ExecutionTypes
{
using Lookup = ExecLookup;
}; };
template <typename Device> VTKM_CONT ExecLookup PrepareForInput(vtkm::cont::DeviceAdapterId device,
VTKM_CONT typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return return ExecLookup(this->SortedValuesMap.PrepareForInput(device, token),
typename ExecutionTypes<Device>::Lookup(this->SortedValuesMap.PrepareForInput(device, token), this->Offsets.PrepareForInput(device, token),
this->Offsets.PrepareForInput(device, token), this->Counts.PrepareForInput(device, token));
this->Counts.PrepareForInput(device, token));
} }
template <typename Device> VTKM_CONT VTKM_DEPRECATED(1.6,
VTKM_CONT VTKM_DEPRECATED(1.6, "PrepareForInput now requires a vtkm::cont::Token object.") "PrepareForInput now requires a vtkm::cont::Token object.") ExecLookup
typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device) const PrepareForInput(vtkm::cont::DeviceAdapterId device) const
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
return this->PrepareForInput(device, token); return this->PrepareForInput(device, token);
@ -191,32 +188,29 @@ public:
VTKM_CONT VTKM_CONT
KeyArrayHandleType GetUniqueKeys() const { return this->UniqueKeys; } KeyArrayHandleType GetUniqueKeys() const { return this->UniqueKeys; }
template <typename Device> using ExecLookup = vtkm::exec::internal::ReduceByKeyLookup<
struct ExecutionTypes typename KeyArrayHandleType::ReadPortalType,
{ typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType,
using KeyPortal = typename KeyArrayHandleType::template ExecutionTypes<Device>::PortalConst; typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType>;
using IdPortal =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::PortalConst;
using IdComponentPortal = typename vtkm::cont::ArrayHandle<
vtkm::IdComponent>::template ExecutionTypes<Device>::PortalConst;
using Lookup = vtkm::exec::internal::ReduceByKeyLookup<KeyPortal, IdPortal, IdComponentPortal>; template <typename Device>
struct VTKM_DEPRECATED(1.6, "Use ExecLookup.") ExecutionTypes
{
using Lookup = ExecLookup;
}; };
template <typename Device> VTKM_CONT ExecLookup PrepareForInput(vtkm::cont::DeviceAdapterId device,
VTKM_CONT typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return return ExecLookup(this->UniqueKeys.PrepareForInput(device, token),
typename ExecutionTypes<Device>::Lookup(this->UniqueKeys.PrepareForInput(device, token), this->SortedValuesMap.PrepareForInput(device, token),
this->SortedValuesMap.PrepareForInput(device, token), this->Offsets.PrepareForInput(device, token),
this->Offsets.PrepareForInput(device, token), this->Counts.PrepareForInput(device, token));
this->Counts.PrepareForInput(device, token));
} }
template <typename Device> VTKM_CONT VTKM_DEPRECATED(1.6,
VTKM_CONT VTKM_DEPRECATED(1.6, "PrepareForInput now requires a vtkm::cont::Token object.") "PrepareForInput now requires a vtkm::cont::Token object.") ExecLookup
typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device) const PrepareForInput(vtkm::cont::DeviceAdapterId device) const
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
return this->PrepareForInput(device, token); return this->PrepareForInput(device, token);
@ -304,7 +298,7 @@ template <typename KeyType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagKeysIn, KeyType, Device> struct Transport<vtkm::cont::arg::TransportTagKeysIn, KeyType, Device>
{ {
using ContObjectType = KeyType; using ContObjectType = KeyType;
using ExecObjectType = typename ContObjectType::template ExecutionTypes<Device>::Lookup; using ExecObjectType = typename ContObjectType::ExecLookup;
VTKM_CONT VTKM_CONT
ExecObjectType operator()(const ContObjectType& object, ExecObjectType operator()(const ContObjectType& object,
@ -339,7 +333,7 @@ struct Transport<vtkm::cont::arg::TransportTagKeyedValuesIn, ArrayHandleType, De
using PermutedArrayType = vtkm::cont::ArrayHandlePermutation<IdArrayType, ContObjectType>; using PermutedArrayType = vtkm::cont::ArrayHandlePermutation<IdArrayType, ContObjectType>;
using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable<PermutedArrayType, IdArrayType>; using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable<PermutedArrayType, IdArrayType>;
using ExecObjectType = typename GroupedArrayType::template ExecutionTypes<Device>::PortalConst; using ExecObjectType = typename GroupedArrayType::ReadPortalType;
VTKM_CONT ExecObjectType operator()(const ContObjectType& object, VTKM_CONT ExecObjectType operator()(const ContObjectType& object,
const vtkm::worklet::internal::KeysBase& keys, const vtkm::worklet::internal::KeysBase& keys,
@ -374,7 +368,7 @@ struct Transport<vtkm::cont::arg::TransportTagKeyedValuesInOut, ArrayHandleType,
using PermutedArrayType = vtkm::cont::ArrayHandlePermutation<IdArrayType, ContObjectType>; using PermutedArrayType = vtkm::cont::ArrayHandlePermutation<IdArrayType, ContObjectType>;
using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable<PermutedArrayType, IdArrayType>; using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable<PermutedArrayType, IdArrayType>;
using ExecObjectType = typename GroupedArrayType::template ExecutionTypes<Device>::Portal; using ExecObjectType = typename GroupedArrayType::WritePortalType;
VTKM_CONT ExecObjectType operator()(ContObjectType object, VTKM_CONT ExecObjectType operator()(ContObjectType object,
const vtkm::worklet::internal::KeysBase& keys, const vtkm::worklet::internal::KeysBase& keys,
@ -409,7 +403,7 @@ struct Transport<vtkm::cont::arg::TransportTagKeyedValuesOut, ArrayHandleType, D
using PermutedArrayType = vtkm::cont::ArrayHandlePermutation<IdArrayType, ContObjectType>; using PermutedArrayType = vtkm::cont::ArrayHandlePermutation<IdArrayType, ContObjectType>;
using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable<PermutedArrayType, IdArrayType>; using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable<PermutedArrayType, IdArrayType>;
using ExecObjectType = typename GroupedArrayType::template ExecutionTypes<Device>::Portal; using ExecObjectType = typename GroupedArrayType::WritePortalType;
VTKM_CONT ExecObjectType operator()(ContObjectType object, VTKM_CONT ExecObjectType operator()(ContObjectType object,
const vtkm::worklet::internal::KeysBase& keys, const vtkm::worklet::internal::KeysBase& keys,

@ -76,8 +76,9 @@ struct StableSortIndices
} }
template <typename Device> template <typename Device>
IndirectSortPredicate<typename KeyArrayType::template ExecutionTypes<Device>::PortalConst> IndirectSortPredicate<typename KeyArrayType::ReadPortalType> PrepareForExecution(
PrepareForExecution(Device, vtkm::cont::Token& token) const Device,
vtkm::cont::Token& token) const
{ {
auto keyPortal = this->KeyArray.PrepareForInput(Device(), token); auto keyPortal = this->KeyArray.PrepareForInput(Device(), token);
return IndirectSortPredicate<decltype(keyPortal)>(keyPortal); return IndirectSortPredicate<decltype(keyPortal)>(keyPortal);
@ -115,8 +116,9 @@ struct StableSortIndices
} }
template <typename Device> template <typename Device>
IndirectUniquePredicate<typename KeyArrayType::template ExecutionTypes<Device>::PortalConst> IndirectUniquePredicate<typename KeyArrayType::ReadPortalType> PrepareForExecution(
PrepareForExecution(Device, vtkm::cont::Token& token) const Device,
vtkm::cont::Token& token) const
{ {
auto keyPortal = this->KeyArray.PrepareForInput(Device(), token); auto keyPortal = this->KeyArray.PrepareForInput(Device(), token);
return IndirectUniquePredicate<decltype(keyPortal)>(keyPortal); return IndirectUniquePredicate<decltype(keyPortal)>(keyPortal);

@ -2511,12 +2511,9 @@ public:
} }
private: private:
typename vtkm::cont::ArrayHandle<vtkm::UInt8>::ExecutionTypes<DeviceAdapter>::PortalConst typename vtkm::cont::ArrayHandle<vtkm::UInt8>::ReadPortalType ClipTablesDataPortal;
ClipTablesDataPortal; typename vtkm::cont::ArrayHandle<vtkm::UInt16>::ReadPortalType ClipTablesIndicesPortal;
typename vtkm::cont::ArrayHandle<vtkm::UInt16>::ExecutionTypes<DeviceAdapter>::PortalConst typename vtkm::cont::ArrayHandle<vtkm::UInt8>::ReadPortalType CellEdgesPortal;
ClipTablesIndicesPortal;
typename vtkm::cont::ArrayHandle<vtkm::UInt8>::ExecutionTypes<DeviceAdapter>::PortalConst
CellEdgesPortal;
friend class ClipTables; friend class ClipTables;
}; };

@ -495,11 +495,9 @@ public:
} }
private: private:
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType NumVerticesPerCellPortal;
NumVerticesPerCellPortal; typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType NumTrianglesTablePortal;
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType
NumTrianglesTablePortal;
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst
NumTrianglesTableOffsetPortal; NumTrianglesTableOffsetPortal;
friend class CellClassifyTable; friend class CellClassifyTable;
@ -580,14 +578,10 @@ public:
} }
private: private:
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType EdgeTablePortal;
EdgeTablePortal; typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType EdgeTableOffsetPortal;
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType TriangleTablePortal;
EdgeTableOffsetPortal; typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType TriangleTableOffsetPortal;
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst
TriangleTablePortal;
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ExecutionTypes<DeviceAdapter>::PortalConst
TriangleTableOffsetPortal;
friend class TriangleGenerationTable; friend class TriangleGenerationTable;
}; };

@ -119,18 +119,12 @@ public:
class EdgeWeightGenerateMetaData : vtkm::cont::ExecutionObjectBase class EdgeWeightGenerateMetaData : vtkm::cont::ExecutionObjectBase
{ {
public: public:
template <typename DeviceAdapter>
class ExecObject class ExecObject
{ {
template <typename FieldType> template <typename FieldType>
struct PortalTypes using ReadPortalType = typename vtkm::cont::ArrayHandle<FieldType>::ReadPortalType;
{ template <typename FieldType>
using HandleType = vtkm::cont::ArrayHandle<FieldType>; using WritePortalType = typename vtkm::cont::ArrayHandle<FieldType>::WritePortalType;
using ExecutionTypes = typename HandleType::template ExecutionTypes<DeviceAdapter>;
using Portal = typename ExecutionTypes::Portal;
using PortalConst = typename ExecutionTypes::PortalConst;
};
public: public:
ExecObject() = default; ExecObject() = default;
@ -141,19 +135,20 @@ public:
vtkm::cont::ArrayHandle<vtkm::Id2>& interpIds, vtkm::cont::ArrayHandle<vtkm::Id2>& interpIds,
vtkm::cont::ArrayHandle<vtkm::Id>& interpCellIds, vtkm::cont::ArrayHandle<vtkm::Id>& interpCellIds,
vtkm::cont::ArrayHandle<vtkm::UInt8>& interpContourId, vtkm::cont::ArrayHandle<vtkm::UInt8>& interpContourId,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: InterpWeightsPortal(interpWeights.PrepareForOutput(3 * size, DeviceAdapter(), token)) : InterpWeightsPortal(interpWeights.PrepareForOutput(3 * size, device, token))
, InterpIdPortal(interpIds.PrepareForOutput(3 * size, DeviceAdapter(), token)) , InterpIdPortal(interpIds.PrepareForOutput(3 * size, device, token))
, InterpCellIdPortal(interpCellIds.PrepareForOutput(3 * size, DeviceAdapter(), token)) , InterpCellIdPortal(interpCellIds.PrepareForOutput(3 * size, device, token))
, InterpContourPortal(interpContourId.PrepareForOutput(3 * size, DeviceAdapter(), token)) , InterpContourPortal(interpContourId.PrepareForOutput(3 * size, device, token))
{ {
// Interp needs to be 3 times longer than size as they are per point of the // Interp needs to be 3 times longer than size as they are per point of the
// output triangle // output triangle
} }
typename PortalTypes<vtkm::FloatDefault>::Portal InterpWeightsPortal; WritePortalType<vtkm::FloatDefault> InterpWeightsPortal;
typename PortalTypes<vtkm::Id2>::Portal InterpIdPortal; WritePortalType<vtkm::Id2> InterpIdPortal;
typename PortalTypes<vtkm::Id>::Portal InterpCellIdPortal; WritePortalType<vtkm::Id> InterpCellIdPortal;
typename PortalTypes<vtkm::UInt8>::Portal InterpContourPortal; WritePortalType<vtkm::UInt8> InterpContourPortal;
}; };
VTKM_CONT VTKM_CONT
@ -170,15 +165,16 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT ExecObject PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT ExecObject<DeviceAdapter> PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
return ExecObject<DeviceAdapter>(this->Size, return ExecObject(this->Size,
this->InterpWeights, this->InterpWeights,
this->InterpIds, this->InterpIds,
this->InterpCellIds, this->InterpCellIds,
this->InterpContourId, this->InterpContourId,
token); device,
token);
} }
private: private:
@ -220,12 +216,11 @@ public:
typename FieldInType, // Vec-like, one per input point typename FieldInType, // Vec-like, one per input point
typename ClassifyTableType, typename ClassifyTableType,
typename TriTableType, typename TriTableType,
typename IndicesVecType, typename IndicesVecType>
typename DeviceAdapter>
VTKM_EXEC void operator()(const CellShape shape, VTKM_EXEC void operator()(const CellShape shape,
const IsoValuesType& isovalues, const IsoValuesType& isovalues,
const FieldInType& fieldIn, // Input point field defining the contour const FieldInType& fieldIn, // Input point field defining the contour
const EdgeWeightGenerateMetaData::ExecObject<DeviceAdapter>& metaData, const EdgeWeightGenerateMetaData::ExecObject& metaData,
const ClassifyTableType& classifyTable, const ClassifyTableType& classifyTable,
const TriTableType& triTable, const TriTableType& triTable,
vtkm::Id inputCellId, vtkm::Id inputCellId,

@ -113,13 +113,11 @@ public:
IdArrayType ArcArray; IdArrayType ArcArray;
bool IsJoinGraph; bool IsJoinGraph;
template <typename DeviceAdapter>
class ExecObject class ExecObject
{ {
public: public:
using ValuePortalType = using ValuePortalType = typename ValueArrayType::ReadPortalType;
typename ValueArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst; using IdPortalType = typename IdArrayType::ReadPortalType;
using IdPortalType = typename IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
VTKM_CONT VTKM_CONT
ExecObject(ValuePortalType values, ExecObject(ValuePortalType values,
@ -178,16 +176,15 @@ public:
} }
}; };
template <typename DeviceAdapter> VTKM_CONT ExecObject PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT ExecObject<DeviceAdapter> PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return ExecObject<DeviceAdapter>(this->Values.PrepareForInput(DeviceAdapter(), token), return ExecObject(this->Values.PrepareForInput(device, token),
this->ValueIndex.PrepareForInput(DeviceAdapter(), token), this->ValueIndex.PrepareForInput(device, token),
this->EdgeFar.PrepareForInput(DeviceAdapter(), token), this->EdgeFar.PrepareForInput(device, token),
this->EdgeNear.PrepareForInput(DeviceAdapter(), token), this->EdgeNear.PrepareForInput(device, token),
this->ArcArray.PrepareForInput(DeviceAdapter(), token), this->ArcArray.PrepareForInput(device, token),
this->IsJoinGraph); this->IsJoinGraph);
} }
}; // EdgePeakComparator }; // EdgePeakComparator
} }

@ -107,13 +107,11 @@ public:
{ {
} }
template <typename DeviceAdapter>
class ExecObject class ExecObject
{ {
public: public:
using ValuePortalType = using ValuePortalType = typename ValueArrayType::ReadPortalType;
typename ValueArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst; using IdPortalType = typename IdArrayType::ReadPortalType;
using IdPortalType = typename IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
ValuePortalType Values; ValuePortalType Values;
IdPortalType Extrema; IdPortalType Extrema;
@ -162,13 +160,12 @@ public:
} }
}; };
template <typename DeviceAdapter> VTKM_CONT ExecObject PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT ExecObject<DeviceAdapter> PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return ExecObject<DeviceAdapter>(this->Values.PrepareForInput(DeviceAdapter(), token), return ExecObject(this->Values.PrepareForInput(device, token),
this->Extrema.PrepareForInput(DeviceAdapter(), token), this->Extrema.PrepareForInput(device, token),
this->IsJoinTree); this->IsJoinTree);
} }
}; // VertexMergeComparator }; // VertexMergeComparator
} }

@ -793,7 +793,7 @@ struct LeafChainsToContourTree
inline bool operator()(DeviceAdapter device, Args&&... args) const inline bool operator()(DeviceAdapter device, Args&&... args) const
{ {
vtkm::cont::Token token; vtkm::cont::Token token;
contourtree_maker_inc_ns::TransferLeafChains_TransferToContourTree<DeviceAdapter> worklet( contourtree_maker_inc_ns::TransferLeafChains_TransferToContourTree worklet(
this->NumIterations, // (input) this->NumIterations, // (input)
this->IsJoin, // (input) this->IsJoin, // (input)
this->Outdegree, // (input) this->Outdegree, // (input)
@ -801,6 +801,7 @@ struct LeafChainsToContourTree
this->Outbound, // (input) this->Outbound, // (input)
this->Inbound, // (input) this->Inbound, // (input)
this->Inwards, // (input) this->Inwards, // (input)
device,
token); token);
vtkm::worklet::DispatcherMapField<decltype(worklet)> dispatcher(worklet); vtkm::worklet::DispatcherMapField<decltype(worklet)> dispatcher(worklet);
dispatcher.SetDevice(device); dispatcher.SetDevice(device);
@ -894,6 +895,10 @@ inline void ContourTreeMaker::TransferLeafChains(bool isJoin)
// loop through the active vertices // loop through the active vertices
// Note: there are better and safer ways to pass these arrays (e.g. in/outdegree) to
// a worklet. You could pass them as WholeArrayIn ControlSignature arguments. Or
// you could build a subclass of vtkm::cont::ExecutionObjectBase and pass that in
// as an ExecObject.
details::LeafChainsToContourTree task(this->ContourTreeResult.NumIterations, // (input) details::LeafChainsToContourTree task(this->ContourTreeResult.NumIterations, // (input)
isJoin, // (input) isJoin, // (input)
outdegree, // (input) outdegree, // (input)

@ -68,23 +68,22 @@ namespace active_graph_inc
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class EdgePeakComparatorImpl class EdgePeakComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
EdgePeakComparatorImpl(const IdArrayType& edgeFar, EdgePeakComparatorImpl(const IdArrayType& edgeFar,
const IdArrayType& edgeNear, const IdArrayType& edgeNear,
bool joinGraph, bool joinGraph,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: IsJoinGraph(joinGraph) : IsJoinGraph(joinGraph)
{ // constructor { // constructor
this->EdgeFarPortal = edgeFar.PrepareForInput(DeviceAdapter(), token); this->EdgeFarPortal = edgeFar.PrepareForInput(device, token);
this->EdgeNearPortal = edgeNear.PrepareForInput(DeviceAdapter(), token); this->EdgeNearPortal = edgeNear.PrepareForInput(device, token);
} // constructor } // constructor
// () operator - gets called to do comparison // () operator - gets called to do comparison
@ -151,13 +150,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT EdgePeakComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT EdgePeakComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter,
vtkm::cont::Token& token) const
{ {
return EdgePeakComparatorImpl<DeviceAdapter>( return EdgePeakComparatorImpl(this->EdgeFar, this->EdgeNear, this->JoinGraph, device, token);
this->EdgeFar, this->EdgeNear, this->JoinGraph, token);
} }
private: private:

@ -68,12 +68,10 @@ namespace active_graph_inc
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class HyperArcSuperNodeComparatorImpl class HyperArcSuperNodeComparatorImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = typename IdArrayType::ReadPortalType;
typename IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
@ -132,15 +130,12 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT HyperArcSuperNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT HyperArcSuperNodeComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return HyperArcSuperNodeComparatorImpl<DeviceAdapter>( return HyperArcSuperNodeComparatorImpl(this->Hyperparents.PrepareForInput(device, token),
this->Hyperparents.PrepareForInput(device, token), this->SuperID.PrepareForInput(device, token),
this->SuperID.PrepareForInput(device, token), this->IsJoinTree);
this->IsJoinTree);
} }
private: private:

@ -69,21 +69,20 @@ namespace active_graph_inc
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class SuperArcNodeComparatorImpl class SuperArcNodeComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
SuperArcNodeComparatorImpl(const IdArrayType& superparents, SuperArcNodeComparatorImpl(const IdArrayType& superparents,
bool joinSweep, bool joinSweep,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: IsJoinSweep(joinSweep) : IsJoinSweep(joinSweep)
{ // constructor { // constructor
SuperparentsPortal = superparents.PrepareForInput(DeviceAdapter(), token); SuperparentsPortal = superparents.PrepareForInput(device, token);
} // constructor } // constructor
// () operator - gets called to do comparison // () operator - gets called to do comparison
@ -128,12 +127,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT SuperArcNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT SuperArcNodeComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter,
vtkm::cont::Token& token) const
{ {
return SuperArcNodeComparatorImpl<DeviceAdapter>(this->Superparents, this->JoinSweep, token); return SuperArcNodeComparatorImpl(this->Superparents, this->JoinSweep, device, token);
} }
private: private:

@ -68,12 +68,10 @@ namespace contourtree_maker_inc
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class ContourTreeNodeComparatorImpl class ContourTreeNodeComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
IdPortalType SuperparentsPortal; IdPortalType SuperparentsPortal;
IdPortalType SuperarcsPortal; IdPortalType SuperarcsPortal;
@ -82,10 +80,11 @@ public:
VTKM_CONT VTKM_CONT
ContourTreeNodeComparatorImpl(const IdArrayType& superparents, ContourTreeNodeComparatorImpl(const IdArrayType& superparents,
const IdArrayType& superarcs, const IdArrayType& superarcs,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
this->SuperparentsPortal = superparents.PrepareForInput(DeviceAdapter(), token); this->SuperparentsPortal = superparents.PrepareForInput(device, token);
this->SuperarcsPortal = superarcs.PrepareForInput(DeviceAdapter(), token); this->SuperarcsPortal = superarcs.PrepareForInput(device, token);
} }
// () operator - gets called to do comparison // () operator - gets called to do comparison
@ -123,12 +122,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT ContourTreeNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT ContourTreeNodeComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token)
DeviceAdapter,
vtkm::cont::Token& token)
{ {
return ContourTreeNodeComparatorImpl<DeviceAdapter>(this->Superparents, this->Superarcs, token); return ContourTreeNodeComparatorImpl(this->Superparents, this->Superarcs, device, token);
} }
private: private:

@ -68,12 +68,10 @@ namespace contourtree_maker_inc
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class ContourTreeSuperNodeComparatorImpl class ContourTreeSuperNodeComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
IdPortalType HyperparentsPortal; IdPortalType HyperparentsPortal;
IdPortalType SupernodesPortal; IdPortalType SupernodesPortal;
@ -84,11 +82,12 @@ public:
ContourTreeSuperNodeComparatorImpl(const IdArrayType& hyperparents, ContourTreeSuperNodeComparatorImpl(const IdArrayType& hyperparents,
const IdArrayType& supernodes, const IdArrayType& supernodes,
const IdArrayType& whenTransferred, const IdArrayType& whenTransferred,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
this->HyperparentsPortal = hyperparents.PrepareForInput(DeviceAdapter(), token); this->HyperparentsPortal = hyperparents.PrepareForInput(device, token);
this->SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter(), token); this->SupernodesPortal = supernodes.PrepareForInput(device, token);
this->WhenTransferredPortal = whenTransferred.PrepareForInput(DeviceAdapter(), token); this->WhenTransferredPortal = whenTransferred.PrepareForInput(device, token);
} }
// () operator - gets called to do comparison // () operator - gets called to do comparison
@ -138,13 +137,11 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT ContourTreeSuperNodeComparatorImpl
VTKM_CONT ContourTreeSuperNodeComparatorImpl<DeviceAdapter> PrepareForExecution( PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token)
DeviceAdapter,
vtkm::cont::Token& token)
{ {
return ContourTreeSuperNodeComparatorImpl<DeviceAdapter>( return ContourTreeSuperNodeComparatorImpl(
this->Hyperparents, this->Supernodes, this->WhenTransferred, token); this->Hyperparents, this->Supernodes, this->WhenTransferred, device, token);
} }
private: private:

@ -75,7 +75,6 @@ namespace contourtree_maker_inc
// ii. we use inwards as the superarc // ii. we use inwards as the superarc
// c. for all other vertics // c. for all other vertics
// ignore // ignore
template <typename DeviceAdapter>
class TransferLeafChains_TransferToContourTree : public vtkm::worklet::WorkletMapField class TransferLeafChains_TransferToContourTree : public vtkm::worklet::WorkletMapField
{ {
public: public:
@ -90,8 +89,7 @@ public:
using InputDomain = _1; using InputDomain = _1;
// vtkm only allows 9 parameters for the operator so we need to do these inputs manually via the constructor // vtkm only allows 9 parameters for the operator so we need to do these inputs manually via the constructor
using IdPortalType = using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
IdPortalType OutdegreePortal; IdPortalType OutdegreePortal;
IdPortalType IndegreePortal; IdPortalType IndegreePortal;
IdPortalType OutboundPortal; IdPortalType OutboundPortal;
@ -109,15 +107,16 @@ public:
const IdArrayType& outbound, const IdArrayType& outbound,
const IdArrayType& inbound, const IdArrayType& inbound,
const IdArrayType& inwards, const IdArrayType& inwards,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: NumIterations(nIterations) : NumIterations(nIterations)
, isJoin(IsJoin) , isJoin(IsJoin)
{ {
this->OutdegreePortal = outdegree.PrepareForInput(DeviceAdapter(), token); this->OutdegreePortal = outdegree.PrepareForInput(device, token);
this->IndegreePortal = indegree.PrepareForInput(DeviceAdapter(), token); this->IndegreePortal = indegree.PrepareForInput(device, token);
this->OutboundPortal = outbound.PrepareForInput(DeviceAdapter(), token); this->OutboundPortal = outbound.PrepareForInput(device, token);
this->InboundPortal = inbound.PrepareForInput(DeviceAdapter(), token); this->InboundPortal = inbound.PrepareForInput(device, token);
this->InwardsPortal = inwards.PrepareForInput(DeviceAdapter(), token); this->InwardsPortal = inwards.PrepareForInput(device, token);
} }

@ -65,7 +65,6 @@ namespace data_set_mesh
{ {
// Worklet for computing the sort indices from the sort order // Worklet for computing the sort indices from the sort order
template <typename DeviceAdapter>
class MeshStructure2D class MeshStructure2D
{ {
public: public:

@ -65,7 +65,6 @@ namespace data_set_mesh
{ {
// Worklet for computing the sort indices from the sort order // Worklet for computing the sort indices from the sort order
template <typename DeviceAdapter>
class MeshStructure3D class MeshStructure3D
{ {
public: public:

@ -67,12 +67,11 @@ namespace mesh_dem
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename T, typename StorageType, typename DeviceAdapter> template <typename T, typename StorageType>
class SimulatedSimplicityIndexComparatorImpl class SimulatedSimplicityIndexComparatorImpl
{ {
public: public:
using ValuePortalType = typename vtkm::cont::ArrayHandle<T, StorageType>::template ExecutionTypes< using ValuePortalType = typename vtkm::cont::ArrayHandle<T, StorageType>::ReadPortalType;
DeviceAdapter>::PortalConst;
ValuePortalType values; ValuePortalType values;
@ -113,11 +112,11 @@ public:
{ // constructor { // constructor
} // constructor } // constructor
template <typename DeviceAdapter> VTKM_CONT SimulatedSimplicityIndexComparatorImpl<T, StorageType> PrepareForExecution(
VTKM_CONT SimulatedSimplicityIndexComparatorImpl<T, StorageType, DeviceAdapter> vtkm::cont::DeviceAdapterId device,
PrepareForExecution(DeviceAdapter device, vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return SimulatedSimplicityIndexComparatorImpl<T, StorageType, DeviceAdapter>( return SimulatedSimplicityIndexComparatorImpl<T, StorageType>(
this->Values.PrepareForInput(device, token)); this->Values.PrepareForInput(device, token));
} }

@ -67,10 +67,10 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <vtkm/Types.h> #include <vtkm/Types.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandlePermutation.h> #include <vtkm/cont/ArrayHandlePermutation.h>
#include <vtkm/cont/ArrayPortalToIterators.h> #include <vtkm/cont/ArrayPortalToIterators.h>
#include <vtkm/cont/ArrayRangeCompute.h> #include <vtkm/cont/ArrayRangeCompute.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/EnvironmentTracker.h> #include <vtkm/cont/EnvironmentTracker.h>
#include <vtkm/io/ErrorIO.h> #include <vtkm/io/ErrorIO.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
@ -123,9 +123,8 @@ public:
//Mesh dependent helper functions //Mesh dependent helper functions
void SetPrepareForExecutionBehavior(bool getMax); void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag> contourtree_mesh_inc_ns::MeshStructureContourTreeMesh PrepareForExecution(
contourtree_mesh_inc_ns::MeshStructureContourTreeMesh<DeviceTag> PrepareForExecution( vtkm::cont::DeviceAdapterId,
DeviceTag,
vtkm::cont::Token& token) const; vtkm::cont::Token& token) const;
ContourTreeMesh() {} ContourTreeMesh() {}
@ -165,7 +164,6 @@ public:
vtkm::Id GetNumberOfVertices() const { return this->NumVertices; } vtkm::Id GetNumberOfVertices() const { return this->NumVertices; }
// Combine two ContourTreeMeshes // Combine two ContourTreeMeshes
template <typename DeviceTag>
void MergeWith(ContourTreeMesh<FieldType>& other); void MergeWith(ContourTreeMesh<FieldType>& other);
// Save/Load the mesh helpers // Save/Load the mesh helpers
@ -506,12 +504,12 @@ inline void ContourTreeMesh<FieldType>::SetPrepareForExecutionBehavior(bool getM
// Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device // Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device
template <typename FieldType> template <typename FieldType>
template <typename DeviceTag> contourtree_mesh_inc_ns::MeshStructureContourTreeMesh inline ContourTreeMesh<
contourtree_mesh_inc_ns::MeshStructureContourTreeMesh<DeviceTag> inline ContourTreeMesh< FieldType>::PrepareForExecution(vtkm::cont::DeviceAdapterId device,
FieldType>::PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return contourtree_mesh_inc_ns::MeshStructureContourTreeMesh<DeviceTag>( return contourtree_mesh_inc_ns::MeshStructureContourTreeMesh(
this->Neighbours, this->FirstNeighbour, this->MaxNeighbours, this->mGetMax, token); this->Neighbours, this->FirstNeighbour, this->MaxNeighbours, this->mGetMax, device, token);
} }
struct NotNoSuchElement struct NotNoSuchElement
@ -521,7 +519,6 @@ struct NotNoSuchElement
// Combine two ContourTreeMeshes // Combine two ContourTreeMeshes
template <typename FieldType> template <typename FieldType>
template <typename DeviceTag>
inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& other) inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& other)
{ // Merge With { // Merge With
#ifdef DEBUG_PRINT #ifdef DEBUG_PRINT
@ -565,16 +562,11 @@ inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& ot
IdArrayType overallSortIndex; IdArrayType overallSortIndex;
overallSortIndex.Allocate(overallSortOrder.GetNumberOfValues()); overallSortIndex.Allocate(overallSortOrder.GetNumberOfValues());
{ {
// Here we enforce the DeviceTag to make sure the device we used for
// CombinedVectorDifferentFromNext is the same as what we use for the algorithms
vtkm::cont::ScopedRuntimeDeviceTracker deviceScope(DeviceTag{});
// Functor return 0,1 for each element depending on whethern the current value is different from the next // Functor return 0,1 for each element depending on whethern the current value is different from the next
vtkm::cont::Token tempToken; mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNext differentFromNextFunctor(
mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNext<DeviceTag> this->GlobalMeshIndex, other.GlobalMeshIndex, overallSortOrder);
differentFromNextFunctor(
this->GlobalMeshIndex, other.GlobalMeshIndex, overallSortOrder, tempToken);
// Array based on the functor // Array based on the functor
// TODO: This should really use ArrayHandleDecorator, not ArrayHandleTransform
auto differentFromNextArr = vtkm::cont::make_ArrayHandleTransform( auto differentFromNextArr = vtkm::cont::make_ArrayHandleTransform(
vtkm::cont::ArrayHandleIndex(overallSortIndex.GetNumberOfValues() - 1), vtkm::cont::ArrayHandleIndex(overallSortIndex.GetNumberOfValues() - 1),
differentFromNextFunctor); differentFromNextFunctor);
@ -583,8 +575,6 @@ inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& ot
overallSortIndex.WritePortal().Set(0, 0); overallSortIndex.WritePortal().Set(0, 0);
IdArrayType tempArr; IdArrayType tempArr;
// perform algorithms on the combined vector. Note the device is enforced by the
// ScopedRuntimeDeviceTracker for the block
vtkm::cont::Algorithm::ScanInclusive(differentFromNextArr, tempArr); vtkm::cont::Algorithm::ScanInclusive(differentFromNextArr, tempArr);
vtkm::cont::Algorithm::CopySubRange( vtkm::cont::Algorithm::CopySubRange(
tempArr, 0, tempArr.GetNumberOfValues(), overallSortIndex, 1); tempArr, 0, tempArr.GetNumberOfValues(), overallSortIndex, 1);

@ -82,9 +82,8 @@ public:
//Mesh dependent helper functions //Mesh dependent helper functions
void SetPrepareForExecutionBehavior(bool getMax); void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag> MeshStructureFreudenthal2D PrepareForExecution(vtkm::cont::DeviceAdapterId device,
MeshStructureFreudenthal2D<DeviceTag> PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const;
vtkm::cont::Token& token) const;
DataSetMeshTriangulation2DFreudenthal(vtkm::Id2 meshSize); DataSetMeshTriangulation2DFreudenthal(vtkm::Id2 meshSize);
@ -117,18 +116,18 @@ inline void DataSetMeshTriangulation2DFreudenthal::SetPrepareForExecutionBehavio
} }
// Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device // Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device
template <typename DeviceTag> inline MeshStructureFreudenthal2D DataSetMeshTriangulation2DFreudenthal::PrepareForExecution(
inline MeshStructureFreudenthal2D<DeviceTag> vtkm::cont::DeviceAdapterId device,
DataSetMeshTriangulation2DFreudenthal::PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return MeshStructureFreudenthal2D<DeviceTag>(vtkm::Id2{ this->MeshSize[0], this->MeshSize[1] }, return MeshStructureFreudenthal2D(vtkm::Id2{ this->MeshSize[0], this->MeshSize[1] },
m2d_freudenthal::N_INCIDENT_EDGES, m2d_freudenthal::N_INCIDENT_EDGES,
this->UseGetMax, this->UseGetMax,
this->SortIndices, this->SortIndices,
this->SortOrder, this->SortOrder,
this->EdgeBoundaryDetectionMasks, this->EdgeBoundaryDetectionMasks,
token); device,
token);
} }
inline MeshBoundary2DExec DataSetMeshTriangulation2DFreudenthal::GetMeshBoundaryExecutionObject() inline MeshBoundary2DExec DataSetMeshTriangulation2DFreudenthal::GetMeshBoundaryExecutionObject()

@ -87,9 +87,8 @@ public:
// Mesh helper functions // Mesh helper functions
void SetPrepareForExecutionBehavior(bool getMax); void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag> MeshStructureFreudenthal3D PrepareForExecution(vtkm::cont::DeviceAdapterId device,
MeshStructureFreudenthal3D<DeviceTag> PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const;
vtkm::cont::Token& token) const;
DataSetMeshTriangulation3DFreudenthal(vtkm::Id3 meshSize); DataSetMeshTriangulation3DFreudenthal(vtkm::Id3 meshSize);
@ -130,20 +129,20 @@ inline void DataSetMeshTriangulation3DFreudenthal::SetPrepareForExecutionBehavio
} }
// Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device // Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device
template <typename DeviceTag> inline MeshStructureFreudenthal3D DataSetMeshTriangulation3DFreudenthal::PrepareForExecution(
inline MeshStructureFreudenthal3D<DeviceTag> vtkm::cont::DeviceAdapterId device,
DataSetMeshTriangulation3DFreudenthal::PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return MeshStructureFreudenthal3D<DeviceTag>(this->MeshSize, return MeshStructureFreudenthal3D(this->MeshSize,
m3d_freudenthal::N_INCIDENT_EDGES, m3d_freudenthal::N_INCIDENT_EDGES,
this->UseGetMax, this->UseGetMax,
this->SortIndices, this->SortIndices,
this->SortOrder, this->SortOrder,
this->EdgeBoundaryDetectionMasks, this->EdgeBoundaryDetectionMasks,
this->NeighbourOffsets, this->NeighbourOffsets,
this->LinkComponentCaseTable, this->LinkComponentCaseTable,
token); device,
token);
} }
inline MeshBoundary3DExec DataSetMeshTriangulation3DFreudenthal::GetMeshBoundaryExecutionObject() inline MeshBoundary3DExec DataSetMeshTriangulation3DFreudenthal::GetMeshBoundaryExecutionObject()

@ -91,9 +91,8 @@ public:
// mesh depended helper functions // mesh depended helper functions
void SetPrepareForExecutionBehavior(bool getMax); void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag> MeshStructureMarchingCubes PrepareForExecution(vtkm::cont::DeviceAdapterId device,
MeshStructureMarchingCubes<DeviceTag> PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const;
vtkm::cont::Token& token) const;
DataSetMeshTriangulation3DMarchingCubes(vtkm::Id3 meshSize); DataSetMeshTriangulation3DMarchingCubes(vtkm::Id3 meshSize);
@ -161,22 +160,22 @@ inline void DataSetMeshTriangulation3DMarchingCubes::SetPrepareForExecutionBehav
} }
// Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device // Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device
template <typename DeviceTag> inline MeshStructureMarchingCubes DataSetMeshTriangulation3DMarchingCubes::PrepareForExecution(
inline MeshStructureMarchingCubes<DeviceTag> vtkm::cont::DeviceAdapterId device,
DataSetMeshTriangulation3DMarchingCubes::PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return MeshStructureMarchingCubes<DeviceTag>(this->MeshSize, return MeshStructureMarchingCubes(this->MeshSize,
this->UseGetMax, this->UseGetMax,
this->SortIndices, this->SortIndices,
this->SortOrder, this->SortOrder,
this->EdgeBoundaryDetectionMasks, this->EdgeBoundaryDetectionMasks,
this->CubeVertexPermutations, this->CubeVertexPermutations,
this->LinkVertexConnectionsSix, this->LinkVertexConnectionsSix,
this->LinkVertexConnectionsEighteen, this->LinkVertexConnectionsEighteen,
this->InCubeConnectionsSix, this->InCubeConnectionsSix,
this->InCubeConnectionsEighteen, this->InCubeConnectionsEighteen,
token); device,
token);
} }
inline MeshBoundary3DExec DataSetMeshTriangulation3DMarchingCubes::GetMeshBoundaryExecutionObject() inline MeshBoundary3DExec DataSetMeshTriangulation3DMarchingCubes::GetMeshBoundaryExecutionObject()

@ -83,12 +83,10 @@ namespace mesh_dem_contourtree_mesh_inc
{ {
// Worklet for computing the sort indices from the sort order // Worklet for computing the sort indices from the sort order
template <typename DeviceAdapter>
class MeshStructureContourTreeMesh class MeshStructureContourTreeMesh
{ {
public: public:
typedef typename cpp2_ns::IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst using IdArrayPortalType = typename cpp2_ns::IdArrayType::ReadPortalType;
IdArrayPortalType;
// Default constucture. Needed for the CUDA built to work // Default constucture. Needed for the CUDA built to work
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -103,12 +101,13 @@ public:
const cpp2_ns::IdArrayType firstNeighbour, const cpp2_ns::IdArrayType firstNeighbour,
const vtkm::Id maxneighbours, const vtkm::Id maxneighbours,
bool getmax, bool getmax,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: MaxNeighbours(maxneighbours) : MaxNeighbours(maxneighbours)
, GetMax(getmax) , GetMax(getmax)
{ {
this->NeighboursPortal = neighbours.PrepareForInput(DeviceAdapter(), token); this->NeighboursPortal = neighbours.PrepareForInput(device, token);
this->FirstNeighbourPortal = firstNeighbour.PrepareForInput(DeviceAdapter(), token); this->FirstNeighbourPortal = firstNeighbour.PrepareForInput(device, token);
} }
VTKM_EXEC VTKM_EXEC

@ -69,20 +69,17 @@ namespace contourtree_augmented
{ {
// Worklet for computing the sort indices from the sort order // Worklet for computing the sort indices from the sort order
template <typename DeviceAdapter> class MeshStructureFreudenthal2D : public data_set_mesh::MeshStructure2D
class MeshStructureFreudenthal2D : public data_set_mesh::MeshStructure2D<DeviceAdapter>
{ {
public: public:
using SortIndicesPortalType = using SortIndicesPortalType = IdArrayType::ReadPortalType;
typename IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
using EdgeBoundaryDetectionMasksPortalType = using EdgeBoundaryDetectionMasksPortalType =
typename m2d_freudenthal::EdgeBoundaryDetectionMasksType::template ExecutionTypes< m2d_freudenthal::EdgeBoundaryDetectionMasksType::ReadPortalType;
DeviceAdapter>::PortalConst;
// Default constucture. Needed for the CUDA built to work // Default constucture. Needed for the CUDA built to work
VTKM_EXEC_CONT VTKM_EXEC_CONT
MeshStructureFreudenthal2D() MeshStructureFreudenthal2D()
: data_set_mesh::MeshStructure2D<DeviceAdapter>() : data_set_mesh::MeshStructure2D()
, GetMax(false) , GetMax(false)
, NumIncidentEdges(m2d_freudenthal::N_INCIDENT_EDGES) , NumIncidentEdges(m2d_freudenthal::N_INCIDENT_EDGES)
{ {
@ -96,15 +93,16 @@ public:
const IdArrayType& sortIndices, const IdArrayType& sortIndices,
const IdArrayType& SortOrder, const IdArrayType& SortOrder,
const m2d_freudenthal::EdgeBoundaryDetectionMasksType& EdgeBoundaryDetectionMasksIn, const m2d_freudenthal::EdgeBoundaryDetectionMasksType& EdgeBoundaryDetectionMasksIn,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: data_set_mesh::MeshStructure2D<DeviceAdapter>(meshSize) : data_set_mesh::MeshStructure2D(meshSize)
, GetMax(getmax) , GetMax(getmax)
, NumIncidentEdges(nincident_edges) , NumIncidentEdges(nincident_edges)
{ {
this->SortIndicesPortal = sortIndices.PrepareForInput(DeviceAdapter(), token); this->SortIndicesPortal = sortIndices.PrepareForInput(device, token);
this->SortOrderPortal = SortOrder.PrepareForInput(DeviceAdapter(), token); this->SortOrderPortal = SortOrder.PrepareForInput(device, token);
this->EdgeBoundaryDetectionMasksPortal = this->EdgeBoundaryDetectionMasksPortal =
EdgeBoundaryDetectionMasksIn.PrepareForInput(DeviceAdapter(), token); EdgeBoundaryDetectionMasksIn.PrepareForInput(device, token);
} }
VTKM_EXEC VTKM_EXEC

@ -70,29 +70,23 @@ namespace contourtree_augmented
{ {
// Worklet for computing the sort indices from the sort order // Worklet for computing the sort indices from the sort order
template <typename DeviceAdapter> class MeshStructureFreudenthal3D : public data_set_mesh::MeshStructure3D
class MeshStructureFreudenthal3D : public data_set_mesh::MeshStructure3D<DeviceAdapter>
{ {
public: public:
using SortIndicesPortalType = using SortIndicesPortalType = IdArrayType::ReadPortalType;
typename IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
using EdgeBoundaryDetectionMasksPortalType = using EdgeBoundaryDetectionMasksPortalType =
typename m3d_freudenthal::EdgeBoundaryDetectionMasksType::template ExecutionTypes< m3d_freudenthal::EdgeBoundaryDetectionMasksType::ReadPortalType;
DeviceAdapter>::PortalConst;
using NeighbourOffsetsPortalType = using NeighbourOffsetsPortalType = m3d_freudenthal::NeighbourOffsetsType::ReadPortalType;
typename m3d_freudenthal::NeighbourOffsetsType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
using LinkComponentCaseTablePortalType = using LinkComponentCaseTablePortalType =
typename m3d_freudenthal::LinkComponentCaseTableType::template ExecutionTypes< m3d_freudenthal::LinkComponentCaseTableType::ReadPortalType;
DeviceAdapter>::PortalConst;
// Default constructor needed to make the CUDA build work // Default constructor needed to make the CUDA build work
VTKM_EXEC_CONT VTKM_EXEC_CONT
MeshStructureFreudenthal3D() MeshStructureFreudenthal3D()
: data_set_mesh::MeshStructure3D<DeviceAdapter>() : data_set_mesh::MeshStructure3D()
, GetMax(false) , GetMax(false)
, NumIncidentEdge(m3d_freudenthal::N_INCIDENT_EDGES) , NumIncidentEdge(m3d_freudenthal::N_INCIDENT_EDGES)
{ {
@ -108,18 +102,18 @@ public:
const m3d_freudenthal::EdgeBoundaryDetectionMasksType& edgeBoundaryDetectionMasksIn, const m3d_freudenthal::EdgeBoundaryDetectionMasksType& edgeBoundaryDetectionMasksIn,
const m3d_freudenthal::NeighbourOffsetsType& neighbourOffsetsIn, const m3d_freudenthal::NeighbourOffsetsType& neighbourOffsetsIn,
const m3d_freudenthal::LinkComponentCaseTableType& linkComponentCaseTableIn, const m3d_freudenthal::LinkComponentCaseTableType& linkComponentCaseTableIn,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: data_set_mesh::MeshStructure3D<DeviceAdapter>(meshSize) : data_set_mesh::MeshStructure3D(meshSize)
, GetMax(getmax) , GetMax(getmax)
, NumIncidentEdge(nincident_edges) , NumIncidentEdge(nincident_edges)
{ {
this->SortIndicesPortal = sortIndices.PrepareForInput(DeviceAdapter(), token); this->SortIndicesPortal = sortIndices.PrepareForInput(device, token);
this->SortOrderPortal = sortOrder.PrepareForInput(DeviceAdapter(), token); this->SortOrderPortal = sortOrder.PrepareForInput(device, token);
this->EdgeBoundaryDetectionMasksPortal = this->EdgeBoundaryDetectionMasksPortal =
edgeBoundaryDetectionMasksIn.PrepareForInput(DeviceAdapter(), token); edgeBoundaryDetectionMasksIn.PrepareForInput(device, token);
this->NeighbourOffsetsPortal = neighbourOffsetsIn.PrepareForInput(DeviceAdapter(), token); this->NeighbourOffsetsPortal = neighbourOffsetsIn.PrepareForInput(device, token);
this->LinkComponentCaseTablePortal = this->LinkComponentCaseTablePortal = linkComponentCaseTableIn.PrepareForInput(device, token);
linkComponentCaseTableIn.PrepareForInput(DeviceAdapter(), token);
} }
VTKM_EXEC VTKM_EXEC

@ -69,38 +69,31 @@ namespace contourtree_augmented
{ {
// Worklet for computing the sort indices from the sort order // Worklet for computing the sort indices from the sort order
template <typename DeviceAdapter> class MeshStructureMarchingCubes : public data_set_mesh::MeshStructure3D
class MeshStructureMarchingCubes : public data_set_mesh::MeshStructure3D<DeviceAdapter>
{ {
public: public:
// EdgeBoundaryDetectionMasks types // EdgeBoundaryDetectionMasks types
using EdgeBoundaryDetectionMasksPortalType = using EdgeBoundaryDetectionMasksPortalType =
typename m3d_marchingcubes::EdgeBoundaryDetectionMasksType::template ExecutionTypes< m3d_marchingcubes::EdgeBoundaryDetectionMasksType::ReadPortalType;
DeviceAdapter>::PortalConst;
// Sort indicies types // Sort indicies types
using SortIndicesPortalType = using SortIndicesPortalType = IdArrayType::ReadPortalType;
typename IdArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
// CubeVertexPermutations types // CubeVertexPermutations types
using CubeVertexPermutationsPortalType = using CubeVertexPermutationsPortalType =
typename m3d_marchingcubes::CubeVertexPermutationsType::template ExecutionTypes< m3d_marchingcubes::CubeVertexPermutationsType::ReadPortalType;
DeviceAdapter>::PortalConst;
// linkVertexConnection types // linkVertexConnection types
using LinkVertexConnectionsPortalType = using LinkVertexConnectionsPortalType =
typename m3d_marchingcubes::LinkVertexConnectionsType::template ExecutionTypes< m3d_marchingcubes::LinkVertexConnectionsType::ReadPortalType;
DeviceAdapter>::PortalConst;
// inCubeConnection types // inCubeConnection types
using InCubeConnectionsPortalType = using InCubeConnectionsPortalType = m3d_marchingcubes::InCubeConnectionsType::ReadPortalType;
typename m3d_marchingcubes::InCubeConnectionsType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
// Default constructor needed to make the CUDA build work // Default constructor needed to make the CUDA build work
VTKM_EXEC_CONT VTKM_EXEC_CONT
MeshStructureMarchingCubes() MeshStructureMarchingCubes()
: data_set_mesh::MeshStructure3D<DeviceAdapter>() : data_set_mesh::MeshStructure3D()
, GetMax(false) , GetMax(false)
{ {
} }
@ -117,24 +110,23 @@ public:
const m3d_marchingcubes::LinkVertexConnectionsType& LinkVertexConnectionsEighteenIn, const m3d_marchingcubes::LinkVertexConnectionsType& LinkVertexConnectionsEighteenIn,
const m3d_marchingcubes::InCubeConnectionsType& InCubeConnectionsSixIn, const m3d_marchingcubes::InCubeConnectionsType& InCubeConnectionsSixIn,
const m3d_marchingcubes::InCubeConnectionsType& InCubeConnectionsEighteenIn, const m3d_marchingcubes::InCubeConnectionsType& InCubeConnectionsEighteenIn,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: data_set_mesh::MeshStructure3D<DeviceAdapter>(meshSize) : data_set_mesh::MeshStructure3D(meshSize)
, GetMax(getmax) , GetMax(getmax)
{ {
this->SortIndicesPortal = sortIndices.PrepareForInput(DeviceAdapter(), token); this->SortIndicesPortal = sortIndices.PrepareForInput(device, token);
this->SortOrderPortal = sortOrder.PrepareForInput(DeviceAdapter(), token); this->SortOrderPortal = sortOrder.PrepareForInput(device, token);
this->EdgeBoundaryDetectionMasksPortal = this->EdgeBoundaryDetectionMasksPortal =
EdgeBoundaryDetectionMasksIn.PrepareForInput(DeviceAdapter(), token); EdgeBoundaryDetectionMasksIn.PrepareForInput(device, token);
this->CubeVertexPermutationsPortal = this->CubeVertexPermutationsPortal = CubeVertexPermutationsIn.PrepareForInput(device, token);
CubeVertexPermutationsIn.PrepareForInput(DeviceAdapter(), token);
this->LinkVertexConnectionsSixPortal = this->LinkVertexConnectionsSixPortal =
LinkVertexConnectionsSixIn.PrepareForInput(DeviceAdapter(), token); LinkVertexConnectionsSixIn.PrepareForInput(device, token);
this->LinkVertexConnectionsEighteenPortal = this->LinkVertexConnectionsEighteenPortal =
LinkVertexConnectionsEighteenIn.PrepareForInput(DeviceAdapter(), token); LinkVertexConnectionsEighteenIn.PrepareForInput(device, token);
this->InCubeConnectionsSixPortal = this->InCubeConnectionsSixPortal = InCubeConnectionsSixIn.PrepareForInput(device, token);
InCubeConnectionsSixIn.PrepareForInput(DeviceAdapter(), token);
this->InCubeConnectionsEighteenPortal = this->InCubeConnectionsEighteenPortal =
InCubeConnectionsEighteenIn.PrepareForInput(DeviceAdapter(), token); InCubeConnectionsEighteenIn.PrepareForInput(device, token);
} }
VTKM_EXEC VTKM_EXEC

@ -78,19 +78,19 @@ namespace mesh_dem_contourtree_mesh_inc
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class ArcComparatorImpl class ArcComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
ArcComparatorImpl(const IdArrayType& ct_arcs, vtkm::cont::Token& token) ArcComparatorImpl(const IdArrayType& ct_arcs,
{ // constructor vtkm::cont::DeviceAdapterId device,
this->ArcsPortal = ct_arcs.PrepareForInput(DeviceAdapter(), token); vtkm::cont::Token& token)
} // constructor : ArcsPortal(ct_arcs.PrepareForInput(device, token))
{
}
// () operator - gets called to do comparison // () operator - gets called to do comparison
VTKM_EXEC VTKM_EXEC
@ -125,11 +125,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT ArcComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT ArcComparatorImpl<DeviceAdapter> PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return ArcComparatorImpl<DeviceAdapter>(this->Arcs, token); return ArcComparatorImpl(this->Arcs, device, token);
} }
private: private:

@ -77,14 +77,12 @@ namespace mesh_dem_contourtree_mesh_inc
/// Implementation of the comparator used initial sort of data values in ContourTreeMesh<FieldType>::MergeWith /// Implementation of the comparator used initial sort of data values in ContourTreeMesh<FieldType>::MergeWith
template <typename FieldType, typename DeviceAdapter> template <typename FieldType>
class CombinedSimulatedSimplicityIndexComparatorImpl class CombinedSimulatedSimplicityIndexComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst; using ValuePortalType = typename vtkm::cont::ArrayHandle<FieldType>::ReadPortalType;
using ValuePortalType = typename vtkm::cont::ArrayHandle<FieldType>::template ExecutionTypes<
DeviceAdapter>::PortalConst;
VTKM_CONT VTKM_CONT
CombinedSimulatedSimplicityIndexComparatorImpl( CombinedSimulatedSimplicityIndexComparatorImpl(
@ -92,13 +90,14 @@ public:
const IdArrayType& otherGlobalMeshIndex, const IdArrayType& otherGlobalMeshIndex,
const vtkm::cont::ArrayHandle<FieldType>& thisSortedValues, const vtkm::cont::ArrayHandle<FieldType>& thisSortedValues,
const vtkm::cont::ArrayHandle<FieldType>& otherSortedValues, const vtkm::cont::ArrayHandle<FieldType>& otherSortedValues,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
this->ThisGlobalMeshIndex = thisGlobalMeshIndex.PrepareForInput(DeviceAdapter(), token); this->ThisGlobalMeshIndex = thisGlobalMeshIndex.PrepareForInput(device, token);
this->OtherGlobalMeshIndex = otherGlobalMeshIndex.PrepareForInput(DeviceAdapter(), token); this->OtherGlobalMeshIndex = otherGlobalMeshIndex.PrepareForInput(device, token);
; ;
this->ThisSortedValues = thisSortedValues.PrepareForInput(DeviceAdapter(), token); this->ThisSortedValues = thisSortedValues.PrepareForInput(device, token);
this->OtherSortedValues = otherSortedValues.PrepareForInput(DeviceAdapter(), token); this->OtherSortedValues = otherSortedValues.PrepareForInput(device, token);
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -207,16 +206,16 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl<FieldType> PrepareForExecution(
VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl<FieldType, DeviceAdapter> vtkm::cont::DeviceAdapterId device,
PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
return CombinedSimulatedSimplicityIndexComparatorImpl<FieldType, DeviceAdapter>( return CombinedSimulatedSimplicityIndexComparatorImpl<FieldType>(this->ThisGlobalMeshIndex,
this->ThisGlobalMeshIndex, this->OtherGlobalMeshIndex,
this->OtherGlobalMeshIndex, this->ThisSortedValues,
this->ThisSortedValues, this->OtherSortedValues,
this->OtherSortedValues, device,
token); token);
} }
private: private:

@ -76,27 +76,24 @@ namespace contourtree_augmented
namespace mesh_dem_contourtree_mesh_inc namespace mesh_dem_contourtree_mesh_inc
{ {
/// transform functor to compute if element i is different from element i+1 in an arrays. The resulting array should hence /// transform functor to compute if element i is different from element i+1 in an arrays. The
/// be 1 element shorter than the input arrays /// resulting array should hence be 1 element shorter than the input arrays
template <typename DeviceAdapter> class CombinedVectorDifferentFromNextExecObj
class CombinedVectorDifferentFromNext
{ {
public: public:
using IdPortalType = using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
VTKM_EXEC_CONT VTKM_EXEC_CONT
CombinedVectorDifferentFromNext() {} CombinedVectorDifferentFromNextExecObj() {}
VTKM_CONT VTKM_CONT
CombinedVectorDifferentFromNext(const IdArrayType& thisGlobalMeshIndex, CombinedVectorDifferentFromNextExecObj(const IdPortalType& thisGlobalMeshIndex,
const IdArrayType& otherGlobalMeshIndex, const IdPortalType& otherGlobalMeshIndex,
const IdArrayType& sortOrder, const IdPortalType& sortOrder)
vtkm::cont::Token& token) : OverallSortOrderPortal(sortOrder)
, ThisGlobalMeshIndex(thisGlobalMeshIndex)
, OtherGlobalMeshIndex(otherGlobalMeshIndex)
{ {
this->OverallSortOrderPortal = sortOrder.PrepareForInput(DeviceAdapter(), token);
this->ThisGlobalMeshIndex = thisGlobalMeshIndex.PrepareForInput(DeviceAdapter(), token);
this->OtherGlobalMeshIndex = otherGlobalMeshIndex.PrepareForInput(DeviceAdapter(), token);
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -121,6 +118,41 @@ private:
IdPortalType OtherGlobalMeshIndex; IdPortalType OtherGlobalMeshIndex;
}; };
class CombinedVectorDifferentFromNext : public vtkm::cont::ExecutionAndControlObjectBase
{
IdArrayType OverallSortOrder;
IdArrayType ThisGlobalMeshIndex;
IdArrayType OtherGlobalMeshIndex;
public:
CombinedVectorDifferentFromNext() = default;
CombinedVectorDifferentFromNext(const IdArrayType& thisGlobalMeshIndex,
const IdArrayType& otherGlobalMeshIndex,
const IdArrayType& sortOrder)
: OverallSortOrder(sortOrder)
, ThisGlobalMeshIndex(thisGlobalMeshIndex)
, OtherGlobalMeshIndex(otherGlobalMeshIndex)
{
}
VTKM_CONT CombinedVectorDifferentFromNextExecObj
PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
{
return CombinedVectorDifferentFromNextExecObj(
this->ThisGlobalMeshIndex.PrepareForInput(device, token),
this->OtherGlobalMeshIndex.PrepareForInput(device, token),
this->OverallSortOrder.PrepareForInput(device, token));
}
VTKM_CONT CombinedVectorDifferentFromNextExecObj PrepareForControl() const
{
return CombinedVectorDifferentFromNextExecObj(this->ThisGlobalMeshIndex.ReadPortal(),
this->OtherGlobalMeshIndex.ReadPortal(),
this->OverallSortOrder.ReadPortal());
}
};
} // namespace mesh_dem_contourtree_mesh_inc } // namespace mesh_dem_contourtree_mesh_inc
} // namespace contourtree_augmented } // namespace contourtree_augmented

@ -74,25 +74,26 @@ namespace contourtree_augmented
{ {
template <typename DeviceTag>
class MeshBoundary2D class MeshBoundary2D
{ {
public: public:
// Sort indicies types // Sort indicies types
using SortIndicesPortalType = using SortIndicesPortalType = IdArrayType::ReadPortalType;
typename IdArrayType::template ExecutionTypes<DeviceTag>::PortalConst;
VTKM_EXEC_CONT VTKM_EXEC_CONT
MeshBoundary2D() MeshBoundary2D()
: MeshStructure(0, 0) : MeshStructure({ 0, 0 })
{ {
} }
VTKM_CONT VTKM_CONT
MeshBoundary2D(vtkm::Id2 meshSize, const IdArrayType& sortIndices, vtkm::cont::Token& token) MeshBoundary2D(vtkm::Id2 meshSize,
const IdArrayType& sortIndices,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
: MeshStructure(meshSize) : MeshStructure(meshSize)
{ {
this->SortIndicesPortal = sortIndices.PrepareForInput(DeviceTag(), token); this->SortIndicesPortal = sortIndices.PrepareForInput(device, token);
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -155,14 +156,11 @@ public:
} }
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
const data_set_mesh::MeshStructure2D<DeviceTag>& GetMeshStructure() const const data_set_mesh::MeshStructure2D& GetMeshStructure() const { return this->MeshStructure; }
{
return this->MeshStructure;
}
private: private:
// 2D Mesh size parameters // 2D Mesh size parameters
data_set_mesh::MeshStructure2D<DeviceTag> MeshStructure; data_set_mesh::MeshStructure2D MeshStructure;
SortIndicesPortalType SortIndicesPortal; SortIndicesPortalType SortIndicesPortal;
}; };
@ -177,10 +175,10 @@ public:
} }
VTKM_CONT VTKM_CONT
template <typename DeviceTag> MeshBoundary2D PrepareForExecution(vtkm::cont::DeviceAdapterId device,
MeshBoundary2D<DeviceTag> PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return MeshBoundary2D<DeviceTag>(this->MeshSize, this->SortIndices, token); return MeshBoundary2D(this->MeshSize, this->SortIndices, device, token);
} }
private: private:

@ -73,25 +73,26 @@ namespace worklet
namespace contourtree_augmented namespace contourtree_augmented
{ {
template <typename DeviceTag> class MeshBoundary3D
class MeshBoundary3D : public vtkm::cont::ExecutionObjectBase
{ {
public: public:
// Sort indicies types // Sort indicies types
using SortIndicesPortalType = using SortIndicesPortalType = IdArrayType::ReadPortalType;
typename IdArrayType::template ExecutionTypes<DeviceTag>::PortalConst;
VTKM_EXEC_CONT VTKM_EXEC_CONT
MeshBoundary3D() MeshBoundary3D()
: MeshStructure(data_set_mesh::MeshStructure3D<DeviceTag>(vtkm::Id3{ 0, 0, 0 })) : MeshStructure(data_set_mesh::MeshStructure3D(vtkm::Id3{ 0, 0, 0 }))
{ {
} }
VTKM_CONT VTKM_CONT
MeshBoundary3D(vtkm::Id3 meshSize, const IdArrayType& inSortIndices, vtkm::cont::Token& token) MeshBoundary3D(vtkm::Id3 meshSize,
: MeshStructure(data_set_mesh::MeshStructure3D<DeviceTag>(meshSize)) const IdArrayType& inSortIndices,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
: MeshStructure(data_set_mesh::MeshStructure3D(meshSize))
{ {
this->SortIndicesPortal = inSortIndices.PrepareForInput(DeviceTag(), token); this->SortIndicesPortal = inSortIndices.PrepareForInput(device, token);
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -259,14 +260,11 @@ public:
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
const data_set_mesh::MeshStructure3D<DeviceTag>& GetMeshStructure() const const data_set_mesh::MeshStructure3D& GetMeshStructure() const { return this->MeshStructure; }
{
return this->MeshStructure;
}
protected: protected:
// 3D Mesh size parameters // 3D Mesh size parameters
data_set_mesh::MeshStructure3D<DeviceTag> MeshStructure; data_set_mesh::MeshStructure3D MeshStructure;
SortIndicesPortalType SortIndicesPortal; SortIndicesPortalType SortIndicesPortal;
}; };
@ -281,11 +279,10 @@ public:
{ {
} }
VTKM_CONT VTKM_CONT MeshBoundary3D PrepareForExecution(vtkm::cont::DeviceAdapterId device,
template <typename DeviceTag> vtkm::cont::Token& token) const
MeshBoundary3D<DeviceTag> PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const
{ {
return MeshBoundary3D<DeviceTag>(this->MeshSize, this->SortIndices, token); return MeshBoundary3D(this->MeshSize, this->SortIndices, device, token);
} }
protected: protected:

@ -71,13 +71,10 @@ namespace worklet
namespace contourtree_augmented namespace contourtree_augmented
{ {
template <typename DeviceTag>
class MeshBoundaryContourTreeMesh class MeshBoundaryContourTreeMesh
{ {
public: public:
using IndicesPortalType = typename IdArrayType::template ExecutionTypes<DeviceTag>::PortalConst; using IndicesPortalType = IdArrayType::ReadPortalType;
VTKM_EXEC_CONT VTKM_EXEC_CONT
MeshBoundaryContourTreeMesh() {} MeshBoundaryContourTreeMesh() {}
@ -87,13 +84,14 @@ public:
vtkm::Id3 globalSize, vtkm::Id3 globalSize,
vtkm::Id3 minIdx, vtkm::Id3 minIdx,
vtkm::Id3 maxIdx, vtkm::Id3 maxIdx,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: GlobalSize(globalSize) : GlobalSize(globalSize)
, MinIdx(minIdx) , MinIdx(minIdx)
, MaxIdx(maxIdx) , MaxIdx(maxIdx)
{ {
assert(this->GlobalSize[0] > 0 && this->GlobalSize[1] > 0); assert(this->GlobalSize[0] > 0 && this->GlobalSize[1] > 0);
this->GlobalMeshIndexPortal = globalMeshIndex.PrepareForInput(DeviceTag(), token); this->GlobalMeshIndexPortal = globalMeshIndex.PrepareForInput(device, token);
} }
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -147,13 +145,11 @@ public:
{ {
} }
VTKM_CONT VTKM_CONT MeshBoundaryContourTreeMesh PrepareForExecution(vtkm::cont::DeviceAdapterId device,
template <typename DeviceTag> vtkm::cont::Token& token) const
MeshBoundaryContourTreeMesh<DeviceTag> PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const
{ {
return MeshBoundaryContourTreeMesh<DeviceTag>( return MeshBoundaryContourTreeMesh(
this->GlobalMeshIndex, this->GlobalSize, this->MinIdx, this->MaxIdx, token); this->GlobalMeshIndex, this->GlobalSize, this->MinIdx, this->MaxIdx, device, token);
} }
private: private:

@ -68,14 +68,11 @@ namespace contourtree_augmented
namespace process_contourtree_inc namespace process_contourtree_inc
{ {
template <typename DeviceAdapter>
class SuperArcVolumetricComparatorImpl class SuperArcVolumetricComparatorImpl
{ // SuperArcVolumetricComparatorImpl { // SuperArcVolumetricComparatorImpl
public: public:
using IdPortalType = using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst; using EdgePairArrayPortalType = EdgePairArray::ReadPortalType;
using EdgePairArrayPortalType =
typename EdgePairArray::template ExecutionTypes<DeviceAdapter>::PortalConst;
IdPortalType weightPortal; IdPortalType weightPortal;
bool pairsAtLowEnd; bool pairsAtLowEnd;
@ -85,11 +82,12 @@ public:
SuperArcVolumetricComparatorImpl(const IdArrayType& Weight, SuperArcVolumetricComparatorImpl(const IdArrayType& Weight,
const EdgePairArray& SuperarcList, const EdgePairArray& SuperarcList,
bool PairsAtLowEnd, bool PairsAtLowEnd,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: pairsAtLowEnd(PairsAtLowEnd) : pairsAtLowEnd(PairsAtLowEnd)
{ // constructor { // constructor
weightPortal = Weight.PrepareForInput(DeviceAdapter(), token); weightPortal = Weight.PrepareForInput(device, token);
superarcListPortal = SuperarcList.PrepareForInput(DeviceAdapter(), token); superarcListPortal = SuperarcList.PrepareForInput(device, token);
} // constructor } // constructor
@ -165,13 +163,11 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT SuperArcVolumetricComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT SuperArcVolumetricComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token)
DeviceAdapter,
vtkm::cont::Token& token)
{ {
return SuperArcVolumetricComparatorImpl<DeviceAdapter>( return SuperArcVolumetricComparatorImpl(
this->Weight, this->SuperArcList, this->PairsAtLowEnd, token); this->Weight, this->SuperArcList, this->PairsAtLowEnd, device, token);
} }
private: private:

@ -68,22 +68,21 @@ namespace contourtree_augmented
namespace process_contourtree_inc namespace process_contourtree_inc
{ {
template <typename DeviceAdapter>
class SuperNodeBranchComparatorImpl class SuperNodeBranchComparatorImpl
{ // SuperNodeBranchComparatorImpl { // SuperNodeBranchComparatorImpl
public: public:
using IdPortalType = using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
IdPortalType WhichBranchPortal; IdPortalType WhichBranchPortal;
IdPortalType SupernodesPortal; IdPortalType SupernodesPortal;
// constructor // constructor
SuperNodeBranchComparatorImpl(const IdArrayType& whichBranch, SuperNodeBranchComparatorImpl(const IdArrayType& whichBranch,
const IdArrayType& supernodes, const IdArrayType& supernodes,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ // constructor { // constructor
this->WhichBranchPortal = whichBranch.PrepareForInput(DeviceAdapter(), token); this->WhichBranchPortal = whichBranch.PrepareForInput(device, token);
this->SupernodesPortal = supernodes.PrepareForInput(DeviceAdapter(), token); this->SupernodesPortal = supernodes.PrepareForInput(device, token);
} // constructor } // constructor
// () operator - gets called to do comparison // () operator - gets called to do comparison
@ -124,12 +123,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT SuperNodeBranchComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT SuperNodeBranchComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token)
DeviceAdapter,
vtkm::cont::Token& token)
{ {
return SuperNodeBranchComparatorImpl<DeviceAdapter>(this->WhichBranch, this->Supernodes, token); return SuperNodeBranchComparatorImpl(this->WhichBranch, this->Supernodes, device, token);
} }
private: private:

@ -72,19 +72,6 @@ namespace worklet
namespace contourtree_distributed namespace contourtree_distributed
{ {
// Functor needed so we can discover the FieldType and DeviceAdapter template parameters to call MergeWith
struct MergeContourTreeMeshFunctor
{
template <typename DeviceAdapterTag, typename FieldType>
bool operator()(DeviceAdapterTag,
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>& in,
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>& out) const
{
out.template MergeWith<DeviceAdapterTag>(in);
return true;
}
};
/// Functor used by DIY reduce the merge data blocks in parallel /// Functor used by DIY reduce the merge data blocks in parallel
template <typename FieldType> template <typename FieldType>
class ComputeDistributedContourTreeFunctor class ComputeDistributedContourTreeFunctor
@ -171,8 +158,7 @@ public:
#endif #endif
// Merge the two contour tree meshes // Merge the two contour tree meshes
vtkm::cont::TryExecute( block->ContourTreeMeshes.back().MergeWith(otherContourTreeMesh);
MergeContourTreeMeshFunctor{}, otherContourTreeMesh, block->ContourTreeMeshes.back());
timingsStream << " |-->" << std::setw(38) << std::left << "Merge Contour Tree Mesh" timingsStream << " |-->" << std::setw(38) << std::left << "Merge Contour Tree Mesh"
<< ": " << loopTimer.GetElapsedTime() << " seconds" << std::endl; << ": " << loopTimer.GetElapsedTime() << " seconds" << std::endl;

@ -70,20 +70,6 @@ namespace worklet
namespace contourtree_distributed namespace contourtree_distributed
{ {
// Functor needed so we can discover the FieldType and DeviceAdapter template parameters to call MergeWith
struct MergeFunctor
{
template <typename DeviceAdapterTag, typename FieldType>
bool operator()(DeviceAdapterTag,
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>& in,
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>& out) const
{
out.template MergeWith<DeviceAdapterTag>(in);
return true;
}
};
// Functor used by DIY reduce the merge data blocks in parallel // Functor used by DIY reduce the merge data blocks in parallel
template <typename FieldType> template <typename FieldType>
void MergeBlockFunctor( void MergeBlockFunctor(
@ -136,7 +122,7 @@ void MergeBlockFunctor(
contourTreeMeshOut.FirstNeighbour = block->FirstNeighbour; contourTreeMeshOut.FirstNeighbour = block->FirstNeighbour;
contourTreeMeshOut.MaxNeighbours = block->MaxNeighbours; contourTreeMeshOut.MaxNeighbours = block->MaxNeighbours;
// Merge the two contour tree meshes // Merge the two contour tree meshes
vtkm::cont::TryExecute(MergeFunctor{}, contourTreeMeshIn, contourTreeMeshOut); contourTreeMeshOut.MergeWith(contourTreeMeshIn);
// Compute the origin and size of the new block // Compute the origin and size of the new block
vtkm::Id3 globalSize = block->GlobalSize; vtkm::Id3 globalSize = block->GlobalSize;

@ -70,17 +70,15 @@ namespace bract_maker
/// device implementation of the comparator used for sorting hyperarcs /// device implementation of the comparator used for sorting hyperarcs
template <typename DeviceAdapter>
class BoundaryTreeNodeComparatorImpl class BoundaryTreeNodeComparatorImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst; // The ContourTreeMesh uses a smart ArrayHandleIndex instead of a regular IdArrayType array.
/// The ContourTreeMesh uses a smart ArrayHandleIndex instead of a regular IdArrayType array that is why we use a ArrayHandleMultiplexer here // That is why we use a ArrayHandleMultiplexer here.
using SortIndexPortalType = typename vtkm::cont::ArrayHandleMultiplexer< using SortIndexPortalType =
vtkm::cont::ArrayHandle<vtkm::Id>, vtkm::cont::ArrayHandleMultiplexer<vtkm::cont::ArrayHandle<vtkm::Id>,
vtkm::cont::ArrayHandleIndex>::template ExecutionTypes<DeviceAdapter>::PortalConst; vtkm::cont::ArrayHandleIndex>::ReadPortalType;
//typename vtkm::cont::ArrayHandleVirtual<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
@ -134,14 +132,11 @@ public:
{ // constructor { // constructor
} // constructor } // constructor
template <typename DeviceAdapter> VTKM_CONT BoundaryTreeNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT BoundaryTreeNodeComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return BoundaryTreeNodeComparatorImpl<DeviceAdapter>( return BoundaryTreeNodeComparatorImpl(this->RegularId.PrepareForInput(device, token),
this->RegularId.PrepareForInput(device, token), this->MeshSortIndex.PrepareForInput(device, token));
this->MeshSortIndex.PrepareForInput(device, token));
} }
private: private:

@ -70,12 +70,10 @@ namespace bract_maker
// device implementation of the ContourTreeNodeHyperArcComparator // device implementation of the ContourTreeNodeHyperArcComparator
template <typename DeviceAdapter>
class ContourTreeNodeHyperArcComparatorImpl class ContourTreeNodeHyperArcComparatorImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
@ -143,14 +141,11 @@ public:
{ // constructor { // constructor
} // constructor } // constructor
template <typename DeviceAdapter> VTKM_CONT ContourTreeNodeHyperArcComparatorImpl
VTKM_CONT ContourTreeNodeHyperArcComparatorImpl<DeviceAdapter> PrepareForExecution( PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return ContourTreeNodeHyperArcComparatorImpl<DeviceAdapter>( return ContourTreeNodeHyperArcComparatorImpl(this->Superarcs.PrepareForInput(device, token),
this->Superarcs.PrepareForInput(device, token), this->Superparents.PrepareForInput(device, token));
this->Superparents.PrepareForInput(device, token));
} }
private: private:

@ -68,12 +68,10 @@ namespace bract_maker
// device implementation of the comparator used for sorting hyperarcs // device implementation of the comparator used for sorting hyperarcs
template <typename DeviceAdapter>
class HyperarcComparatorImpl class HyperarcComparatorImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
@ -105,12 +103,10 @@ public:
{ // constructor { // constructor
} // constructor } // constructor
template <typename DeviceAdapter> VTKM_CONT HyperarcComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT HyperarcComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return HyperarcComparatorImpl<DeviceAdapter>(this->Hyperarcs.PrepareForInput(device, token)); return HyperarcComparatorImpl(this->Hyperarcs.PrepareForInput(device, token));
} }
private: private:

@ -66,24 +66,23 @@ namespace contourtree_distributed
/// Device implementation of FindRegularByGlobal for the HierarchicalContourTree /// Device implementation of FindRegularByGlobal for the HierarchicalContourTree
template <typename DeviceTag>
class FindRegularByGlobalDeviceData class FindRegularByGlobalDeviceData
{ {
public: public:
using IndicesPortalType = using IndicesPortalType =
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes< typename vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
DeviceTag>::PortalConst;
VTKM_CONT VTKM_CONT
FindRegularByGlobalDeviceData( FindRegularByGlobalDeviceData(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token, vtkm::cont::Token& token,
const vtkm::worklet::contourtree_augmented::IdArrayType& regularNodeSortOrder, const vtkm::worklet::contourtree_augmented::IdArrayType& regularNodeSortOrder,
const vtkm::worklet::contourtree_augmented::IdArrayType& regularNodeGlobalIds) const vtkm::worklet::contourtree_augmented::IdArrayType& regularNodeGlobalIds)
{ {
// Prepare the arrays for input and store the array portals // Prepare the arrays for input and store the array portals
// so that they can be used inside a workelt // so that they can be used inside a workelt
this->RegularNodeSortOrder = regularNodeSortOrder.PrepareForInput(DeviceTag(), token); this->RegularNodeSortOrder = regularNodeSortOrder.PrepareForInput(device, token);
this->RegularNodeGlobalIds = regularNodeGlobalIds.PrepareForInput(DeviceTag(), token); this->RegularNodeGlobalIds = regularNodeGlobalIds.PrepareForInput(device, token);
} }
/// Define also as an operator so that we can use it in ArrayHandleTransform directly /// Define also as an operator so that we can use it in ArrayHandleTransform directly
@ -177,13 +176,11 @@ public:
{ {
} }
VTKM_CONT VTKM_CONT FindRegularByGlobalDeviceData PrepareForExecution(vtkm::cont::DeviceAdapterId device,
template <typename DeviceTag> vtkm::cont::Token& token) const
FindRegularByGlobalDeviceData<DeviceTag> PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const
{ {
return FindRegularByGlobalDeviceData<DeviceTag>( return FindRegularByGlobalDeviceData(
token, this->RegularNodeSortOrder, this->RegularNodeGlobalIds); device, token, this->RegularNodeSortOrder, this->RegularNodeGlobalIds);
} }
private: private:

@ -66,18 +66,17 @@ namespace contourtree_distributed
/// Device implementation of FindSuperArcForUnknownNode for the HierarchicalContourTree /// Device implementation of FindSuperArcForUnknownNode for the HierarchicalContourTree
template <typename FieldType, typename DeviceTag> template <typename FieldType>
class FindSuperArcForUnknownNodeDeviceData class FindSuperArcForUnknownNodeDeviceData
{ {
public: public:
using IndicesPortalType = using IndicesPortalType =
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes< typename vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
DeviceTag>::PortalConst; using DataPortalType = typename vtkm::cont::ArrayHandle<FieldType>::ReadPortalType;
using DataPortalType =
typename vtkm::cont::ArrayHandle<FieldType>::template ExecutionTypes<DeviceTag>::PortalConst;
VTKM_CONT VTKM_CONT
FindSuperArcForUnknownNodeDeviceData( FindSuperArcForUnknownNodeDeviceData(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token, vtkm::cont::Token& token,
const vtkm::worklet::contourtree_augmented::IdArrayType& superparents, const vtkm::worklet::contourtree_augmented::IdArrayType& superparents,
const vtkm::worklet::contourtree_augmented::IdArrayType& supernodes, const vtkm::worklet::contourtree_augmented::IdArrayType& supernodes,
@ -93,17 +92,17 @@ public:
{ {
// Prepare the arrays for input and store the array portals // Prepare the arrays for input and store the array portals
// so that they can be used inside a workelt // so that they can be used inside a workelt
this->Superparents = superparents.PrepareForInput(DeviceTag(), token); this->Superparents = superparents.PrepareForInput(device, token);
this->Supernodes = supernodes.PrepareForInput(DeviceTag(), token); this->Supernodes = supernodes.PrepareForInput(device, token);
this->Superarcs = superarcs.PrepareForInput(DeviceTag(), token); this->Superarcs = superarcs.PrepareForInput(device, token);
this->Superchildren = superchildren.PrepareForInput(DeviceTag(), token); this->Superchildren = superchildren.PrepareForInput(device, token);
this->WhichRound = whichRound.PrepareForInput(DeviceTag(), token); this->WhichRound = whichRound.PrepareForInput(device, token);
this->WhichIteration = whichIteration.PrepareForInput(DeviceTag(), token); this->WhichIteration = whichIteration.PrepareForInput(device, token);
this->Hyperparents = hyperparents.PrepareForInput(DeviceTag(), token); this->Hyperparents = hyperparents.PrepareForInput(device, token);
this->Hypernodes = hypernodes.PrepareForInput(DeviceTag(), token); this->Hypernodes = hypernodes.PrepareForInput(device, token);
this->Hyperarcs = hyperarcs.PrepareForInput(DeviceTag(), token); this->Hyperarcs = hyperarcs.PrepareForInput(device, token);
this->RegularNodeGlobalIds = regularNodeGlobalIds.PrepareForInput(DeviceTag(), token); this->RegularNodeGlobalIds = regularNodeGlobalIds.PrepareForInput(device, token);
this->DataValues = dataValues.PrepareForInput(DeviceTag(), token); this->DataValues = dataValues.PrepareForInput(device, token);
} }
/// routine to find the superarc to which a given global Id/value pair maps /// routine to find the superarc to which a given global Id/value pair maps
@ -457,24 +456,23 @@ public:
{ {
} }
VTKM_CONT VTKM_CONT FindSuperArcForUnknownNodeDeviceData<FieldType> PrepareForExecution(
template <typename DeviceTag> vtkm::cont::DeviceAdapterId device,
FindSuperArcForUnknownNodeDeviceData<FieldType, DeviceTag> PrepareForExecution(
DeviceTag,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return FindSuperArcForUnknownNodeDeviceData<FieldType, DeviceTag>(token, return FindSuperArcForUnknownNodeDeviceData<FieldType>(device,
this->Superparents, token,
this->Supernodes, this->Superparents,
this->Superarcs, this->Supernodes,
this->Superchildren, this->Superarcs,
this->WhichRound, this->Superchildren,
this->WhichIteration, this->WhichRound,
this->Hyperparents, this->WhichIteration,
this->Hypernodes, this->Hyperparents,
this->Hyperarcs, this->Hypernodes,
this->RegularNodeGlobalIds, this->Hyperarcs,
this->DataValues); this->RegularNodeGlobalIds,
this->DataValues);
} }
private: private:

@ -67,20 +67,18 @@ namespace contourtree_distributed
// comparator used for initial sort of data values // comparator used for initial sort of data values
template <typename DeviceAdapter>
class PermuteComparatorImpl class PermuteComparatorImpl
{ {
public: public:
using IdPortalType = using IdPortalType = vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
// constructor - takes vectors as parameters // constructor - takes vectors as parameters
VTKM_CONT VTKM_CONT
PermuteComparatorImpl(const vtkm::worklet::contourtree_augmented::IdArrayType& lookup, PermuteComparatorImpl(const vtkm::worklet::contourtree_augmented::IdArrayType& lookup,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: LookupPortal(lookup.PrepareForInput(device, token))
{ // constructor { // constructor
LookupPortal = lookup.PrepareForInput(DeviceAdapter(), token);
} // constructor } // constructor
// () operator - gets called to do comparison // () operator - gets called to do comparison
@ -130,11 +128,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT PermuteComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT PermuteComparatorImpl<DeviceAdapter> PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return PermuteComparatorImpl<DeviceAdapter>(this->Lookup, token); return PermuteComparatorImpl(this->Lookup, device, token);
} }
private: private:

@ -67,13 +67,10 @@ namespace tree_grafter
{ {
/// Comparator used in TreeGrafter::ListNewHypernodes to sort the NewHypernodes arrays /// Comparator used in TreeGrafter::ListNewHypernodes to sort the NewHypernodes arrays
template <typename DeviceAdapter>
class HyperNodeWhenComparatorImpl class HyperNodeWhenComparatorImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
// Default Constructor // Default Constructor
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -121,13 +118,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT HyperNodeWhenComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT HyperNodeWhenComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return HyperNodeWhenComparatorImpl<DeviceAdapter>( return HyperNodeWhenComparatorImpl(this->WhenTransferred.PrepareForInput(device, token));
this->WhenTransferred.PrepareForInput(device, token));
} }
private: private:

@ -67,13 +67,10 @@ namespace tree_grafter
{ {
/// Comparator used in TreeGrafter::ListNewSupernodes to sort the NewSupernodes arrays /// Comparator used in TreeGrafter::ListNewSupernodes to sort the NewSupernodes arrays
template <typename DeviceAdapter>
class PermuteComparatorImpl : public vtkm::worklet::WorkletMapField class PermuteComparatorImpl : public vtkm::worklet::WorkletMapField
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
// Default Constructor // Default Constructor
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -123,11 +120,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT PermuteComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT PermuteComparatorImpl<DeviceAdapter> PrepareForExecution(DeviceAdapter device, vtkm::cont::Token& token) const
vtkm::cont::Token& token) const
{ {
return PermuteComparatorImpl<DeviceAdapter>(this->LookupArray.PrepareForInput(device, token)); return PermuteComparatorImpl(this->LookupArray.PrepareForInput(device, token));
} }
private: private:

@ -67,13 +67,10 @@ namespace tree_grafter
{ {
/// Comparator used in TreeGrafter::ListNewSupernodes to sort the NewSupernodes arrays /// Comparator used in TreeGrafter::ListNewSupernodes to sort the NewSupernodes arrays
template <typename DeviceAdapter>
class SuperNodeWhenComparatorImpl class SuperNodeWhenComparatorImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType = vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes<
DeviceAdapter>::PortalConst;
// Default Constructor // Default Constructor
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -185,18 +182,15 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT SuperNodeWhenComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT SuperNodeWhenComparatorImpl<DeviceAdapter> PrepareForExecution( vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return SuperNodeWhenComparatorImpl<DeviceAdapter>( return SuperNodeWhenComparatorImpl(this->WhenTransferred.PrepareForInput(device, token),
this->WhenTransferred.PrepareForInput(device, token), this->HierarchicalHyperparent.PrepareForInput(device, token),
this->HierarchicalHyperparent.PrepareForInput(device, token), this->HierarchicalHyperId.PrepareForInput(device, token),
this->HierarchicalHyperId.PrepareForInput(device, token), this->HierarchicalHyperarc.PrepareForInput(device, token),
this->HierarchicalHyperarc.PrepareForInput(device, token), this->ContourTreeSupernodes.PrepareForInput(device, token),
this->ContourTreeSupernodes.PrepareForInput(device, token), this->SupernodeType.PrepareForInput(device, token));
this->SupernodeType.PrepareForInput(device, token));
} }
private: private:

@ -67,13 +67,11 @@ namespace tree_grafter
{ {
// Uniary predicate used in TreeGrafter.CompressActiveArrays to decide which active superarcs to keep // Uniary predicate used in TreeGrafter.CompressActiveArrays to decide which active superarcs to keep
template <typename DeviceAdapter>
class SuperarcWasNotTransferredPredicateImpl class SuperarcWasNotTransferredPredicateImpl
{ {
public: public:
using IdArrayPortalType = using IdArrayPortalType =
typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes< typename vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType;
DeviceAdapter>::PortalConst;
// Default Constructor // Default Constructor
VTKM_EXEC_CONT VTKM_EXEC_CONT
@ -109,12 +107,10 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT SuperarcWasNotTransferredPredicateImpl
VTKM_CONT SuperarcWasNotTransferredPredicateImpl<DeviceAdapter> PrepareForExecution( PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
DeviceAdapter device,
vtkm::cont::Token& token) const
{ {
return SuperarcWasNotTransferredPredicateImpl<DeviceAdapter>( return SuperarcWasNotTransferredPredicateImpl(
this->WhenTransferred.PrepareForInput(device, token)); this->WhenTransferred.PrepareForInput(device, token));
} }

@ -27,26 +27,24 @@ namespace vtkm
{ {
namespace exec namespace exec
{ {
template <typename T, typename DeviceAdapter>
template <typename T>
struct GradientScalarOutputExecutionObject struct GradientScalarOutputExecutionObject
{ {
using ValueType = vtkm::Vec<T, 3>; using ValueType = vtkm::Vec<T, 3>;
using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType; using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType;
struct PortalTypes using HandleType = vtkm::cont::ArrayHandle<ValueType>;
{ using PortalType = typename HandleType::WritePortalType;
using HandleType = vtkm::cont::ArrayHandle<ValueType>;
using ExecutionTypes = typename HandleType::template ExecutionTypes<DeviceAdapter>;
using Portal = typename ExecutionTypes::Portal;
};
GradientScalarOutputExecutionObject() = default; GradientScalarOutputExecutionObject() = default;
GradientScalarOutputExecutionObject(vtkm::cont::ArrayHandle<ValueType> gradient, GradientScalarOutputExecutionObject(vtkm::cont::ArrayHandle<ValueType> gradient,
vtkm::Id size, vtkm::Id size,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
this->GradientPortal = gradient.PrepareForOutput(size, DeviceAdapter(), token); this->GradientPortal = gradient.PrepareForOutput(size, device, token);
} }
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
@ -56,7 +54,7 @@ struct GradientScalarOutputExecutionObject
this->GradientPortal.Set(index, value); this->GradientPortal.Set(index, value);
} }
typename PortalTypes::Portal GradientPortal; PortalType GradientPortal;
}; };
template <typename T> template <typename T>
@ -64,14 +62,13 @@ struct GradientScalarOutput : public vtkm::cont::ExecutionObjectBase
{ {
using ValueType = vtkm::Vec<T, 3>; using ValueType = vtkm::Vec<T, 3>;
using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType; using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType;
template <typename Device>
VTKM_CONT vtkm::exec::GradientScalarOutputExecutionObject<T, Device> PrepareForExecution( VTKM_CONT vtkm::exec::GradientScalarOutputExecutionObject<T> PrepareForExecution(
Device, vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return vtkm::exec::GradientScalarOutputExecutionObject<T, Device>( return vtkm::exec::GradientScalarOutputExecutionObject<T>(
this->Gradient, this->Size, token); this->Gradient, this->Size, device, token);
} }
GradientScalarOutput() = default; GradientScalarOutput() = default;
@ -93,19 +90,14 @@ struct GradientScalarOutput : public vtkm::cont::ExecutionObjectBase
vtkm::cont::ArrayHandle<ValueType> Gradient; vtkm::cont::ArrayHandle<ValueType> Gradient;
}; };
template <typename T, typename DeviceAdapter> template <typename T>
struct GradientVecOutputExecutionObject struct GradientVecOutputExecutionObject
{ {
using ValueType = vtkm::Vec<T, 3>; using ValueType = vtkm::Vec<T, 3>;
using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType; using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType;
template <typename FieldType> template <typename FieldType>
struct PortalTypes using PortalType = typename vtkm::cont::ArrayHandle<FieldType>::WritePortalType;
{
using HandleType = vtkm::cont::ArrayHandle<FieldType>;
using ExecutionTypes = typename HandleType::template ExecutionTypes<DeviceAdapter>;
using Portal = typename ExecutionTypes::Portal;
};
GradientVecOutputExecutionObject() = default; GradientVecOutputExecutionObject() = default;
@ -118,6 +110,7 @@ struct GradientVecOutputExecutionObject
vtkm::cont::ArrayHandle<vtkm::Vec<BaseTType, 3>> vorticity, vtkm::cont::ArrayHandle<vtkm::Vec<BaseTType, 3>> vorticity,
vtkm::cont::ArrayHandle<BaseTType> qcriterion, vtkm::cont::ArrayHandle<BaseTType> qcriterion,
vtkm::Id size, vtkm::Id size,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
this->SetGradient = g; this->SetGradient = g;
@ -125,7 +118,6 @@ struct GradientVecOutputExecutionObject
this->SetVorticity = v; this->SetVorticity = v;
this->SetQCriterion = q; this->SetQCriterion = q;
DeviceAdapter device;
if (g) if (g)
{ {
this->GradientPortal = gradient.PrepareForOutput(size, device, token); this->GradientPortal = gradient.PrepareForOutput(size, device, token);
@ -180,10 +172,10 @@ struct GradientVecOutputExecutionObject
bool SetVorticity; bool SetVorticity;
bool SetQCriterion; bool SetQCriterion;
typename PortalTypes<ValueType>::Portal GradientPortal; PortalType<ValueType> GradientPortal;
typename PortalTypes<BaseTType>::Portal DivergencePortal; PortalType<BaseTType> DivergencePortal;
typename PortalTypes<vtkm::Vec<BaseTType, 3>>::Portal VorticityPortal; PortalType<vtkm::Vec<BaseTType, 3>> VorticityPortal;
typename PortalTypes<BaseTType>::Portal QCriterionPortal; PortalType<BaseTType> QCriterionPortal;
}; };
template <typename T> template <typename T>
@ -192,21 +184,21 @@ struct GradientVecOutput : public vtkm::cont::ExecutionObjectBase
using ValueType = vtkm::Vec<T, 3>; using ValueType = vtkm::Vec<T, 3>;
using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType; using BaseTType = typename vtkm::VecTraits<T>::BaseComponentType;
template <typename Device> VTKM_CONT vtkm::exec::GradientVecOutputExecutionObject<T> PrepareForExecution(
VTKM_CONT vtkm::exec::GradientVecOutputExecutionObject<T, Device> PrepareForExecution( vtkm::cont::DeviceAdapterId device,
Device,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return vtkm::exec::GradientVecOutputExecutionObject<T, Device>(this->G, return vtkm::exec::GradientVecOutputExecutionObject<T>(this->G,
this->D, this->D,
this->V, this->V,
this->Q, this->Q,
this->Gradient, this->Gradient,
this->Divergence, this->Divergence,
this->Vorticity, this->Vorticity,
this->Qcriterion, this->Qcriterion,
this->Size, this->Size,
token); device,
token);
} }
GradientVecOutput() = default; GradientVecOutput() = default;

@ -77,11 +77,10 @@ static vtkm::IdComponent TriangleIndexData[] = {
3 3
}; };
template <typename DeviceAdapter>
class TriangulateTablesExecutionObject class TriangulateTablesExecutionObject
{ {
public: public:
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<DeviceAdapter>::PortalConst; using PortalType = TriangulateArrayHandle::ReadPortalType;
VTKM_SUPPRESS_EXEC_WARNINGS VTKM_SUPPRESS_EXEC_WARNINGS
VTKM_EXEC VTKM_EXEC
TriangulateTablesExecutionObject() {} TriangulateTablesExecutionObject() {}
@ -90,10 +89,11 @@ public:
TriangulateTablesExecutionObject(const TriangulateArrayHandle& counts, TriangulateTablesExecutionObject(const TriangulateArrayHandle& counts,
const TriangulateArrayHandle& offsets, const TriangulateArrayHandle& offsets,
const TriangulateArrayHandle& indices, const TriangulateArrayHandle& indices,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: Counts(counts.PrepareForInput(DeviceAdapter(), token)) : Counts(counts.PrepareForInput(device, token))
, Offsets(offsets.PrepareForInput(DeviceAdapter(), token)) , Offsets(offsets.PrepareForInput(device, token))
, Indices(indices.PrepareForInput(DeviceAdapter(), token)) , Indices(indices.PrepareForInput(device, token))
{ {
} }
@ -139,17 +139,15 @@ private:
class TriangulateTablesExecutionObjectFactory : public vtkm::cont::ExecutionObjectBase class TriangulateTablesExecutionObjectFactory : public vtkm::cont::ExecutionObjectBase
{ {
public: public:
template <typename Device> VTKM_CONT TriangulateTablesExecutionObject PrepareForExecution(vtkm::cont::DeviceAdapterId device,
VTKM_CONT TriangulateTablesExecutionObject<Device> PrepareForExecution( vtkm::cont::Token& token) const
Device,
vtkm::cont::Token& token) const
{ {
if (BasicImpl) if (BasicImpl)
{ {
return TriangulateTablesExecutionObject<Device>(); return TriangulateTablesExecutionObject();
} }
return TriangulateTablesExecutionObject<Device>( return TriangulateTablesExecutionObject(
this->Counts, this->Offsets, this->Indices, token); this->Counts, this->Offsets, this->Indices, device, token);
} }
VTKM_CONT VTKM_CONT
TriangulateTablesExecutionObjectFactory() TriangulateTablesExecutionObjectFactory()
@ -291,11 +289,10 @@ static vtkm::IdComponent TetrahedronIndexData[] = {
4 4
}; };
template <typename DeviceAdapter>
class TetrahedralizeTablesExecutionObject class TetrahedralizeTablesExecutionObject
{ {
public: public:
using PortalType = typename TriangulateArrayHandle::ExecutionTypes<DeviceAdapter>::PortalConst; using PortalType = typename TriangulateArrayHandle::ReadPortalType;
template <typename Device> template <typename Device>
VTKM_CONT TetrahedralizeTablesExecutionObject PrepareForExecution(Device) const VTKM_CONT TetrahedralizeTablesExecutionObject PrepareForExecution(Device) const
{ {
@ -309,10 +306,11 @@ public:
TetrahedralizeTablesExecutionObject(const TriangulateArrayHandle& counts, TetrahedralizeTablesExecutionObject(const TriangulateArrayHandle& counts,
const TriangulateArrayHandle& offsets, const TriangulateArrayHandle& offsets,
const TriangulateArrayHandle& indices, const TriangulateArrayHandle& indices,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: Counts(counts.PrepareForInput(DeviceAdapter(), token)) : Counts(counts.PrepareForInput(device, token))
, Offsets(offsets.PrepareForInput(DeviceAdapter(), token)) , Offsets(offsets.PrepareForInput(device, token))
, Indices(indices.PrepareForInput(DeviceAdapter(), token)) , Indices(indices.PrepareForInput(device, token))
{ {
} }
@ -343,17 +341,15 @@ private:
class TetrahedralizeTablesExecutionObjectFactory : public vtkm::cont::ExecutionObjectBase class TetrahedralizeTablesExecutionObjectFactory : public vtkm::cont::ExecutionObjectBase
{ {
public: public:
template <typename Device> VTKM_CONT TetrahedralizeTablesExecutionObject
VTKM_CONT TetrahedralizeTablesExecutionObject<Device> PrepareForExecution( PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
Device,
vtkm::cont::Token& token) const
{ {
if (BasicImpl) if (BasicImpl)
{ {
return TetrahedralizeTablesExecutionObject<Device>(); return TetrahedralizeTablesExecutionObject();
} }
return TetrahedralizeTablesExecutionObject<Device>( return TetrahedralizeTablesExecutionObject(
this->Counts, this->Offsets, this->Indices, token); this->Counts, this->Offsets, this->Indices, device, token);
} }
VTKM_CONT VTKM_CONT

@ -16,7 +16,10 @@
#include <vtkm/VecVariable.h> #include <vtkm/VecVariable.h>
#include <vtkm/cont/ArrayGetValues.h> #include <vtkm/cont/ArrayGetValues.h>
#include <vtkm/cont/CellSetStructured.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/ExecutionObjectBase.h> #include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/cont/VirtualObjectHandle.h>
#include <vtkm/exec/CellInterpolate.h> #include <vtkm/exec/CellInterpolate.h>
/* /*
@ -99,11 +102,10 @@ private:
bool Is3D = true; bool Is3D = true;
}; };
template <typename DeviceAdapter>
class SingleCellTypeInterpolationHelper : public vtkm::exec::CellInterpolationHelper class SingleCellTypeInterpolationHelper : public vtkm::exec::CellInterpolationHelper
{ {
using ConnType = vtkm::cont::ArrayHandle<vtkm::Id>; using ConnType = vtkm::cont::ArrayHandle<vtkm::Id>;
using ConnPortalType = typename ConnType::template ExecutionTypes<DeviceAdapter>::PortalConst; using ConnPortalType = typename ConnType::ReadPortalType;
public: public:
SingleCellTypeInterpolationHelper() = default; SingleCellTypeInterpolationHelper() = default;
@ -112,10 +114,11 @@ public:
SingleCellTypeInterpolationHelper(vtkm::UInt8 cellShape, SingleCellTypeInterpolationHelper(vtkm::UInt8 cellShape,
vtkm::IdComponent pointsPerCell, vtkm::IdComponent pointsPerCell,
const ConnType& connectivity, const ConnType& connectivity,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: CellShape(cellShape) : CellShape(cellShape)
, PointsPerCell(pointsPerCell) , PointsPerCell(pointsPerCell)
, Connectivity(connectivity.PrepareForInput(DeviceAdapter(), token)) , Connectivity(connectivity.PrepareForInput(device, token))
{ {
} }
@ -140,16 +143,15 @@ private:
ConnPortalType Connectivity; ConnPortalType Connectivity;
}; };
template <typename DeviceAdapter>
class ExplicitCellInterpolationHelper : public vtkm::exec::CellInterpolationHelper class ExplicitCellInterpolationHelper : public vtkm::exec::CellInterpolationHelper
{ {
using ShapeType = vtkm::cont::ArrayHandle<vtkm::UInt8>; using ShapeType = vtkm::cont::ArrayHandle<vtkm::UInt8>;
using OffsetType = vtkm::cont::ArrayHandle<vtkm::Id>; using OffsetType = vtkm::cont::ArrayHandle<vtkm::Id>;
using ConnType = vtkm::cont::ArrayHandle<vtkm::Id>; using ConnType = vtkm::cont::ArrayHandle<vtkm::Id>;
using ShapePortalType = typename ShapeType::template ExecutionTypes<DeviceAdapter>::PortalConst; using ShapePortalType = typename ShapeType::ReadPortalType;
using OffsetPortalType = typename OffsetType::template ExecutionTypes<DeviceAdapter>::PortalConst; using OffsetPortalType = typename OffsetType::ReadPortalType;
using ConnPortalType = typename ConnType::template ExecutionTypes<DeviceAdapter>::PortalConst; using ConnPortalType = typename ConnType::ReadPortalType;
public: public:
ExplicitCellInterpolationHelper() = default; ExplicitCellInterpolationHelper() = default;
@ -158,10 +160,11 @@ public:
ExplicitCellInterpolationHelper(const ShapeType& shape, ExplicitCellInterpolationHelper(const ShapeType& shape,
const OffsetType& offset, const OffsetType& offset,
const ConnType& connectivity, const ConnType& connectivity,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: Shape(shape.PrepareForInput(DeviceAdapter(), token)) : Shape(shape.PrepareForInput(device, token))
, Offset(offset.PrepareForInput(DeviceAdapter(), token)) , Offset(offset.PrepareForInput(device, token))
, Connectivity(connectivity.PrepareForInput(DeviceAdapter(), token)) , Connectivity(connectivity.PrepareForInput(device, token))
{ {
} }
@ -294,16 +297,16 @@ public:
struct SingleCellTypeFunctor struct SingleCellTypeFunctor
{ {
template <typename DeviceAdapter> VTKM_CONT bool operator()(vtkm::cont::DeviceAdapterId device,
VTKM_CONT bool operator()(DeviceAdapter,
const vtkm::cont::SingleCellTypeInterpolationHelper& contInterpolator, const vtkm::cont::SingleCellTypeInterpolationHelper& contInterpolator,
HandleType& execInterpolator, HandleType& execInterpolator,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
using ExecutionType = vtkm::exec::SingleCellTypeInterpolationHelper<DeviceAdapter>; using ExecutionType = vtkm::exec::SingleCellTypeInterpolationHelper;
ExecutionType* execObject = new ExecutionType(contInterpolator.CellShape, ExecutionType* execObject = new ExecutionType(contInterpolator.CellShape,
contInterpolator.PointsPerCell, contInterpolator.PointsPerCell,
contInterpolator.Connectivity, contInterpolator.Connectivity,
device,
token); token);
execInterpolator.Reset(execObject); execInterpolator.Reset(execObject);
return true; return true;
@ -353,34 +356,16 @@ public:
throw vtkm::cont::ErrorBadType("Cell set is not of type CellSetExplicit"); throw vtkm::cont::ErrorBadType("Cell set is not of type CellSetExplicit");
} }
struct ExplicitCellFunctor
{
template <typename DeviceAdapter>
VTKM_CONT bool operator()(DeviceAdapter,
const vtkm::cont::ExplicitCellInterpolationHelper& contInterpolator,
HandleType& execInterpolator,
vtkm::cont::Token& token) const
{
using ExecutionType = vtkm::exec::ExplicitCellInterpolationHelper<DeviceAdapter>;
ExecutionType* execObject = new ExecutionType(
contInterpolator.Shape, contInterpolator.Offset, contInterpolator.Connectivity, token);
execInterpolator.Reset(execObject);
return true;
}
};
VTKM_CONT VTKM_CONT
const vtkm::exec::CellInterpolationHelper* PrepareForExecution( const vtkm::exec::CellInterpolationHelper* PrepareForExecution(
vtkm::cont::DeviceAdapterId deviceId, vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const override vtkm::cont::Token& token) const override
{ {
const bool success = vtkm::cont::TryExecuteOnDevice( using ExecutionType = vtkm::exec::ExplicitCellInterpolationHelper;
deviceId, ExplicitCellFunctor(), *this, this->ExecHandle, token); ExecutionType* execObject =
if (!success) new ExecutionType(this->Shape, this->Offset, this->Connectivity, device, token);
{ this->ExecHandle.Reset(execObject);
throwFailedRuntimeDeviceTransfer("ExplicitCellInterpolationHelper", deviceId); return this->ExecHandle.PrepareForExecution(device, token);
}
return this->ExecHandle.PrepareForExecution(deviceId, token);
} }
private: private:

@ -13,8 +13,10 @@
#include <vtkm/Types.h> #include <vtkm/Types.h>
#include <vtkm/VecVariable.h>
#include <vtkm/cont/ArrayHandle.h> #include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/ExecutionObjectBase.h> #include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/cont/VirtualObjectHandle.h>
#include <vtkm/exec/CellInterpolate.h> #include <vtkm/exec/CellInterpolate.h>
namespace vtkm namespace vtkm
@ -38,16 +40,17 @@ public:
vtkm::VecVariable<vtkm::Vec3f, 2>& value) const = 0; vtkm::VecVariable<vtkm::Vec3f, 2>& value) const = 0;
}; };
template <typename DeviceAdapter, typename FieldArrayType> template <typename FieldArrayType>
class ExecutionVelocityField : public vtkm::worklet::particleadvection::ExecutionField class ExecutionVelocityField : public vtkm::worklet::particleadvection::ExecutionField
{ {
public: public:
using FieldPortalType = using FieldPortalType = typename FieldArrayType::ReadPortalType;
typename FieldArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
VTKM_CONT VTKM_CONT
ExecutionVelocityField(FieldArrayType velocityValues, vtkm::cont::Token& token) ExecutionVelocityField(FieldArrayType velocityValues,
: VelocityValues(velocityValues.PrepareForInput(DeviceAdapter(), token)) vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
: VelocityValues(velocityValues.PrepareForInput(device, token))
{ {
} }
@ -69,19 +72,19 @@ private:
FieldPortalType VelocityValues; FieldPortalType VelocityValues;
}; };
template <typename DeviceAdapter, typename FieldArrayType> template <typename FieldArrayType>
class ExecutionElectroMagneticField : public vtkm::worklet::particleadvection::ExecutionField class ExecutionElectroMagneticField : public vtkm::worklet::particleadvection::ExecutionField
{ {
public: public:
using FieldPortalType = using FieldPortalType = typename FieldArrayType::ReadPortalType;
typename FieldArrayType::template ExecutionTypes<DeviceAdapter>::PortalConst;
VTKM_CONT VTKM_CONT
ExecutionElectroMagneticField(FieldArrayType electricValues, ExecutionElectroMagneticField(FieldArrayType electricValues,
FieldArrayType magneticValues, FieldArrayType magneticValues,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: ElectricValues(electricValues.PrepareForInput(DeviceAdapter(), token)) : ElectricValues(electricValues.PrepareForInput(device, token))
, MagneticValues(magneticValues.PrepareForInput(DeviceAdapter(), token)) , MagneticValues(magneticValues.PrepareForInput(device, token))
{ {
} }
@ -131,32 +134,14 @@ public:
{ {
} }
struct VelocityFieldFunctor
{
template <typename DeviceAdapter>
VTKM_CONT bool operator()(DeviceAdapter,
FieldArrayType fieldValues,
HandleType& execHandle,
vtkm::cont::Token& token) const
{
using ExecutionType = ExecutionVelocityField<DeviceAdapter, FieldArrayType>;
ExecutionType* execObject = new ExecutionType(fieldValues, token);
execHandle.Reset(execObject);
return true;
}
};
VTKM_CONT VTKM_CONT
const ExecutionField* PrepareForExecution(vtkm::cont::DeviceAdapterId deviceId, const ExecutionField* PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const override vtkm::cont::Token& token) const override
{ {
const bool success = vtkm::cont::TryExecuteOnDevice( using ExecutionType = ExecutionVelocityField<FieldArrayType>;
deviceId, VelocityFieldFunctor(), this->FieldValues, this->ExecHandle, token); ExecutionType* execObject = new ExecutionType(this->FieldValues, device, token);
if (!success) this->ExecHandle.Reset(execObject);
{ return this->ExecHandle.PrepareForExecution(device, token);
throwFailedRuntimeDeviceTransfer("SingleCellTypeInterpolationHelper", deviceId);
}
return this->ExecHandle.PrepareForExecution(deviceId, token);
} }
private: private:
@ -175,37 +160,15 @@ public:
{ {
} }
struct ElectroMagneticFieldFunctor
{
template <typename DeviceAdapter>
VTKM_CONT bool operator()(DeviceAdapter,
FieldArrayType electricField,
FieldArrayType magneticField,
HandleType& execHandle,
vtkm::cont::Token& token) const
{
using ExecutionType = ExecutionElectroMagneticField<DeviceAdapter, FieldArrayType>;
ExecutionType* execObject = new ExecutionType(electricField, magneticField, token);
execHandle.Reset(execObject);
return true;
}
};
VTKM_CONT VTKM_CONT
const ExecutionField* PrepareForExecution(vtkm::cont::DeviceAdapterId deviceId, const ExecutionField* PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const override vtkm::cont::Token& token) const override
{ {
const bool success = vtkm::cont::TryExecuteOnDevice(deviceId, using ExecutionType = ExecutionElectroMagneticField<FieldArrayType>;
ElectroMagneticFieldFunctor(), ExecutionType* execObject =
this->ElectricField, new ExecutionType(this->ElectricField, this->MagneticField, device, token);
this->MagneticField, this->ExecHandle.Reset(execObject);
this->ExecHandle, return this->ExecHandle.PrepareForExecution(device, token);
token);
if (!success)
{
throwFailedRuntimeDeviceTransfer("SingleCellTypeInterpolationHelper", deviceId);
}
return this->ExecHandle.PrepareForExecution(deviceId, token);
} }
private: private:

@ -22,7 +22,6 @@
#include <vtkm/cont/CellLocatorUniformGrid.h> #include <vtkm/cont/CellLocatorUniformGrid.h>
#include <vtkm/cont/CellSetStructured.h> #include <vtkm/cont/CellSetStructured.h>
#include <vtkm/cont/DataSet.h> #include <vtkm/cont/DataSet.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/worklet/particleadvection/CellInterpolationHelper.h> #include <vtkm/worklet/particleadvection/CellInterpolationHelper.h>
#include <vtkm/worklet/particleadvection/Field.h> #include <vtkm/worklet/particleadvection/Field.h>
@ -36,7 +35,7 @@ namespace worklet
namespace particleadvection namespace particleadvection
{ {
template <typename DeviceAdapter, typename FieldType> template <typename FieldType>
class ExecutionGridEvaluator class ExecutionGridEvaluator
{ {
using GhostCellArrayType = vtkm::cont::ArrayHandle<vtkm::UInt8>; using GhostCellArrayType = vtkm::cont::ArrayHandle<vtkm::UInt8>;
@ -51,13 +50,14 @@ public:
const vtkm::Bounds& bounds, const vtkm::Bounds& bounds,
const FieldType& field, const FieldType& field,
const GhostCellArrayType& ghostCells, const GhostCellArrayType& ghostCells,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: Bounds(bounds) : Bounds(bounds)
, Field(field.PrepareForExecution(DeviceAdapter(), token)) , Field(field.PrepareForExecution(device, token))
, GhostCells(ghostCells.PrepareForInput(DeviceAdapter(), token)) , GhostCells(ghostCells.PrepareForInput(device, token))
, HaveGhostCells(ghostCells.GetNumberOfValues() > 0) , HaveGhostCells(ghostCells.GetNumberOfValues() > 0)
, InterpolationHelper(interpolationHelper->PrepareForExecution(DeviceAdapter(), token)) , InterpolationHelper(interpolationHelper->PrepareForExecution(device, token))
, Locator(locator->PrepareForExecution(DeviceAdapter(), token)) , Locator(locator->PrepareForExecution(device, token))
{ {
} }
@ -143,8 +143,7 @@ private:
return false; return false;
} }
using GhostCellPortal = typename vtkm::cont::ArrayHandle<vtkm::UInt8>::template ExecutionTypes< using GhostCellPortal = typename vtkm::cont::ArrayHandle<vtkm::UInt8>::ReadPortalType;
DeviceAdapter>::PortalConst;
vtkm::Bounds Bounds; vtkm::Bounds Bounds;
const vtkm::worklet::particleadvection::ExecutionField* Field; const vtkm::worklet::particleadvection::ExecutionField* Field;
@ -198,17 +197,17 @@ public:
this->InitializeLocator(coordinates, cellset); this->InitializeLocator(coordinates, cellset);
} }
template <typename DeviceAdapter> VTKM_CONT ExecutionGridEvaluator<FieldType> PrepareForExecution(
VTKM_CONT ExecutionGridEvaluator<DeviceAdapter, FieldType> PrepareForExecution( vtkm::cont::DeviceAdapterId device,
DeviceAdapter,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return ExecutionGridEvaluator<DeviceAdapter, FieldType>(this->Locator, return ExecutionGridEvaluator<FieldType>(this->Locator,
this->InterpolationHelper, this->InterpolationHelper,
this->Bounds, this->Bounds,
this->Field, this->Field,
this->GhostCellArray, this->GhostCellArray,
token); device,
token);
} }
private: private:

@ -16,7 +16,6 @@
#include <vtkm/cont/Algorithm.h> #include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayCopy.h> #include <vtkm/cont/ArrayCopy.h>
#include <vtkm/cont/ArrayHandleConstant.h> #include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/ExecutionObjectBase.h> #include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/worklet/particleadvection/IntegratorStatus.h> #include <vtkm/worklet/particleadvection/IntegratorStatus.h>
@ -26,7 +25,7 @@ namespace worklet
{ {
namespace particleadvection namespace particleadvection
{ {
template <typename Device, typename ParticleType> template <typename ParticleType>
class ParticleExecutionObject class ParticleExecutionObject
{ {
public: public:
@ -39,9 +38,10 @@ public:
ParticleExecutionObject(vtkm::cont::ArrayHandle<ParticleType> particleArray, ParticleExecutionObject(vtkm::cont::ArrayHandle<ParticleType> particleArray,
vtkm::Id maxSteps, vtkm::Id maxSteps,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
{ {
Particles = particleArray.PrepareForInPlace(Device(), token); Particles = particleArray.PrepareForInPlace(device, token);
MaxSteps = maxSteps; MaxSteps = maxSteps;
} }
@ -103,8 +103,7 @@ public:
} }
protected: protected:
using ParticlePortal = using ParticlePortal = typename vtkm::cont::ArrayHandle<ParticleType>::WritePortalType;
typename vtkm::cont::ArrayHandle<ParticleType>::template ExecutionTypes<Device>::Portal;
ParticlePortal Particles; ParticlePortal Particles;
vtkm::Id MaxSteps; vtkm::Id MaxSteps;
@ -114,12 +113,11 @@ template <typename ParticleType>
class Particles : public vtkm::cont::ExecutionObjectBase class Particles : public vtkm::cont::ExecutionObjectBase
{ {
public: public:
template <typename Device> VTKM_CONT vtkm::worklet::particleadvection::ParticleExecutionObject<ParticleType>
VTKM_CONT vtkm::worklet::particleadvection::ParticleExecutionObject<Device, ParticleType> PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
PrepareForExecution(Device, vtkm::cont::Token& token) const
{ {
return vtkm::worklet::particleadvection::ParticleExecutionObject<Device, ParticleType>( return vtkm::worklet::particleadvection::ParticleExecutionObject<ParticleType>(
this->ParticleArray, this->MaxSteps, token); this->ParticleArray, this->MaxSteps, device, token);
} }
VTKM_CONT VTKM_CONT
@ -137,13 +135,13 @@ protected:
}; };
template <typename Device, typename ParticleType> template <typename ParticleType>
class StateRecordingParticleExecutionObject : public ParticleExecutionObject<Device, ParticleType> class StateRecordingParticleExecutionObject : public ParticleExecutionObject<ParticleType>
{ {
public: public:
VTKM_EXEC_CONT VTKM_EXEC_CONT
StateRecordingParticleExecutionObject() StateRecordingParticleExecutionObject()
: ParticleExecutionObject<Device, ParticleType>() : ParticleExecutionObject<ParticleType>()
, History() , History()
, Length(0) , Length(0)
, StepCount() , StepCount()
@ -156,20 +154,21 @@ public:
vtkm::cont::ArrayHandle<vtkm::Id> validPointArray, vtkm::cont::ArrayHandle<vtkm::Id> validPointArray,
vtkm::cont::ArrayHandle<vtkm::Id> stepCountArray, vtkm::cont::ArrayHandle<vtkm::Id> stepCountArray,
vtkm::Id maxSteps, vtkm::Id maxSteps,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: ParticleExecutionObject<Device, ParticleType>(pArray, maxSteps, token) : ParticleExecutionObject<ParticleType>(pArray, maxSteps, device, token)
, Length(maxSteps + 1) , Length(maxSteps + 1)
{ {
vtkm::Id numPos = pArray.GetNumberOfValues(); vtkm::Id numPos = pArray.GetNumberOfValues();
History = historyArray.PrepareForOutput(numPos * Length, Device(), token); History = historyArray.PrepareForOutput(numPos * Length, device, token);
ValidPoint = validPointArray.PrepareForInPlace(Device(), token); ValidPoint = validPointArray.PrepareForInPlace(device, token);
StepCount = stepCountArray.PrepareForInPlace(Device(), token); StepCount = stepCountArray.PrepareForInPlace(device, token);
} }
VTKM_EXEC VTKM_EXEC
void PreStepUpdate(const vtkm::Id& idx) void PreStepUpdate(const vtkm::Id& idx)
{ {
ParticleType p = this->ParticleExecutionObject<Device, ParticleType>::GetParticle(idx); ParticleType p = this->ParticleExecutionObject<ParticleType>::GetParticle(idx);
if (this->StepCount.Get(idx) == 0) if (this->StepCount.Get(idx) == 0)
{ {
vtkm::Id loc = idx * Length; vtkm::Id loc = idx * Length;
@ -182,7 +181,7 @@ public:
VTKM_EXEC VTKM_EXEC
void StepUpdate(const vtkm::Id& idx, vtkm::FloatDefault time, const vtkm::Vec3f& pt) void StepUpdate(const vtkm::Id& idx, vtkm::FloatDefault time, const vtkm::Vec3f& pt)
{ {
this->ParticleExecutionObject<Device, ParticleType>::StepUpdate(idx, time, pt); this->ParticleExecutionObject<ParticleType>::StepUpdate(idx, time, pt);
//local step count. //local step count.
vtkm::Id stepCount = this->StepCount.Get(idx); vtkm::Id stepCount = this->StepCount.Get(idx);
@ -194,10 +193,8 @@ public:
} }
protected: protected:
using IdPortal = using IdPortal = typename vtkm::cont::ArrayHandle<vtkm::Id>::WritePortalType;
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<Device>::Portal; using HistoryPortal = typename vtkm::cont::ArrayHandle<vtkm::Vec3f>::WritePortalType;
using HistoryPortal =
typename vtkm::cont::ArrayHandle<vtkm::Vec3f>::template ExecutionTypes<Device>::Portal;
HistoryPortal History; HistoryPortal History;
vtkm::Id Length; vtkm::Id Length;
@ -220,18 +217,16 @@ public:
}; };
template <typename Device> VTKM_CONT vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject<ParticleType>
VTKM_CONT PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const
vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject<Device, ParticleType>
PrepareForExecution(Device, vtkm::cont::Token& token) const
{ {
return vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject<Device, return vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject<ParticleType>(
ParticleType>(
this->ParticleArray, this->ParticleArray,
this->HistoryArray, this->HistoryArray,
this->ValidPointArray, this->ValidPointArray,
this->StepCountArray, this->StepCountArray,
this->MaxSteps, this->MaxSteps,
device,
token); token);
} }
VTKM_CONT VTKM_CONT

@ -21,13 +21,13 @@ namespace worklet
namespace particleadvection namespace particleadvection
{ {
template <typename DeviceAdapter, typename FieldType> template <typename FieldType>
class ExecutionTemporalGridEvaluator class ExecutionTemporalGridEvaluator
{ {
private: private:
using GridEvaluator = vtkm::worklet::particleadvection::GridEvaluator<FieldType>; using GridEvaluator = vtkm::worklet::particleadvection::GridEvaluator<FieldType>;
using ExecutionGridEvaluator = using ExecutionGridEvaluator =
vtkm::worklet::particleadvection::ExecutionGridEvaluator<DeviceAdapter, FieldType>; vtkm::worklet::particleadvection::ExecutionGridEvaluator<FieldType>;
public: public:
VTKM_CONT VTKM_CONT
@ -38,9 +38,10 @@ public:
const vtkm::FloatDefault timeOne, const vtkm::FloatDefault timeOne,
const GridEvaluator& evaluatorTwo, const GridEvaluator& evaluatorTwo,
const vtkm::FloatDefault timeTwo, const vtkm::FloatDefault timeTwo,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) vtkm::cont::Token& token)
: EvaluatorOne(evaluatorOne.PrepareForExecution(DeviceAdapter(), token)) : EvaluatorOne(evaluatorOne.PrepareForExecution(device, token))
, EvaluatorTwo(evaluatorTwo.PrepareForExecution(DeviceAdapter(), token)) , EvaluatorTwo(evaluatorTwo.PrepareForExecution(device, token))
, TimeOne(timeOne) , TimeOne(timeOne)
, TimeTwo(timeTwo) , TimeTwo(timeTwo)
, TimeDiff(timeTwo - timeOne) , TimeDiff(timeTwo - timeOne)
@ -162,13 +163,12 @@ public:
{ {
} }
template <typename DeviceAdapter> VTKM_CONT ExecutionTemporalGridEvaluator<FieldType> PrepareForExecution(
VTKM_CONT ExecutionTemporalGridEvaluator<DeviceAdapter, FieldType> PrepareForExecution( vtkm::cont::DeviceAdapterId device,
DeviceAdapter,
vtkm::cont::Token& token) const vtkm::cont::Token& token) const
{ {
return ExecutionTemporalGridEvaluator<DeviceAdapter, FieldType>( return ExecutionTemporalGridEvaluator<FieldType>(
this->EvaluatorOne, this->TimeOne, this->EvaluatorTwo, this->TimeTwo, token); this->EvaluatorOne, this->TimeOne, this->EvaluatorTwo, this->TimeTwo, device, token);
} }
private: private:

@ -58,19 +58,6 @@
namespace namespace
{ {
// Functor needed so we can discover the FieldType and DeviceAdapter template parameters to call MergeWith
struct MergeContourTreeMeshFunctor
{
template <typename DeviceAdapterTag, typename FieldType>
bool operator()(DeviceAdapterTag,
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>& in,
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType>& out) const
{
out.template MergeWith<DeviceAdapterTag>(in);
return true;
}
};
template <typename FieldType> template <typename FieldType>
void TestContourTreeMeshCombine(const std::string& mesh1_filename, void TestContourTreeMeshCombine(const std::string& mesh1_filename,
const std::string& mesh2_filename, const std::string& mesh2_filename,
@ -80,7 +67,7 @@ void TestContourTreeMeshCombine(const std::string& mesh1_filename,
contourTreeMesh1.Load(mesh1_filename.c_str()); contourTreeMesh1.Load(mesh1_filename.c_str());
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> contourTreeMesh2; vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> contourTreeMesh2;
contourTreeMesh2.Load(mesh2_filename.c_str()); contourTreeMesh2.Load(mesh2_filename.c_str());
vtkm::cont::TryExecute(MergeContourTreeMeshFunctor{}, contourTreeMesh1, contourTreeMesh2); contourTreeMesh2.MergeWith(contourTreeMesh1);
// Result is written to contourTreeMesh2 // Result is written to contourTreeMesh2
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> combinedContourTreeMesh; vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> combinedContourTreeMesh;
combinedContourTreeMesh.Load(combined_filename.c_str()); combinedContourTreeMesh.Load(combined_filename.c_str());

@ -15,7 +15,6 @@
#include <vtkm/cont/ArrayHandleGroupVec.h> #include <vtkm/cont/ArrayHandleGroupVec.h>
#include <vtkm/cont/CellSetExplicit.h> #include <vtkm/cont/CellSetExplicit.h>
#include <vtkm/cont/DataSet.h> #include <vtkm/cont/DataSet.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/cont/Field.h> #include <vtkm/cont/Field.h>
#include <vtkm/worklet/DispatcherMapField.h> #include <vtkm/worklet/DispatcherMapField.h>
@ -50,11 +49,9 @@ public:
VTKM_CONT VTKM_CONT
TetrahedraPerCell() {} TetrahedraPerCell() {}
template <typename DeviceAdapter>
VTKM_EXEC vtkm::IdComponent operator()( VTKM_EXEC vtkm::IdComponent operator()(
vtkm::UInt8 shape, vtkm::UInt8 shape,
const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject<DeviceAdapter>& tables) const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject& tables) const
const
{ {
return tables.GetCount(vtkm::CellShapeTagGeneric(shape)); return tables.GetCount(vtkm::CellShapeTagGeneric(shape));
} }
@ -82,14 +79,11 @@ public:
} }
// Each cell produces tetrahedra and write result at the offset // Each cell produces tetrahedra and write result at the offset
template <typename CellShapeTag, template <typename CellShapeTag, typename ConnectivityInVec, typename ConnectivityOutVec>
typename ConnectivityInVec,
typename DeviceAdapter,
typename ConnectivityOutVec>
VTKM_EXEC void operator()( VTKM_EXEC void operator()(
CellShapeTag shape, CellShapeTag shape,
const ConnectivityInVec& connectivityIn, const ConnectivityInVec& connectivityIn,
const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject<DeviceAdapter>& tables, const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject& tables,
ConnectivityOutVec& connectivityOut, ConnectivityOutVec& connectivityOut,
vtkm::IdComponent visitIndex) const vtkm::IdComponent visitIndex) const
{ {

@ -52,11 +52,10 @@ public:
VTKM_CONT VTKM_CONT
TrianglesPerCell() {} TrianglesPerCell() {}
template <typename DeviceAdapter>
VTKM_EXEC vtkm::IdComponent operator()( VTKM_EXEC vtkm::IdComponent operator()(
vtkm::UInt8 shape, vtkm::UInt8 shape,
vtkm::IdComponent numPoints, vtkm::IdComponent numPoints,
const vtkm::worklet::internal::TriangulateTablesExecutionObject<DeviceAdapter>& tables) const const vtkm::worklet::internal::TriangulateTablesExecutionObject& tables) const
{ {
return tables.GetCount(vtkm::CellShapeTagGeneric(shape), numPoints); return tables.GetCount(vtkm::CellShapeTagGeneric(shape), numPoints);
} }
@ -84,14 +83,11 @@ public:
} }
// Each cell produces triangles and write result at the offset // Each cell produces triangles and write result at the offset
template <typename CellShapeTag, template <typename CellShapeTag, typename ConnectivityInVec, typename ConnectivityOutVec>
typename ConnectivityInVec,
typename ConnectivityOutVec,
typename DeviceAdapter>
VTKM_EXEC void operator()( VTKM_EXEC void operator()(
CellShapeTag shape, CellShapeTag shape,
const ConnectivityInVec& connectivityIn, const ConnectivityInVec& connectivityIn,
const vtkm::worklet::internal::TriangulateTablesExecutionObject<DeviceAdapter>& tables, const vtkm::worklet::internal::TriangulateTablesExecutionObject& tables,
ConnectivityOutVec& connectivityOut, ConnectivityOutVec& connectivityOut,
vtkm::IdComponent visitIndex) const vtkm::IdComponent visitIndex) const
{ {