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
template <typename Device>
struct ExecutionTypes
struct VTKM_DEPRECATED(1.6, "Use ReadPortalType and WritePortalType.") ExecutionTypes
{
using Portal = WritePortalType;
using PortalConst = ReadPortalType;

@ -228,19 +228,6 @@ using GetWritePortalType =
template <typename ArrayT>
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:
// See note above -- we swap in const portals sometimes.
template <typename ArrayT>

@ -144,6 +144,12 @@ class VTKM_ALWAYS_EXPORT CellSetExplicit : public CellSet
using NumIndicesArrayType =
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 =
@ -216,7 +222,7 @@ public:
const vtkm::cont::ArrayHandle<vtkm::Id, OffsetsStorageTag>& offsets);
template <typename Device, typename VisitTopology, typename IncidentTopology>
struct ExecutionTypes
struct VTKM_DEPRECATED(1.6, "Use ExecConnectivityType.") ExecutionTypes
{
private:
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
@ -229,29 +235,32 @@ public:
using ConnAT = typename Chooser::ConnectivityArrayType;
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:
using ShapesPortalType = typename ShapesET::PortalConst;
using ConnectivityPortalType = typename ConnET::PortalConst;
using OffsetsPortalType = typename OffsetsET::PortalConst;
using ShapesPortalType = typename ShapesAT::ReadPortalType;
using ConnectivityPortalType = typename ConnAT::ReadPortalType;
using OffsetsPortalType = typename OffsetsAT::ReadPortalType;
using ExecObjectType =
vtkm::exec::ConnectivityExplicit<ShapesPortalType, ConnectivityPortalType, OffsetsPortalType>;
};
template <typename Device, typename VisitTopology, typename IncidentTopology>
VTKM_CONT typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType
PrepareForInput(Device, VisitTopology, IncidentTopology, vtkm::cont::Token&) const;
template <typename VisitTopology, typename IncidentTopology>
using ExecConnectivityType =
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_CONT typename ExecutionTypes<Device, VisitTopology, IncidentTopology>::ExecObjectType
PrepareForInput(Device device,
VisitTopology visitTopology,
IncidentTopology incidentTopology) const
VTKM_CONT ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(
vtkm::cont::DeviceAdapterId device,
VisitTopology visitTopology,
IncidentTopology incidentTopology) const
{
vtkm::cont::Token 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 Device, typename VisitTopology, typename IncidentTopology>
template <typename VisitTopology, typename IncidentTopology>
VTKM_CONT
auto CellSetExplicit<SST, CST, OST>
::PrepareForInput(Device, VisitTopology, IncidentTopology, vtkm::cont::Token& token) const
-> typename ExecutionTypes<Device,
VisitTopology,
IncidentTopology>::ExecObjectType
::PrepareForInput(vtkm::cont::DeviceAdapterId device, VisitTopology, IncidentTopology, vtkm::cont::Token& token) const
-> ExecConnectivityType<VisitTopology, IncidentTopology>
{
this->BuildConnectivity(Device{}, VisitTopology{}, IncidentTopology{});
this->BuildConnectivity(device, VisitTopology{}, IncidentTopology{});
const auto& connectivity = this->GetConnectivity(VisitTopology{},
IncidentTopology{});
VTKM_ASSERT(connectivity.ElementsValid);
using ExecObjType = typename ExecutionTypes<Device,
VisitTopology,
IncidentTopology>::ExecObjectType;
using ExecObjType = ExecConnectivityType<VisitTopology, IncidentTopology>;
return ExecObjType(connectivity.Shapes.PrepareForInput(Device{}, token),
connectivity.Connectivity.PrepareForInput(Device{}, token),
connectivity.Offsets.PrepareForInput(Device{}, token));
return ExecObjType(connectivity.Shapes.PrepareForInput(device, token),
connectivity.Connectivity.PrepareForInput(device, token),
connectivity.Offsets.PrepareForInput(device, token));
}
//----------------------------------------------------------------------------

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

@ -104,26 +104,32 @@ public:
template <typename TopologyElement>
SchedulingRangeType GetSchedulingRange(TopologyElement) const;
template <typename VisitTopology, typename IncidentTopology>
using ExecConnectivityType =
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
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_TOPOLOGY_ELEMENT_TAG(VisitTopology);
VTKM_IS_TOPOLOGY_ELEMENT_TAG(IncidentTopology);
using ExecObjectType =
vtkm::exec::ConnectivityStructured<VisitTopology, IncidentTopology, Dimension>;
using ExecObjectType = ExecConnectivityType<VisitTopology, IncidentTopology>;
};
template <typename DeviceAdapter, typename VisitTopology, typename IncidentTopology>
typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType
PrepareForInput(DeviceAdapter, VisitTopology, IncidentTopology, vtkm::cont::Token&) const;
template <typename VisitTopology, typename IncidentTopology>
ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(vtkm::cont::DeviceAdapterId,
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.")
typename ExecutionTypes<DeviceAdapter, VisitTopology, IncidentTopology>::ExecObjectType
PrepareForInput(DeviceAdapter device,
VisitTopology visitTopology,
IncidentTopology incidentTopology) const
ExecConnectivityType<VisitTopology, IncidentTopology> PrepareForInput(
vtkm::cont::DeviceAdapterId device,
VisitTopology visitTopology,
IncidentTopology incidentTopology) const
{
vtkm::cont::Token token;
return this->PrepareForInput(device, visitTopology, incidentTopology, token);

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

@ -83,7 +83,7 @@ public:
template <typename Device>
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
{
return this->ToArray().PrepareForInput(device, token);
@ -91,7 +91,7 @@ public:
template <typename Device>
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
{
return this->ToArray().PrepareForInPlace(device, token);
@ -99,7 +99,7 @@ public:
template <typename Device>
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
{
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
/// used in the execution environment.
///
using ExecObjectType =
typename ContObjectType::template ExecutionTypes<DeviceAdapterTag>::PortalConst;
using ExecObjectType = typename ContObjectType::ReadPortalType;
/// \brief Send data to the execution environment.
///

@ -53,7 +53,7 @@ struct TryArrayInType
using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
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>
transport;

@ -51,7 +51,7 @@ struct TryArrayInOutType
using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
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>
transport;

@ -45,7 +45,7 @@ struct TryArrayOutType
using ArrayHandleType = vtkm::cont::ArrayHandle<T>;
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>
transport;

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

@ -156,11 +156,11 @@ struct ConnIdxToCellIdCalcSingleType
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,
const ConnTableT& connTable,
vtkm::Id numberOfPoints,
Device)
vtkm::cont::DeviceAdapterId device)
{
if (rConnTable.ElementsValid)
{
@ -174,13 +174,13 @@ void ComputeRConnTable(RConnTableT& rConnTable,
{
vtkm::cont::Token token;
const auto offInPortal = connTable.Offsets.PrepareForInput(Device{}, token);
const auto offInPortal = connTable.Offsets.PrepareForInput(device, token);
PassThrough idxCalc{};
ConnIdxToCellIdCalc<decltype(offInPortal)> cellIdCalc{ offInPortal };
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(
@ -189,14 +189,14 @@ void ComputeRConnTable(RConnTableT& rConnTable,
}
// Specialize for CellSetSingleType:
template <typename RConnTableT, typename ConnectivityStorageTag, typename Device>
template <typename RConnTableT, typename ConnectivityStorageTag>
void ComputeRConnTable(RConnTableT& rConnTable,
const ConnectivityExplicitInternals< // SingleType specialization types:
typename vtkm::cont::ArrayHandleConstant<vtkm::UInt8>::StorageTag,
ConnectivityStorageTag,
typename vtkm::cont::ArrayHandleCounting<vtkm::Id>::StorageTag>& connTable,
vtkm::Id numberOfPoints,
Device)
vtkm::cont::DeviceAdapterId device)
{
if (rConnTable.ElementsValid)
{
@ -221,7 +221,7 @@ void ComputeRConnTable(RConnTableT& rConnTable,
ConnIdxToCellIdCalcSingleType cellIdCalc{ cellSize };
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(
static_cast<vtkm::UInt8>(CELL_SHAPE_VERTEX), numberOfPoints);

@ -10,10 +10,10 @@
#ifndef 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/ArrayHandleCast.h>
#include <vtkm/cont/ArrayHandleConstant.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/AtomicArray.h>
#include <vtkm/exec/FunctorBase.h>
@ -133,8 +133,7 @@ public:
typename RConnArray,
typename ROffsetsArray,
typename RConnToConnIdxCalc,
typename ConnIdxToCellIdxCalc,
typename Device>
typename ConnIdxToCellIdxCalc>
inline void Run(const ConnArray& conn,
RConnArray& rConn,
ROffsetsArray& rOffsets,
@ -142,12 +141,10 @@ public:
const ConnIdxToCellIdxCalc& cellIdCalc,
vtkm::Id numberOfPoints,
vtkm::Id rConnSize,
Device)
vtkm::cont::DeviceAdapterId device)
{
using Algo = vtkm::cont::DeviceAdapterAlgorithm<Device>;
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);
// 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
vtkm::cont::ArrayHandle<vtkm::IdComponent> rNumIndices;
{ // allocate and zero the numIndices array:
Algo::Copy(zeros, rNumIndices);
vtkm::cont::Algorithm::Copy(device, zeros, rNumIndices);
}
{ // Build histogram:
vtkm::cont::AtomicArray<vtkm::IdComponent> atomicCounter{ rNumIndices };
vtkm::cont::Token token;
auto ac = atomicCounter.PrepareForExecution(Device(), token);
auto ac = atomicCounter.PrepareForExecution(device, token);
using BuildHisto =
rcb::BuildHistogram<decltype(ac), decltype(connPortal), RConnToConnIdxCalc>;
BuildHisto histoGen{ ac, connPortal, rConnToConnCalc };
Algo::Schedule(histoGen, rConnSize);
vtkm::cont::Algorithm::Schedule(device, histoGen, rConnSize);
}
{ // 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:
Algo::Copy(zeros, rNumIndices);
vtkm::cont::Algorithm::Copy(device, zeros, rNumIndices);
}
// Fill the connectivity table:
@ -197,9 +195,9 @@ public:
{
vtkm::cont::AtomicArray<vtkm::IdComponent> atomicCounter{ rNumIndices };
vtkm::cont::Token token;
auto ac = atomicCounter.PrepareForExecution(Device(), token);
auto rOffsetPortal = rOffsets.PrepareForInput(Device(), token);
auto rConnPortal = rConn.PrepareForOutput(rConnSize, Device(), token);
auto ac = atomicCounter.PrepareForExecution(device, token);
auto rOffsetPortal = rOffsets.PrepareForInput(device, token);
auto rConnPortal = rConn.PrepareForOutput(rConnSize, device, token);
using GenRConnT = rcb::GenerateRConn<decltype(ac),
decltype(connPortal),
@ -209,7 +207,7 @@ public:
ConnIdxToCellIdxCalc>;
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
{
private:
using ArrayPortalIn =
typename ArrayHandle<T,
StorageIn>::template ExecutionTypes<DeviceAdapterTagKokkos>::PortalConst;
using ArrayPortalOut =
typename ArrayHandle<T, StorageOut>::template ExecutionTypes<DeviceAdapterTagKokkos>::Portal;
using ArrayPortalIn = typename ArrayHandle<T, StorageIn>::ReadPortalType;
using ArrayPortalOut = typename ArrayHandle<T, StorageOut>::WritePortalType;
public:
KOKKOS_INLINE_FUNCTION
@ -547,11 +544,8 @@ private:
class ScanInclusiveOperator
{
private:
using ArrayPortalIn =
typename ArrayHandle<T,
StorageIn>::template ExecutionTypes<DeviceAdapterTagKokkos>::PortalConst;
using ArrayPortalOut =
typename ArrayHandle<T, StorageOut>::template ExecutionTypes<DeviceAdapterTagKokkos>::Portal;
using ArrayPortalIn = typename ArrayHandle<T, StorageIn>::ReadPortalType;
using ArrayPortalOut = typename ArrayHandle<T, StorageOut>::WritePortalType;
public:
KOKKOS_INLINE_FUNCTION

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -147,9 +147,9 @@ class CylinderLeafIntersector
{
public:
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 FloatPortal = typename FloatHandle::ExecutionTypes<Device>::PortalConst;
using FloatPortal = typename FloatHandle::ReadPortalType;
IdArrayPortal CylIds;
FloatPortal Radii;

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

@ -104,7 +104,7 @@ class QuadLeafIntersector
public:
using IdType = 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;
QuadLeafIntersector() {}

@ -125,9 +125,9 @@ class SphereLeafIntersector
{
public:
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 FloatPortal = typename FloatHandle::ExecutionTypes<Device>::PortalConst;
using FloatPortal = typename FloatHandle::ReadPortalType;
IdArrayPortal PointIds;
FloatPortal Radii;

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

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

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

@ -66,30 +66,27 @@ public:
VTKM_CONT
vtkm::Id GetNumberOfValues() const { return this->SortedValuesMap.GetNumberOfValues(); }
template <typename Device>
struct ExecutionTypes
{
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 ExecLookup = vtkm::exec::internal::ReduceByKeyLookupBase<
typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType,
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType>;
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 typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device,
vtkm::cont::Token& token) const
VTKM_CONT ExecLookup PrepareForInput(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return
typename ExecutionTypes<Device>::Lookup(this->SortedValuesMap.PrepareForInput(device, token),
this->Offsets.PrepareForInput(device, token),
this->Counts.PrepareForInput(device, token));
return ExecLookup(this->SortedValuesMap.PrepareForInput(device, token),
this->Offsets.PrepareForInput(device, token),
this->Counts.PrepareForInput(device, token));
}
template <typename Device>
VTKM_CONT VTKM_DEPRECATED(1.6, "PrepareForInput now requires a vtkm::cont::Token object.")
typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device) const
VTKM_CONT VTKM_DEPRECATED(1.6,
"PrepareForInput now requires a vtkm::cont::Token object.") ExecLookup
PrepareForInput(vtkm::cont::DeviceAdapterId device) const
{
vtkm::cont::Token token;
return this->PrepareForInput(device, token);
@ -191,32 +188,29 @@ public:
VTKM_CONT
KeyArrayHandleType GetUniqueKeys() const { return this->UniqueKeys; }
template <typename Device>
struct ExecutionTypes
{
using KeyPortal = typename KeyArrayHandleType::template ExecutionTypes<Device>::PortalConst;
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 ExecLookup = vtkm::exec::internal::ReduceByKeyLookup<
typename KeyArrayHandleType::ReadPortalType,
typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType,
typename vtkm::cont::ArrayHandle<vtkm::IdComponent>::ReadPortalType>;
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 typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device,
vtkm::cont::Token& token) const
VTKM_CONT ExecLookup PrepareForInput(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return
typename ExecutionTypes<Device>::Lookup(this->UniqueKeys.PrepareForInput(device, token),
this->SortedValuesMap.PrepareForInput(device, token),
this->Offsets.PrepareForInput(device, token),
this->Counts.PrepareForInput(device, token));
return ExecLookup(this->UniqueKeys.PrepareForInput(device, token),
this->SortedValuesMap.PrepareForInput(device, token),
this->Offsets.PrepareForInput(device, token),
this->Counts.PrepareForInput(device, token));
}
template <typename Device>
VTKM_CONT VTKM_DEPRECATED(1.6, "PrepareForInput now requires a vtkm::cont::Token object.")
typename ExecutionTypes<Device>::Lookup PrepareForInput(Device device) const
VTKM_CONT VTKM_DEPRECATED(1.6,
"PrepareForInput now requires a vtkm::cont::Token object.") ExecLookup
PrepareForInput(vtkm::cont::DeviceAdapterId device) const
{
vtkm::cont::Token token;
return this->PrepareForInput(device, token);
@ -304,7 +298,7 @@ template <typename KeyType, typename Device>
struct Transport<vtkm::cont::arg::TransportTagKeysIn, KeyType, Device>
{
using ContObjectType = KeyType;
using ExecObjectType = typename ContObjectType::template ExecutionTypes<Device>::Lookup;
using ExecObjectType = typename ContObjectType::ExecLookup;
VTKM_CONT
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 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,
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 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,
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 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,
const vtkm::worklet::internal::KeysBase& keys,

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

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

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

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

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

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

@ -793,7 +793,7 @@ struct LeafChainsToContourTree
inline bool operator()(DeviceAdapter device, Args&&... args) const
{
vtkm::cont::Token token;
contourtree_maker_inc_ns::TransferLeafChains_TransferToContourTree<DeviceAdapter> worklet(
contourtree_maker_inc_ns::TransferLeafChains_TransferToContourTree worklet(
this->NumIterations, // (input)
this->IsJoin, // (input)
this->Outdegree, // (input)
@ -801,6 +801,7 @@ struct LeafChainsToContourTree
this->Outbound, // (input)
this->Inbound, // (input)
this->Inwards, // (input)
device,
token);
vtkm::worklet::DispatcherMapField<decltype(worklet)> dispatcher(worklet);
dispatcher.SetDevice(device);
@ -894,6 +895,10 @@ inline void ContourTreeMaker::TransferLeafChains(bool isJoin)
// 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)
isJoin, // (input)
outdegree, // (input)

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

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

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

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

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

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

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

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

@ -67,10 +67,10 @@
#include <fstream>
#include <iostream>
#include <vtkm/Types.h>
#include <vtkm/cont/Algorithm.h>
#include <vtkm/cont/ArrayHandlePermutation.h>
#include <vtkm/cont/ArrayPortalToIterators.h>
#include <vtkm/cont/ArrayRangeCompute.h>
#include <vtkm/cont/DeviceAdapterAlgorithm.h>
#include <vtkm/cont/EnvironmentTracker.h>
#include <vtkm/io/ErrorIO.h>
#include <vtkm/worklet/DispatcherMapField.h>
@ -123,9 +123,8 @@ public:
//Mesh dependent helper functions
void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag>
contourtree_mesh_inc_ns::MeshStructureContourTreeMesh<DeviceTag> PrepareForExecution(
DeviceTag,
contourtree_mesh_inc_ns::MeshStructureContourTreeMesh PrepareForExecution(
vtkm::cont::DeviceAdapterId,
vtkm::cont::Token& token) const;
ContourTreeMesh() {}
@ -165,7 +164,6 @@ public:
vtkm::Id GetNumberOfVertices() const { return this->NumVertices; }
// Combine two ContourTreeMeshes
template <typename DeviceTag>
void MergeWith(ContourTreeMesh<FieldType>& other);
// 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
template <typename FieldType>
template <typename DeviceTag>
contourtree_mesh_inc_ns::MeshStructureContourTreeMesh<DeviceTag> inline ContourTreeMesh<
FieldType>::PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const
contourtree_mesh_inc_ns::MeshStructureContourTreeMesh inline ContourTreeMesh<
FieldType>::PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return contourtree_mesh_inc_ns::MeshStructureContourTreeMesh<DeviceTag>(
this->Neighbours, this->FirstNeighbour, this->MaxNeighbours, this->mGetMax, token);
return contourtree_mesh_inc_ns::MeshStructureContourTreeMesh(
this->Neighbours, this->FirstNeighbour, this->MaxNeighbours, this->mGetMax, device, token);
}
struct NotNoSuchElement
@ -521,7 +519,6 @@ struct NotNoSuchElement
// Combine two ContourTreeMeshes
template <typename FieldType>
template <typename DeviceTag>
inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& other)
{ // Merge With
#ifdef DEBUG_PRINT
@ -565,16 +562,11 @@ inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& ot
IdArrayType overallSortIndex;
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
vtkm::cont::Token tempToken;
mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNext<DeviceTag>
differentFromNextFunctor(
this->GlobalMeshIndex, other.GlobalMeshIndex, overallSortOrder, tempToken);
mesh_dem_contourtree_mesh_inc::CombinedVectorDifferentFromNext differentFromNextFunctor(
this->GlobalMeshIndex, other.GlobalMeshIndex, overallSortOrder);
// Array based on the functor
// TODO: This should really use ArrayHandleDecorator, not ArrayHandleTransform
auto differentFromNextArr = vtkm::cont::make_ArrayHandleTransform(
vtkm::cont::ArrayHandleIndex(overallSortIndex.GetNumberOfValues() - 1),
differentFromNextFunctor);
@ -583,8 +575,6 @@ inline void ContourTreeMesh<FieldType>::MergeWith(ContourTreeMesh<FieldType>& ot
overallSortIndex.WritePortal().Set(0, 0);
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::CopySubRange(
tempArr, 0, tempArr.GetNumberOfValues(), overallSortIndex, 1);

@ -82,9 +82,8 @@ public:
//Mesh dependent helper functions
void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag>
MeshStructureFreudenthal2D<DeviceTag> PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const;
MeshStructureFreudenthal2D PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const;
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
template <typename DeviceTag>
inline MeshStructureFreudenthal2D<DeviceTag>
DataSetMeshTriangulation2DFreudenthal::PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const
inline MeshStructureFreudenthal2D DataSetMeshTriangulation2DFreudenthal::PrepareForExecution(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return MeshStructureFreudenthal2D<DeviceTag>(vtkm::Id2{ this->MeshSize[0], this->MeshSize[1] },
m2d_freudenthal::N_INCIDENT_EDGES,
this->UseGetMax,
this->SortIndices,
this->SortOrder,
this->EdgeBoundaryDetectionMasks,
token);
return MeshStructureFreudenthal2D(vtkm::Id2{ this->MeshSize[0], this->MeshSize[1] },
m2d_freudenthal::N_INCIDENT_EDGES,
this->UseGetMax,
this->SortIndices,
this->SortOrder,
this->EdgeBoundaryDetectionMasks,
device,
token);
}
inline MeshBoundary2DExec DataSetMeshTriangulation2DFreudenthal::GetMeshBoundaryExecutionObject()

@ -87,9 +87,8 @@ public:
// Mesh helper functions
void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag>
MeshStructureFreudenthal3D<DeviceTag> PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const;
MeshStructureFreudenthal3D PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const;
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
template <typename DeviceTag>
inline MeshStructureFreudenthal3D<DeviceTag>
DataSetMeshTriangulation3DFreudenthal::PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const
inline MeshStructureFreudenthal3D DataSetMeshTriangulation3DFreudenthal::PrepareForExecution(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return MeshStructureFreudenthal3D<DeviceTag>(this->MeshSize,
m3d_freudenthal::N_INCIDENT_EDGES,
this->UseGetMax,
this->SortIndices,
this->SortOrder,
this->EdgeBoundaryDetectionMasks,
this->NeighbourOffsets,
this->LinkComponentCaseTable,
token);
return MeshStructureFreudenthal3D(this->MeshSize,
m3d_freudenthal::N_INCIDENT_EDGES,
this->UseGetMax,
this->SortIndices,
this->SortOrder,
this->EdgeBoundaryDetectionMasks,
this->NeighbourOffsets,
this->LinkComponentCaseTable,
device,
token);
}
inline MeshBoundary3DExec DataSetMeshTriangulation3DFreudenthal::GetMeshBoundaryExecutionObject()

@ -91,9 +91,8 @@ public:
// mesh depended helper functions
void SetPrepareForExecutionBehavior(bool getMax);
template <typename DeviceTag>
MeshStructureMarchingCubes<DeviceTag> PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const;
MeshStructureMarchingCubes PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const;
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
template <typename DeviceTag>
inline MeshStructureMarchingCubes<DeviceTag>
DataSetMeshTriangulation3DMarchingCubes::PrepareForExecution(DeviceTag,
vtkm::cont::Token& token) const
inline MeshStructureMarchingCubes DataSetMeshTriangulation3DMarchingCubes::PrepareForExecution(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return MeshStructureMarchingCubes<DeviceTag>(this->MeshSize,
this->UseGetMax,
this->SortIndices,
this->SortOrder,
this->EdgeBoundaryDetectionMasks,
this->CubeVertexPermutations,
this->LinkVertexConnectionsSix,
this->LinkVertexConnectionsEighteen,
this->InCubeConnectionsSix,
this->InCubeConnectionsEighteen,
token);
return MeshStructureMarchingCubes(this->MeshSize,
this->UseGetMax,
this->SortIndices,
this->SortOrder,
this->EdgeBoundaryDetectionMasks,
this->CubeVertexPermutations,
this->LinkVertexConnectionsSix,
this->LinkVertexConnectionsEighteen,
this->InCubeConnectionsSix,
this->InCubeConnectionsEighteen,
device,
token);
}
inline MeshBoundary3DExec DataSetMeshTriangulation3DMarchingCubes::GetMeshBoundaryExecutionObject()

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

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

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

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

@ -78,19 +78,19 @@ namespace mesh_dem_contourtree_mesh_inc
// comparator used for initial sort of data values
template <typename DeviceAdapter>
class ArcComparatorImpl
{
public:
using IdPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
using IdPortalType = vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
// constructor - takes vectors as parameters
VTKM_CONT
ArcComparatorImpl(const IdArrayType& ct_arcs, vtkm::cont::Token& token)
{ // constructor
this->ArcsPortal = ct_arcs.PrepareForInput(DeviceAdapter(), token);
} // constructor
ArcComparatorImpl(const IdArrayType& ct_arcs,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
: ArcsPortal(ct_arcs.PrepareForInput(device, token))
{
}
// () operator - gets called to do comparison
VTKM_EXEC
@ -125,11 +125,10 @@ public:
{
}
template <typename DeviceAdapter>
VTKM_CONT ArcComparatorImpl<DeviceAdapter> PrepareForExecution(DeviceAdapter,
vtkm::cont::Token& token) const
VTKM_CONT ArcComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token) const
{
return ArcComparatorImpl<DeviceAdapter>(this->Arcs, token);
return ArcComparatorImpl(this->Arcs, device, token);
}
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
template <typename FieldType, typename DeviceAdapter>
template <typename FieldType>
class CombinedSimulatedSimplicityIndexComparatorImpl
{
public:
using IdPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
using ValuePortalType = typename vtkm::cont::ArrayHandle<FieldType>::template ExecutionTypes<
DeviceAdapter>::PortalConst;
using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
using ValuePortalType = typename vtkm::cont::ArrayHandle<FieldType>::ReadPortalType;
VTKM_CONT
CombinedSimulatedSimplicityIndexComparatorImpl(
@ -92,13 +90,14 @@ public:
const IdArrayType& otherGlobalMeshIndex,
const vtkm::cont::ArrayHandle<FieldType>& thisSortedValues,
const vtkm::cont::ArrayHandle<FieldType>& otherSortedValues,
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
{
this->ThisGlobalMeshIndex = thisGlobalMeshIndex.PrepareForInput(DeviceAdapter(), token);
this->OtherGlobalMeshIndex = otherGlobalMeshIndex.PrepareForInput(DeviceAdapter(), token);
this->ThisGlobalMeshIndex = thisGlobalMeshIndex.PrepareForInput(device, token);
this->OtherGlobalMeshIndex = otherGlobalMeshIndex.PrepareForInput(device, token);
;
this->ThisSortedValues = thisSortedValues.PrepareForInput(DeviceAdapter(), token);
this->OtherSortedValues = otherSortedValues.PrepareForInput(DeviceAdapter(), token);
this->ThisSortedValues = thisSortedValues.PrepareForInput(device, token);
this->OtherSortedValues = otherSortedValues.PrepareForInput(device, token);
}
VTKM_EXEC_CONT
@ -207,16 +206,16 @@ public:
{
}
template <typename DeviceAdapter>
VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl<FieldType, DeviceAdapter>
PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token)
VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl<FieldType> PrepareForExecution(
vtkm::cont::DeviceAdapterId device,
vtkm::cont::Token& token)
{
return CombinedSimulatedSimplicityIndexComparatorImpl<FieldType, DeviceAdapter>(
this->ThisGlobalMeshIndex,
this->OtherGlobalMeshIndex,
this->ThisSortedValues,
this->OtherSortedValues,
token);
return CombinedSimulatedSimplicityIndexComparatorImpl<FieldType>(this->ThisGlobalMeshIndex,
this->OtherGlobalMeshIndex,
this->ThisSortedValues,
this->OtherSortedValues,
device,
token);
}
private:

@ -76,27 +76,24 @@ namespace contourtree_augmented
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
/// be 1 element shorter than the input arrays
template <typename DeviceAdapter>
class CombinedVectorDifferentFromNext
/// transform functor to compute if element i is different from element i+1 in an arrays. The
/// resulting array should hence be 1 element shorter than the input arrays
class CombinedVectorDifferentFromNextExecObj
{
public:
using IdPortalType =
typename vtkm::cont::ArrayHandle<vtkm::Id>::template ExecutionTypes<DeviceAdapter>::PortalConst;
using IdPortalType = typename vtkm::cont::ArrayHandle<vtkm::Id>::ReadPortalType;
VTKM_EXEC_CONT
CombinedVectorDifferentFromNext() {}
CombinedVectorDifferentFromNextExecObj() {}
VTKM_CONT
CombinedVectorDifferentFromNext(const IdArrayType& thisGlobalMeshIndex,
const IdArrayType& otherGlobalMeshIndex,
const IdArrayType& sortOrder,
vtkm::cont::Token& token)
CombinedVectorDifferentFromNextExecObj(const IdPortalType& thisGlobalMeshIndex,
const IdPortalType& otherGlobalMeshIndex,
const IdPortalType& sortOrder)
: 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
@ -121,6 +118,41 @@ private:
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 contourtree_augmented

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

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

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

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

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

@ -72,19 +72,6 @@ namespace worklet
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
template <typename FieldType>
class ComputeDistributedContourTreeFunctor
@ -171,8 +158,7 @@ public:
#endif
// Merge the two contour tree meshes
vtkm::cont::TryExecute(
MergeContourTreeMeshFunctor{}, otherContourTreeMesh, block->ContourTreeMeshes.back());
block->ContourTreeMeshes.back().MergeWith(otherContourTreeMesh);
timingsStream << " |-->" << std::setw(38) << std::left << "Merge Contour Tree Mesh"
<< ": " << loopTimer.GetElapsedTime() << " seconds" << std::endl;

@ -70,20 +70,6 @@ namespace worklet
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
template <typename FieldType>
void MergeBlockFunctor(
@ -136,7 +122,7 @@ void MergeBlockFunctor(
contourTreeMeshOut.FirstNeighbour = block->FirstNeighbour;
contourTreeMeshOut.MaxNeighbours = block->MaxNeighbours;
// Merge the two contour tree meshes
vtkm::cont::TryExecute(MergeFunctor{}, contourTreeMeshIn, contourTreeMeshOut);
contourTreeMeshOut.MergeWith(contourTreeMeshIn);
// Compute the origin and size of the new block
vtkm::Id3 globalSize = block->GlobalSize;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -58,19 +58,6 @@
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>
void TestContourTreeMeshCombine(const std::string& mesh1_filename,
const std::string& mesh2_filename,
@ -80,7 +67,7 @@ void TestContourTreeMeshCombine(const std::string& mesh1_filename,
contourTreeMesh1.Load(mesh1_filename.c_str());
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> contourTreeMesh2;
contourTreeMesh2.Load(mesh2_filename.c_str());
vtkm::cont::TryExecute(MergeContourTreeMeshFunctor{}, contourTreeMesh1, contourTreeMesh2);
contourTreeMesh2.MergeWith(contourTreeMesh1);
// Result is written to contourTreeMesh2
vtkm::worklet::contourtree_augmented::ContourTreeMesh<FieldType> combinedContourTreeMesh;
combinedContourTreeMesh.Load(combined_filename.c_str());

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

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