From c55d15f397115e4edefecea8b72d88d5fed0eb3d Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Mon, 1 Feb 2021 08:03:11 -0700 Subject: [PATCH] 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. --- vtkm/cont/ArrayHandle.h | 2 +- vtkm/cont/ArrayHandleDecorator.h | 13 -- vtkm/cont/CellSetExplicit.h | 41 +++--- vtkm/cont/CellSetExplicit.hxx | 20 ++- vtkm/cont/CellSetPermutation.h | 125 +++++++++--------- vtkm/cont/CellSetStructured.h | 28 ++-- vtkm/cont/CellSetStructured.hxx | 17 ++- vtkm/cont/CoordinateSystem.h | 6 +- vtkm/cont/arg/Transport.h | 3 +- .../arg/testing/UnitTestTransportArrayIn.cxx | 2 +- .../testing/UnitTestTransportArrayInOut.cxx | 2 +- .../arg/testing/UnitTestTransportArrayOut.cxx | 2 +- .../testing/UnitTestTransportCellSetIn.cxx | 5 +- .../internal/ConnectivityExplicitInternals.h | 14 +- .../internal/ReverseConnectivityBuilder.h | 30 ++--- .../internal/DeviceAdapterAlgorithmKokkos.h | 14 +- vtkm/cont/testing/TestingArrayHandles.h | 40 +++--- vtkm/cont/testing/TestingBitField.h | 2 +- .../TestingCellLocatorRectilinearGrid.h | 5 +- vtkm/cont/testing/TestingDeviceAdapter.h | 11 +- .../UnitTestArrayHandleExtractComponent.cxx | 5 +- .../testing/UnitTestArrayHandleImplicit.cxx | 2 +- .../UnitTestArrayHandlePermutation.cxx | 18 +-- .../testing/UnitTestArrayHandleSwizzle.cxx | 2 +- .../testing/UnitTestArrayHandleTransform.cxx | 11 +- ...CellLocatorBoundingIntervalHierarchyExec.h | 13 +- vtkm/exec/CellLocatorRectilinearGrid.h | 5 +- vtkm/exec/CellLocatorTwoLevel.h | 6 +- vtkm/exec/ConnectivityExtrude.h | 4 +- vtkm/exec/ExecutionWholeArray.h | 4 +- vtkm/exec/PointLocatorSparseGrid.h | 6 +- .../internal/testing/UnitTestTaskStrided.cu | 3 +- .../TwoLevelUniformGridExecutionObject.h | 3 +- vtkm/rendering/Texture2D.h | 3 +- vtkm/rendering/Wireframer.h | 2 +- .../raytracing/BoundingVolumeHierarchy.cxx | 4 +- .../raytracing/CylinderIntersector.cxx | 4 +- .../raytracing/MeshConnectivityBase.h | 8 +- vtkm/rendering/raytracing/QuadIntersector.cxx | 2 +- .../raytracing/SphereIntersector.cxx | 4 +- .../raytracing/TriangleIntersector.cxx | 4 +- .../raytracing/VolumeRendererStructured.cxx | 10 +- vtkm/worklet/Clip.h | 9 +- vtkm/worklet/Keys.h | 78 +++++------ vtkm/worklet/StableSortIndices.h | 10 +- vtkm/worklet/clip/ClipTables.h | 9 +- vtkm/worklet/contour/MarchingCellTables.h | 20 +-- vtkm/worklet/contour/MarchingCells.h | 51 ++++--- vtkm/worklet/contourtree/EdgePeakComparator.h | 23 ++-- .../contourtree/VertexMergeComparator.h | 17 +-- .../contourtree_augmented/ContourTreeMaker.h | 7 +- .../activegraph/EdgePeakComparator.h | 18 +-- .../activegraph/HyperArcSuperNodeComparator.h | 17 +-- .../activegraph/SuperArcNodeComparator.h | 15 +-- .../ContourTreeNodeComparator.h | 17 +-- .../ContourTreeSuperNodeComparator.h | 21 ++- ...TransferLeafChains_TransferToContourTree.h | 15 +-- .../data_set_mesh/MeshStructure2D.h | 1 - .../data_set_mesh/MeshStructure3D.h | 1 - .../SimulatedSimplicityComperator.h | 13 +- .../meshtypes/ContourTreeMesh.h | 32 ++--- .../DataSetMeshTriangulation2DFreudenthal.h | 27 ++-- .../DataSetMeshTriangulation3DFreudenthal.h | 31 +++-- .../DataSetMeshTriangulation3DMarchingCubes.h | 35 +++-- .../meshtypes/MeshStructureContourTreeMesh.h | 9 +- .../meshtypes/MeshStructureFreudenthal2D.h | 20 ++- .../meshtypes/MeshStructureFreudenthal3D.h | 32 ++--- .../meshtypes/MeshStructureMarchingCubes.h | 42 +++--- .../meshtypes/contourtreemesh/ArcComparator.h | 21 ++- ...mbinedSimulatedSimplicityIndexComparator.h | 35 +++-- .../CombinedVectorDifferentFromNext.h | 60 +++++++-- .../meshtypes/mesh_boundary/MeshBoundary2D.h | 26 ++-- .../meshtypes/mesh_boundary/MeshBoundary3D.h | 31 ++--- .../MeshBoundaryContourTreeMesh.h | 18 +-- .../SuperArcVolumetricComparator.h | 22 ++- .../SuperNodeBranchComparator.h | 17 +-- .../ComputeDistributedContourTreeFunctor.h | 16 +-- .../MergeBlockFunctor.h | 16 +-- .../BoundaryTreeNodeComparator.h | 25 ++-- .../ContourTreeNodeHyperArcComparator.h | 15 +-- .../boundary_tree_maker/HyperarcComparator.h | 12 +- .../FindRegularByGlobal.h | 19 ++- .../FindSuperArcForUnknownNode.h | 62 +++++---- .../PermuteComparator.h | 15 +-- .../tree_grafter/HyperNodeWhenComparator.h | 14 +- .../tree_grafter/PermuteComparator.h | 12 +- .../tree_grafter/SuperNodeWhenComparator.h | 24 ++-- .../SuperarcWasNotTransferredPredicate.h | 12 +- vtkm/worklet/gradient/GradientOutput.h | 70 +++++----- vtkm/worklet/internal/TriangulateTables.h | 44 +++--- .../CellInterpolationHelper.h | 59 +++------ vtkm/worklet/particleadvection/Field.h | 85 ++++-------- .../particleadvection/GridEvaluators.h | 33 +++-- vtkm/worklet/particleadvection/Particles.h | 53 ++++---- .../TemporalGridEvaluators.h | 18 +-- .../UnitTestContourTreeUniformDistributed.cxx | 15 +-- .../tetrahedralize/TetrahedralizeExplicit.h | 12 +- .../worklet/triangulate/TriangulateExplicit.h | 10 +- 98 files changed, 840 insertions(+), 1106 deletions(-) diff --git a/vtkm/cont/ArrayHandle.h b/vtkm/cont/ArrayHandle.h index e314f0f89..a83c333b6 100644 --- a/vtkm/cont/ArrayHandle.h +++ b/vtkm/cont/ArrayHandle.h @@ -302,7 +302,7 @@ public: // TODO: Deprecate this template - struct ExecutionTypes + struct VTKM_DEPRECATED(1.6, "Use ReadPortalType and WritePortalType.") ExecutionTypes { using Portal = WritePortalType; using PortalConst = ReadPortalType; diff --git a/vtkm/cont/ArrayHandleDecorator.h b/vtkm/cont/ArrayHandleDecorator.h index 24f3af9ef..1c5c6c32c 100644 --- a/vtkm/cont/ArrayHandleDecorator.h +++ b/vtkm/cont/ArrayHandleDecorator.h @@ -228,19 +228,6 @@ using GetWritePortalType = template using GetReadPortalType = typename std::decay::type::ReadPortalType; -template ::type::template ExecutionTypes::Portal, - typename PortalConst = - typename std::decay::type::template ExecutionTypes::PortalConst> -using GetPortalExecutionType = - typename brigand::if_, Portal, PortalConst>::type; - -template -using GetPortalConstExecutionType = - typename std::decay::type::template ExecutionTypes::PortalConst; - // Get portal objects: // See note above -- we swap in const portals sometimes. template diff --git a/vtkm/cont/CellSetExplicit.h b/vtkm/cont/CellSetExplicit.h index ed3a7d24c..80b450c68 100644 --- a/vtkm/cont/CellSetExplicit.h +++ b/vtkm/cont/CellSetExplicit.h @@ -144,6 +144,12 @@ class VTKM_ALWAYS_EXPORT CellSetExplicit : public CellSet using NumIndicesArrayType = vtkm::cont::ArrayHandleDecorator; + + // Should this be unified with ConnectivityType? + using ExecConnectivityType = + vtkm::exec::ConnectivityExplicit; }; using ConnTypes = @@ -216,7 +222,7 @@ public: const vtkm::cont::ArrayHandle& offsets); template - 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; - using ConnET = typename ConnAT::template ExecutionTypes; - using OffsetsET = typename OffsetsAT::template ExecutionTypes; - 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; }; - template - VTKM_CONT typename ExecutionTypes::ExecObjectType - PrepareForInput(Device, VisitTopology, IncidentTopology, vtkm::cont::Token&) const; + template + using ExecConnectivityType = + typename ConnectivityChooser::ExecConnectivityType; - template + template + VTKM_CONT ExecConnectivityType PrepareForInput( + vtkm::cont::DeviceAdapterId, + VisitTopology, + IncidentTopology, + vtkm::cont::Token&) const; + + template VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.") - VTKM_CONT typename ExecutionTypes::ExecObjectType - PrepareForInput(Device device, - VisitTopology visitTopology, - IncidentTopology incidentTopology) const + VTKM_CONT ExecConnectivityType PrepareForInput( + vtkm::cont::DeviceAdapterId device, + VisitTopology visitTopology, + IncidentTopology incidentTopology) const { vtkm::cont::Token token; return this->PrepareForInput(device, visitTopology, incidentTopology, token); diff --git a/vtkm/cont/CellSetExplicit.hxx b/vtkm/cont/CellSetExplicit.hxx index b5b96efe9..97e513470 100644 --- a/vtkm/cont/CellSetExplicit.hxx +++ b/vtkm/cont/CellSetExplicit.hxx @@ -370,27 +370,23 @@ void CellSetExplicit //---------------------------------------------------------------------------- template -template +template VTKM_CONT auto CellSetExplicit -::PrepareForInput(Device, VisitTopology, IncidentTopology, vtkm::cont::Token& token) const --> typename ExecutionTypes::ExecObjectType +::PrepareForInput(vtkm::cont::DeviceAdapterId device, VisitTopology, IncidentTopology, vtkm::cont::Token& token) const +-> ExecConnectivityType { - 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::ExecObjectType; + using ExecObjType = ExecConnectivityType; - 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)); } //---------------------------------------------------------------------------- diff --git a/vtkm/cont/CellSetPermutation.h b/vtkm/cont/CellSetPermutation.h index 23a496ccb..aabbf08ad 100644 --- a/vtkm/cont/CellSetPermutation.h +++ b/vtkm/cont/CellSetPermutation.h @@ -76,36 +76,36 @@ public: }; public: - template + template static VTKM_CONT vtkm::cont::ArrayHandle GetNumIndicesArray( const CellSetPermutationType& cs, - Device) + vtkm::cont::DeviceAdapterId device) { vtkm::cont::ArrayHandle numIndices; - vtkm::cont::Invoker{ Device{} }(WriteNumIndices{}, cs, numIndices); + vtkm::cont::Invoker{ device }(WriteNumIndices{}, cs, numIndices); return numIndices; } - template + template static VTKM_CONT vtkm::cont::ArrayHandle GetOffsetsArray( const vtkm::cont::ArrayHandle& numIndices, vtkm::Id& connectivityLength /* outparam */, - Device) + vtkm::cont::DeviceAdapterId) { return vtkm::cont::ConvertNumIndicesToOffsets(numIndices, connectivityLength); } - template + template static vtkm::cont::ArrayHandle GetConnectivityArray( const CellSetPermutationType& cs, const vtkm::cont::ArrayHandle& offsets, vtkm::Id connectivityLength, - Device) + vtkm::cont::DeviceAdapterId device) { vtkm::cont::ArrayHandle 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 - 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; - template - 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::StorageTag, typename vtkm::cont::ArrayHandleConstant::StorageTag>; - template - 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(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 - struct ExecutionTypes; +private: + template + struct ConnectivityChooser; - template - struct ExecutionTypes + template <> + struct ConnectivityChooser { - VTKM_IS_DEVICE_ADAPTER_TAG(Device); + using ExecPortalType = typename PermutationArrayHandleType::ReadPortalType; + using OrigExecObjectType = + typename OriginalCellSetType::template ExecConnectivityType; - using ExecPortalType = - typename PermutationArrayHandleType::template ExecutionTypes::PortalConst; - using OrigExecObjectType = typename OriginalCellSetType::template ExecutionTypes< - Device, - vtkm::TopologyElementTagCell, - vtkm::TopologyElementTagPoint>::ExecObjectType; - - using ExecObjectType = + using ExecConnectivityType = vtkm::exec::ConnectivityPermutedVisitCellsWithPoints; }; - template - struct ExecutionTypes + template <> + struct ConnectivityChooser { - VTKM_IS_DEVICE_ADAPTER_TAG(Device); + using ConnectivityPortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; + using NumIndicesPortalType = + typename vtkm::cont::ArrayHandle::ReadPortalType; + using OffsetPortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; - using ConnectivityPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; - using NumIndicesPortalType = typename vtkm::cont::ArrayHandle< - vtkm::IdComponent>::template ExecutionTypes::PortalConst; - using OffsetPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; - - using ExecObjectType = + using ExecConnectivityType = vtkm::exec::ConnectivityPermutedVisitPointsWithCells; }; - template - VTKM_CONT typename ExecutionTypes::ExecObjectType - PrepareForInput(Device device, +public: + template + struct VTKM_DEPRECATED(1.6, "Use ExecConnectivityType.") ExecutionTypes + { + using ExecObjectType = + typename ConnectivityChooser::ExecConnectivityType; + }; + + template + using ExecConnectivityType = + typename ConnectivityChooser::ExecConnectivityType; + + VTKM_CONT ExecConnectivityType + PrepareForInput(vtkm::cont::DeviceAdapterId device, vtkm::TopologyElementTagCell visitTopology, vtkm::TopologyElementTagPoint incidentTopology, vtkm::cont::Token& token) const { - using ConnectivityType = typename ExecutionTypes::ExecObjectType; + using ConnectivityType = + ExecConnectivityType; return ConnectivityType( this->ValidCellIds.PrepareForInput(device, token), this->FullCellSet.PrepareForInput(device, visitTopology, incidentTopology, token)); } - template - VTKM_CONT typename ExecutionTypes::ExecObjectType - PrepareForInput(Device device, + VTKM_CONT ExecConnectivityType + 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::ExecObjectType; + using ConnectivityType = + ExecConnectivityType; return ConnectivityType(this->VisitPointsWithCells.Connectivity.PrepareForInput(device, token), this->VisitPointsWithCells.Offsets.PrepareForInput(device, token)); } - template + template VTKM_CONT VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.") - typename ExecutionTypes::ExecObjectType - PrepareForInput(Device device, VisitTopology visitTopology, IncidentTopology incidentTopology) + ExecConnectivityType PrepareForInput( + vtkm::cont::DeviceAdapterId device, + VisitTopology visitTopology, + IncidentTopology incidentTopology) { vtkm::cont::Token token; return this->PrepareForInput(device, visitTopology, incidentTopology, token); diff --git a/vtkm/cont/CellSetStructured.h b/vtkm/cont/CellSetStructured.h index 680716241..49d5d3414 100644 --- a/vtkm/cont/CellSetStructured.h +++ b/vtkm/cont/CellSetStructured.h @@ -104,26 +104,32 @@ public: template SchedulingRangeType GetSchedulingRange(TopologyElement) const; + template + using ExecConnectivityType = + vtkm::exec::ConnectivityStructured; + template - 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; + using ExecObjectType = ExecConnectivityType; }; - template - typename ExecutionTypes::ExecObjectType - PrepareForInput(DeviceAdapter, VisitTopology, IncidentTopology, vtkm::cont::Token&) const; + template + ExecConnectivityType PrepareForInput(vtkm::cont::DeviceAdapterId, + VisitTopology, + IncidentTopology, + vtkm::cont::Token&) const; - template + template VTKM_DEPRECATED(1.6, "Provide a vtkm::cont::Token object when calling PrepareForInput.") - typename ExecutionTypes::ExecObjectType - PrepareForInput(DeviceAdapter device, - VisitTopology visitTopology, - IncidentTopology incidentTopology) const + ExecConnectivityType PrepareForInput( + vtkm::cont::DeviceAdapterId device, + VisitTopology visitTopology, + IncidentTopology incidentTopology) const { vtkm::cont::Token token; return this->PrepareForInput(device, visitTopology, incidentTopology, token); diff --git a/vtkm/cont/CellSetStructured.hxx b/vtkm/cont/CellSetStructured.hxx index b6ad36445..d4783aa49 100644 --- a/vtkm/cont/CellSetStructured.hxx +++ b/vtkm/cont/CellSetStructured.hxx @@ -25,16 +25,15 @@ typename CellSetStructured::SchedulingRangeType } template -template -typename CellSetStructured:: - template ExecutionTypes::ExecObjectType - CellSetStructured::PrepareForInput(DeviceAdapter, - VisitTopology, - IncidentTopology, - vtkm::cont::Token&) const +template +typename CellSetStructured::template ExecConnectivityType +CellSetStructured::PrepareForInput(vtkm::cont::DeviceAdapterId, + VisitTopology, + IncidentTopology, + vtkm::cont::Token&) const { - using ConnectivityType = - typename ExecutionTypes::ExecObjectType; + using ConnectivityType = ExecConnectivityType; return ConnectivityType(this->Structure); } diff --git a/vtkm/cont/CoordinateSystem.h b/vtkm/cont/CoordinateSystem.h index 7656cfab1..8cf077e9f 100644 --- a/vtkm/cont/CoordinateSystem.h +++ b/vtkm/cont/CoordinateSystem.h @@ -83,7 +83,7 @@ public: template VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - typename ArrayHandleVirtualCoordinates::ExecutionTypes::PortalConst + typename ArrayHandleVirtualCoordinates::ReadPortalType PrepareForInput(Device device, vtkm::cont::Token& token) const { return this->ToArray().PrepareForInput(device, token); @@ -91,7 +91,7 @@ public: template VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - typename ArrayHandleVirtualCoordinates::ExecutionTypes::Portal + typename ArrayHandleVirtualCoordinates::WritePortalType PrepareForInPlace(Device device, vtkm::cont::Token& token) const { return this->ToArray().PrepareForInPlace(device, token); @@ -99,7 +99,7 @@ public: template VTKM_CONT VTKM_DEPRECATED(1.6, "CoordinateSystem::GetData() now returns an UncertainArrayHandle.") - typename ArrayHandleVirtualCoordinates::ExecutionTypes::Portal + typename ArrayHandleVirtualCoordinates::WritePortalType PrepareForOutput(vtkm::Id numberOfValues, Device device, vtkm::cont::Token& token) const { return this->ToArray().PrepareForOutput(numberOfValues, device, token); diff --git a/vtkm/cont/arg/Transport.h b/vtkm/cont/arg/Transport.h index 2718b5049..4e8fbcc0f 100644 --- a/vtkm/cont/arg/Transport.h +++ b/vtkm/cont/arg/Transport.h @@ -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::PortalConst; + using ExecObjectType = typename ContObjectType::ReadPortalType; /// \brief Send data to the execution environment. /// diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx index 2fa2be28b..85c9221f9 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayIn.cxx @@ -53,7 +53,7 @@ struct TryArrayInType using ArrayHandleType = vtkm::cont::ArrayHandle; ArrayHandleType handle = vtkm::cont::make_ArrayHandle(array, ARRAY_SIZE, vtkm::CopyFlag::Off); - using PortalType = typename ArrayHandleType::template ExecutionTypes::PortalConst; + using PortalType = typename ArrayHandleType::ReadPortalType; vtkm::cont::arg::Transport transport; diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx index 28113f168..54ea151c3 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayInOut.cxx @@ -51,7 +51,7 @@ struct TryArrayInOutType using ArrayHandleType = vtkm::cont::ArrayHandle; ArrayHandleType handle = vtkm::cont::make_ArrayHandle(array, ARRAY_SIZE, vtkm::CopyFlag::Off); - using PortalType = typename ArrayHandleType::template ExecutionTypes::Portal; + using PortalType = typename ArrayHandleType::WritePortalType; vtkm::cont::arg::Transport transport; diff --git a/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx b/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx index e547ad890..287deafb4 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportArrayOut.cxx @@ -45,7 +45,7 @@ struct TryArrayOutType using ArrayHandleType = vtkm::cont::ArrayHandle; ArrayHandleType handle; - using PortalType = typename ArrayHandleType::template ExecutionTypes::Portal; + using PortalType = typename ArrayHandleType::WritePortalType; vtkm::cont::arg::Transport transport; diff --git a/vtkm/cont/arg/testing/UnitTestTransportCellSetIn.cxx b/vtkm/cont/arg/testing/UnitTestTransportCellSetIn.cxx index 933912c36..25e04e212 100644 --- a/vtkm/cont/arg/testing/UnitTestTransportCellSetIn.cxx +++ b/vtkm/cont/arg/testing/UnitTestTransportCellSetIn.cxx @@ -62,8 +62,9 @@ void TransportWholeCellSetIn(Device) using IncidentTopology = vtkm::TopologyElementTagPoint; using VisitTopology = vtkm::TopologyElementTagCell; - using ExecObjectType = typename vtkm::cont::CellSetExplicit<>:: - template ExecutionTypes::ExecObjectType; + using ExecObjectType = + typename vtkm::cont::CellSetExplicit<>::template ExecConnectivityType; vtkm::cont::arg::Transport< vtkm::cont::arg::TransportTagCellSetIn, diff --git a/vtkm/cont/internal/ConnectivityExplicitInternals.h b/vtkm/cont/internal/ConnectivityExplicitInternals.h index c0a1d5d3d..098890b44 100644 --- a/vtkm/cont/internal/ConnectivityExplicitInternals.h +++ b/vtkm/cont/internal/ConnectivityExplicitInternals.h @@ -156,11 +156,11 @@ struct ConnIdxToCellIdCalcSingleType vtkm::Id operator()(vtkm::Id inIdx) const { return inIdx / this->CellSize; } }; -template +template 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 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 +template void ComputeRConnTable(RConnTableT& rConnTable, const ConnectivityExplicitInternals< // SingleType specialization types: typename vtkm::cont::ArrayHandleConstant::StorageTag, ConnectivityStorageTag, typename vtkm::cont::ArrayHandleCounting::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(CELL_SHAPE_VERTEX), numberOfPoints); diff --git a/vtkm/cont/internal/ReverseConnectivityBuilder.h b/vtkm/cont/internal/ReverseConnectivityBuilder.h index 0d0191cdf..e18695ed0 100644 --- a/vtkm/cont/internal/ReverseConnectivityBuilder.h +++ b/vtkm/cont/internal/ReverseConnectivityBuilder.h @@ -10,10 +10,10 @@ #ifndef vtk_m_cont_internal_ReverseConnectivityBuilder_h #define vtk_m_cont_internal_ReverseConnectivityBuilder_h +#include #include #include #include -#include #include #include @@ -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; - 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 rNumIndices; { // allocate and zero the numIndices array: - Algo::Copy(zeros, rNumIndices); + vtkm::cont::Algorithm::Copy(device, zeros, rNumIndices); } { // Build histogram: vtkm::cont::AtomicArray atomicCounter{ rNumIndices }; vtkm::cont::Token token; - auto ac = atomicCounter.PrepareForExecution(Device(), token); + auto ac = atomicCounter.PrepareForExecution(device, token); using BuildHisto = rcb::BuildHistogram; BuildHisto histoGen{ ac, connPortal, rConnToConnCalc }; - Algo::Schedule(histoGen, rConnSize); + vtkm::cont::Algorithm::Schedule(device, histoGen, rConnSize); } { // Compute offsets: - Algo::ScanExtended(vtkm::cont::make_ArrayHandleCast(rNumIndices), rOffsets); + vtkm::cont::Algorithm::ScanExtended( + device, vtkm::cont::make_ArrayHandleCast(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 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; GenRConnT rConnGen{ ac, connPortal, rOffsetPortal, rConnPortal, rConnToConnCalc, cellIdCalc }; - Algo::Schedule(rConnGen, rConnSize); + vtkm::cont::Algorithm::Schedule(device, rConnGen, rConnSize); } } }; diff --git a/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h b/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h index f35aaf42c..57126c9e8 100644 --- a/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h +++ b/vtkm/cont/kokkos/internal/DeviceAdapterAlgorithmKokkos.h @@ -417,11 +417,8 @@ private: class ScanExclusiveOperator { private: - using ArrayPortalIn = - typename ArrayHandle::template ExecutionTypes::PortalConst; - using ArrayPortalOut = - typename ArrayHandle::template ExecutionTypes::Portal; + using ArrayPortalIn = typename ArrayHandle::ReadPortalType; + using ArrayPortalOut = typename ArrayHandle::WritePortalType; public: KOKKOS_INLINE_FUNCTION @@ -547,11 +544,8 @@ private: class ScanInclusiveOperator { private: - using ArrayPortalIn = - typename ArrayHandle::template ExecutionTypes::PortalConst; - using ArrayPortalOut = - typename ArrayHandle::template ExecutionTypes::Portal; + using ArrayPortalIn = typename ArrayHandle::ReadPortalType; + using ArrayPortalOut = typename ArrayHandle::WritePortalType; public: KOKKOS_INLINE_FUNCTION diff --git a/vtkm/cont/testing/TestingArrayHandles.h b/vtkm/cont/testing/TestingArrayHandles.h index f75930b68..174357894 100644 --- a/vtkm/cont/testing/TestingArrayHandles.h +++ b/vtkm/cont/testing/TestingArrayHandles.h @@ -210,8 +210,8 @@ private: std::cout << "Check out execution array behavior." << std::endl; { //as input vtkm::cont::Token token; - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst - executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token); + typename vtkm::cont::ArrayHandle::ReadPortalType executionPortal = + arrayHandle.PrepareForInput(DeviceAdapterTag(), token); token.DetachFromAll(); static_cast(executionPortal); @@ -224,8 +224,8 @@ private: std::cout << "Check out inplace." << std::endl; { //as inplace vtkm::cont::Token token; - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal - executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); + typename vtkm::cont::ArrayHandle::WritePortalType executionPortal = + arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); token.DetachFromAll(); static_cast(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::template ExecutionTypes::PortalConst - executionPortal = arrayHandle.PrepareForInput(DeviceAdapterTag(), token); + typename vtkm::cont::ArrayHandle::ReadPortalType executionPortal = + arrayHandle.PrepareForInput(DeviceAdapterTag(), token); token.DetachFromAll(); static_cast(executionPortal); @@ -316,8 +316,8 @@ private: std::cout << "Check out inplace." << std::endl; { //as inplace vtkm::cont::Token token; - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal - executionPortal = arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); + typename vtkm::cont::ArrayHandle::WritePortalType executionPortal = + arrayHandle.PrepareForInPlace(DeviceAdapterTag(), token); token.DetachFromAll(); static_cast(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::template ExecutionTypes::PortalConst - executionPortal; + typename vtkm::cont::ArrayHandle::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::template ExecutionTypes::Portal - executionPortal; + typename vtkm::cont::ArrayHandle::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::template ExecutionTypes::PortalConst - executionPortal; + typename vtkm::cont::ArrayHandle::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::template ExecutionTypes::Portal - executionPortal; + typename vtkm::cont::ArrayHandle::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::template ExecutionTypes::Portal; + using ExecutionPortalType = typename vtkm::cont::ArrayHandle::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::template ExecutionTypes::Portal; + using ExecutionPortalType = typename vtkm::cont::ArrayHandle::WritePortalType; // Reset array data. Algorithm::Schedule(AssignTestValue{ arrayHandle.PrepareForOutput( @@ -587,8 +581,7 @@ private: "ArrayHandle has wrong number of entries."); { vtkm::cont::Token token; - using ExecutionPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal; + using ExecutionPortalType = typename vtkm::cont::ArrayHandle::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::template ExecutionTypes::Portal; + using ExecutionPortalType = typename vtkm::cont::ArrayHandle::WritePortalType; // Reset array data. Algorithm::Schedule(AssignTestValue{ arrayHandle.PrepareForOutput( diff --git a/vtkm/cont/testing/TestingBitField.h b/vtkm/cont/testing/TestingBitField.h index 495251eb4..9ff25bab5 100644 --- a/vtkm/cont/testing/TestingBitField.h +++ b/vtkm/cont/testing/TestingBitField.h @@ -520,7 +520,7 @@ struct TestingBitField struct ArrayHandleBitFieldChecker : vtkm::exec::FunctorBase { - using PortalType = typename ArrayHandleBitField::ExecutionTypes::Portal; + using PortalType = vtkm::cont::ArrayHandleBitField::WritePortalType; PortalType Portal; bool InvertReference; diff --git a/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h b/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h index 1a4e41af1..8925992b5 100644 --- a/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h +++ b/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h @@ -29,11 +29,10 @@ class LocatorWorklet : public vtkm::worklet::WorkletMapField { public: using AxisHandle = vtkm::cont::ArrayHandle; - using AxisPortalType = typename AxisHandle::template ExecutionTypes::PortalConst; + using AxisPortalType = typename AxisHandle::ReadPortalType; using RectilinearType = vtkm::cont::ArrayHandleCartesianProduct; - using RectilinearPortalType = - typename RectilinearType::template ExecutionTypes::PortalConst; + using RectilinearPortalType = typename RectilinearType::ReadPortalType; LocatorWorklet(vtkm::Bounds& bounds, vtkm::Id3& dims, diff --git a/vtkm/cont/testing/TestingDeviceAdapter.h b/vtkm/cont/testing/TestingDeviceAdapter.h index d76701506..42c34e86f 100644 --- a/vtkm/cont/testing/TestingDeviceAdapter.h +++ b/vtkm/cont/testing/TestingDeviceAdapter.h @@ -73,9 +73,8 @@ private: using ScalarArrayHandle = vtkm::cont::ArrayHandle; using FloatCastHandle = vtkm::cont::ArrayHandleCast; - using IdPortalType = typename IdArrayHandle::template ExecutionTypes::Portal; - using IdPortalConstType = - typename IdArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = typename IdArrayHandle::WritePortalType; + using IdPortalConstType = typename IdArrayHandle::ReadPortalType; using Algorithm = vtkm::cont::DeviceAdapterAlgorithm; @@ -172,7 +171,7 @@ public: struct OverlapKernel { using ArrayType = ArrayHandle; - using PortalType = typename ArrayType::template ExecutionTypes::Portal; + using PortalType = typename ArrayType::WritePortalType; PortalType TrackerPortal; PortalType ValidPortal; @@ -788,7 +787,7 @@ private: { using BoolArray = ArrayHandle; - using BoolPortal = typename BoolArray::template ExecutionTypes::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; - using BoolPortal = typename BoolArray::template ExecutionTypes::Portal; + using BoolPortal = typename BoolArray::WritePortalType; BoolArray tracker; BoolArray valid; diff --git a/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx b/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx index 1c1ad9dba..704efed1e 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleExtractComponent.cxx @@ -156,9 +156,8 @@ struct ExtractComponentTests InputArray composite = this->BuildInputArray(); ExtractArray extract(composite, component); - using Portal = typename ExtractArray::template ExecutionTypes::Portal; - using RefPortal = - typename ReferenceCompositeArray::template ExecutionTypes::PortalConst; + using Portal = typename ExtractArray::WritePortalType; + using RefPortal = typename ReferenceCompositeArray::ReadPortalType; { vtkm::cont::Token token; diff --git a/vtkm/cont/testing/UnitTestArrayHandleImplicit.cxx b/vtkm/cont/testing/UnitTestArrayHandleImplicit.cxx index fa7d79f0f..cbde27750 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleImplicit.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleImplicit.cxx @@ -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::PortalConst; + using CEPortal = typename ImplicitHandle::ReadPortalType; CEPortal execPortal = implicit.PrepareForInput(Device(), token); for (int i = 0; i < ARRAY_SIZE; ++i) { diff --git a/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx b/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx index fe5e72978..3ef169b89 100644 --- a/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandlePermutation.cxx @@ -55,14 +55,12 @@ struct CheckPermutationFunctor : vtkm::exec::FunctorBase }; template -VTKM_CONT CheckPermutationFunctor< - typename PermutedArrayHandleType::template ExecutionTypes::PortalConst> +VTKM_CONT CheckPermutationFunctor make_CheckPermutationFunctor(const PermutedArrayHandleType& permutedArray, Device, vtkm::cont::Token& token) { - using PermutedPortalType = - typename PermutedArrayHandleType::template ExecutionTypes::PortalConst; + using PermutedPortalType = typename PermutedArrayHandleType::ReadPortalType; CheckPermutationFunctor functor; functor.PermutedPortal = permutedArray.PrepareForInput(Device(), token); return functor; @@ -86,14 +84,12 @@ struct InPlacePermutationFunctor : vtkm::exec::FunctorBase }; template -VTKM_CONT InPlacePermutationFunctor< - typename PermutedArrayHandleType::template ExecutionTypes::Portal> +VTKM_CONT InPlacePermutationFunctor make_InPlacePermutationFunctor(PermutedArrayHandleType& permutedArray, Device, vtkm::cont::Token& token) { - using PermutedPortalType = - typename PermutedArrayHandleType::template ExecutionTypes::Portal; + using PermutedPortalType = typename PermutedArrayHandleType::WritePortalType; InPlacePermutationFunctor functor; functor.PermutedPortal = permutedArray.PrepareForInPlace(Device(), token); return functor; @@ -137,14 +133,12 @@ struct OutputPermutationFunctor : vtkm::exec::FunctorBase }; template -VTKM_CONT OutputPermutationFunctor< - typename PermutedArrayHandleType::template ExecutionTypes::Portal> +VTKM_CONT OutputPermutationFunctor make_OutputPermutationFunctor(PermutedArrayHandleType& permutedArray, Device, vtkm::cont::Token& token) { - using PermutedPortalType = - typename PermutedArrayHandleType::template ExecutionTypes::Portal; + using PermutedPortalType = typename PermutedArrayHandleType::WritePortalType; OutputPermutationFunctor functor; functor.PermutedPortal = permutedArray.PrepareForOutput(ARRAY_SIZE, Device(), token); return functor; diff --git a/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx b/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx index 4c34bfaf4..4309f1621 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleSwizzle.cxx @@ -146,7 +146,7 @@ struct SwizzleTests bool operator()(DeviceTag, SwizzleHandleType& swizzle) const { vtkm::cont::Token token; - using Portal = typename SwizzleHandleType::template ExecutionTypes::Portal; + using Portal = typename SwizzleHandleType::WritePortalType; WriteTestFunctor functor(swizzle.PrepareForInPlace(DeviceTag(), token)); Algo::Schedule(functor, swizzle.GetNumberOfValues()); return true; diff --git a/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx b/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx index 22a61b53d..aa2ae9eec 100644 --- a/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx +++ b/vtkm/cont/testing/UnitTestArrayHandleTransform.cxx @@ -54,18 +54,15 @@ struct CheckTransformFunctor : vtkm::exec::FunctorBase }; template -VTKM_CONT CheckTransformFunctor< - typename OriginalArrayHandleType::template ExecutionTypes::PortalConst, - typename TransformedArrayHandleType::template ExecutionTypes::PortalConst> +VTKM_CONT CheckTransformFunctor make_CheckTransformFunctor(const OriginalArrayHandleType& originalArray, const TransformedArrayHandleType& transformedArray, Device, vtkm::cont::Token& token) { - using OriginalPortalType = - typename OriginalArrayHandleType::template ExecutionTypes::PortalConst; - using TransformedPortalType = - typename TransformedArrayHandleType::template ExecutionTypes::PortalConst; + using OriginalPortalType = typename OriginalArrayHandleType::ReadPortalType; + using TransformedPortalType = typename TransformedArrayHandleType::ReadPortalType; CheckTransformFunctor functor; functor.OriginalPortal = originalArray.PrepareForInput(Device(), token); functor.TransformedPortal = transformedArray.PrepareForInput(Device(), token); diff --git a/vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h b/vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h index 6bf82db83..e4607dd61 100644 --- a/vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h +++ b/vtkm/exec/CellLocatorBoundingIntervalHierarchyExec.h @@ -272,14 +272,11 @@ private: using VisitType = vtkm::TopologyElementTagCell; using IncidentType = vtkm::TopologyElementTagPoint; - using NodePortal = typename NodeArrayHandle::template ExecutionTypes::PortalConst; - using CellIdPortal = - typename CellIdArrayHandle::template ExecutionTypes::PortalConst; - using CellSetPortal = typename CellSetType:: - template ExecutionTypes::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; + using CoordsPortal = typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType; NodePortal Nodes; CellIdPortal CellIds; diff --git a/vtkm/exec/CellLocatorRectilinearGrid.h b/vtkm/exec/CellLocatorRectilinearGrid.h index 14bbb4aa5..f4e963d88 100644 --- a/vtkm/exec/CellLocatorRectilinearGrid.h +++ b/vtkm/exec/CellLocatorRectilinearGrid.h @@ -39,9 +39,8 @@ private: using AxisHandle = vtkm::cont::ArrayHandle; using RectilinearType = vtkm::cont::ArrayHandleCartesianProduct; - using AxisPortalType = typename AxisHandle::template ExecutionTypes::PortalConst; - using RectilinearPortalType = - typename RectilinearType::template ExecutionTypes::PortalConst; + using AxisPortalType = typename AxisHandle::ReadPortalType; + using RectilinearPortalType = typename RectilinearType::ReadPortalType; public: VTKM_CONT diff --git a/vtkm/exec/CellLocatorTwoLevel.h b/vtkm/exec/CellLocatorTwoLevel.h index 3dd9132c0..005003b16 100644 --- a/vtkm/exec/CellLocatorTwoLevel.h +++ b/vtkm/exec/CellLocatorTwoLevel.h @@ -87,12 +87,10 @@ private: using FloatVec3 = vtkm::internal::cl_uniform_bins::FloatVec3; template - using ArrayPortalConst = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using ArrayPortalConst = typename vtkm::cont::ArrayHandle::ReadPortalType; using CoordsPortalType = - typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ExecutionTypes< - DeviceAdapter>::PortalConst; + typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType; using CellSetP2CExecType = decltype(std::declval().PrepareForInput(DeviceAdapter{}, diff --git a/vtkm/exec/ConnectivityExtrude.h b/vtkm/exec/ConnectivityExtrude.h index 527618cd4..a59e1a7fb 100644 --- a/vtkm/exec/ConnectivityExtrude.h +++ b/vtkm/exec/ConnectivityExtrude.h @@ -28,7 +28,7 @@ class VTKM_ALWAYS_EXPORT ConnectivityExtrude { private: using Int32HandleType = vtkm::cont::ArrayHandle; - using Int32PortalType = typename Int32HandleType::template ExecutionTypes::PortalConst; + using Int32PortalType = typename Int32HandleType::ReadPortalType; public: using ConnectivityPortalType = Int32PortalType; @@ -98,7 +98,7 @@ class ReverseConnectivityExtrude { private: using Int32HandleType = vtkm::cont::ArrayHandle; - using Int32PortalType = typename Int32HandleType::template ExecutionTypes::PortalConst; + using Int32PortalType = typename Int32HandleType::ReadPortalType; public: using ConnectivityPortalType = Int32PortalType; diff --git a/vtkm/exec/ExecutionWholeArray.h b/vtkm/exec/ExecutionWholeArray.h index 451943566..ce74966df 100644 --- a/vtkm/exec/ExecutionWholeArray.h +++ b/vtkm/exec/ExecutionWholeArray.h @@ -33,7 +33,7 @@ class ExecutionWholeArray public: using ValueType = T; using HandleType = vtkm::cont::ArrayHandle; - using PortalType = typename HandleType::template ExecutionTypes::Portal; + using PortalType = typename HandleType::WritePortalType; VTKM_CONT ExecutionWholeArray() @@ -97,7 +97,7 @@ class ExecutionWholeArrayConst public: using ValueType = T; using HandleType = vtkm::cont::ArrayHandle; - using PortalType = typename HandleType::template ExecutionTypes::PortalConst; + using PortalType = typename HandleType::ReadPortalType; VTKM_CONT ExecutionWholeArrayConst() diff --git a/vtkm/exec/PointLocatorSparseGrid.h b/vtkm/exec/PointLocatorSparseGrid.h index 9d1b40701..5fd2bccfe 100644 --- a/vtkm/exec/PointLocatorSparseGrid.h +++ b/vtkm/exec/PointLocatorSparseGrid.h @@ -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::template ExecutionTypes::PortalConst; + typename vtkm::cont::CoordinateSystem::MultiplexerArrayType::ReadPortalType; + using IdPortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; PointLocatorSparseGrid() = default; diff --git a/vtkm/exec/cuda/internal/testing/UnitTestTaskStrided.cu b/vtkm/exec/cuda/internal/testing/UnitTestTaskStrided.cu index 0a895cc80..0a7a3a352 100644 --- a/vtkm/exec/cuda/internal/testing/UnitTestTaskStrided.cu +++ b/vtkm/exec/cuda/internal/testing/UnitTestTaskStrided.cu @@ -40,8 +40,7 @@ namespace struct TestExecObject { - using PortalType = - vtkm::cont::ArrayHandle::ExecutionTypes::Portal; + using PortalType = vtkm::cont::ArrayHandle::WritePortalType; VTKM_EXEC_CONT TestExecObject(PortalType portal) diff --git a/vtkm/exec/internal/TwoLevelUniformGridExecutionObject.h b/vtkm/exec/internal/TwoLevelUniformGridExecutionObject.h index 06515bf17..16f90ada1 100644 --- a/vtkm/exec/internal/TwoLevelUniformGridExecutionObject.h +++ b/vtkm/exec/internal/TwoLevelUniformGridExecutionObject.h @@ -36,8 +36,7 @@ struct TwoLevelUniformGridExecutionObject template - using ArrayPortalConst = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using ArrayPortalConst = typename vtkm::cont::ArrayHandle::ReadPortalType; Grid TopLevel; diff --git a/vtkm/rendering/Texture2D.h b/vtkm/rendering/Texture2D.h index b86612ec5..27f72732c 100644 --- a/vtkm/rendering/Texture2D.h +++ b/vtkm/rendering/Texture2D.h @@ -92,8 +92,7 @@ public: class Texture2DSamplerExecutionObject { public: - using TextureExecPortal = - typename TextureDataHandle::template ExecutionTypes::PortalConst; + using TextureExecPortal = typename TextureDataHandle::ReadPortalType; VTKM_CONT Texture2DSamplerExecutionObject() diff --git a/vtkm/rendering/Wireframer.h b/vtkm/rendering/Wireframer.h index c720ad2c2..8d89e6ce6 100644 --- a/vtkm/rendering/Wireframer.h +++ b/vtkm/rendering/Wireframer.h @@ -303,7 +303,7 @@ public: } private: - using ColorMapPortalConst = typename ColorMapHandle::ExecutionTypes::PortalConst; + using ColorMapPortalConst = typename ColorMapHandle::ReadPortalType; VTKM_EXEC void TransformWorldToViewport(vtkm::Vec3f_32& point) const diff --git a/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx b/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx index 7b3a85cfe..2d1314abc 100644 --- a/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx +++ b/vtkm/rendering/raytracing/BoundingVolumeHierarchy.cxx @@ -124,8 +124,8 @@ class LinearBVHBuilder::GatherVecCast : public vtkm::worklet::WorkletMapField private: using Vec4IdArrayHandle = typename vtkm::cont::ArrayHandle; using Vec4IntArrayHandle = typename vtkm::cont::ArrayHandle; - using PortalConst = typename Vec4IdArrayHandle::ExecutionTypes::PortalConst; - using Portal = typename Vec4IntArrayHandle::ExecutionTypes::Portal; + using PortalConst = typename Vec4IdArrayHandle::ReadPortalType; + using Portal = typename Vec4IntArrayHandle::WritePortalType; private: PortalConst InputPortal; diff --git a/vtkm/rendering/raytracing/CylinderIntersector.cxx b/vtkm/rendering/raytracing/CylinderIntersector.cxx index ef1e888c6..0e73026b3 100644 --- a/vtkm/rendering/raytracing/CylinderIntersector.cxx +++ b/vtkm/rendering/raytracing/CylinderIntersector.cxx @@ -147,9 +147,9 @@ class CylinderLeafIntersector { public: using IdHandle = vtkm::cont::ArrayHandle; - using IdArrayPortal = typename IdHandle::ExecutionTypes::PortalConst; + using IdArrayPortal = typename IdHandle::ReadPortalType; using FloatHandle = vtkm::cont::ArrayHandle; - using FloatPortal = typename FloatHandle::ExecutionTypes::PortalConst; + using FloatPortal = typename FloatHandle::ReadPortalType; IdArrayPortal CylIds; FloatPortal Radii; diff --git a/vtkm/rendering/raytracing/MeshConnectivityBase.h b/vtkm/rendering/raytracing/MeshConnectivityBase.h index 38ef545b3..898a66fc2 100644 --- a/vtkm/rendering/raytracing/MeshConnectivityBase.h +++ b/vtkm/rendering/raytracing/MeshConnectivityBase.h @@ -158,8 +158,8 @@ class VTKM_ALWAYS_EXPORT MeshConnUnstructured : public MeshConnectivityBase protected: using IdHandle = typename vtkm::cont::ArrayHandle; using UCharHandle = typename vtkm::cont::ArrayHandle; - using IdConstPortal = typename IdHandle::ExecutionTypes::PortalConst; - using UCharConstPortal = typename UCharHandle::ExecutionTypes::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; - using IdConstPortal = typename IdHandle::ExecutionTypes::PortalConst; + using IdConstPortal = typename IdHandle::ReadPortalType; using CountingHandle = typename vtkm::cont::ArrayHandleCounting; - using CountingPortal = typename CountingHandle::ExecutionTypes::PortalConst; + using CountingPortal = typename CountingHandle::ReadPortalType; // Constant Portals for the execution Environment IdConstPortal FaceConnPortal; IdConstPortal CellConnectivityPortal; diff --git a/vtkm/rendering/raytracing/QuadIntersector.cxx b/vtkm/rendering/raytracing/QuadIntersector.cxx index 36d7fc766..6590c76d7 100644 --- a/vtkm/rendering/raytracing/QuadIntersector.cxx +++ b/vtkm/rendering/raytracing/QuadIntersector.cxx @@ -104,7 +104,7 @@ class QuadLeafIntersector public: using IdType = vtkm::Vec; using IdHandle = vtkm::cont::ArrayHandle>; - using IdArrayPortal = typename IdHandle::ExecutionTypes::PortalConst; + using IdArrayPortal = typename IdHandle::ReadPortalType; IdArrayPortal QuadIds; QuadLeafIntersector() {} diff --git a/vtkm/rendering/raytracing/SphereIntersector.cxx b/vtkm/rendering/raytracing/SphereIntersector.cxx index 02eed32e3..91dd69737 100644 --- a/vtkm/rendering/raytracing/SphereIntersector.cxx +++ b/vtkm/rendering/raytracing/SphereIntersector.cxx @@ -125,9 +125,9 @@ class SphereLeafIntersector { public: using IdHandle = vtkm::cont::ArrayHandle; - using IdArrayPortal = typename IdHandle::ExecutionTypes::PortalConst; + using IdArrayPortal = typename IdHandle::ReadPortalType; using FloatHandle = vtkm::cont::ArrayHandle; - using FloatPortal = typename FloatHandle::ExecutionTypes::PortalConst; + using FloatPortal = typename FloatHandle::ReadPortalType; IdArrayPortal PointIds; FloatPortal Radii; diff --git a/vtkm/rendering/raytracing/TriangleIntersector.cxx b/vtkm/rendering/raytracing/TriangleIntersector.cxx index dd2cff5e5..27b3bf05c 100644 --- a/vtkm/rendering/raytracing/TriangleIntersector.cxx +++ b/vtkm/rendering/raytracing/TriangleIntersector.cxx @@ -34,7 +34,7 @@ class WaterTightLeafIntersector { public: using Id4Handle = vtkm::cont::ArrayHandle; - using Id4ArrayPortal = typename Id4Handle::ExecutionTypes::PortalConst; + using Id4ArrayPortal = typename Id4Handle::ReadPortalType; Id4ArrayPortal Triangles; public: @@ -87,7 +87,7 @@ class MollerTriLeafIntersector //protected: public: using Id4Handle = vtkm::cont::ArrayHandle; - using Id4ArrayPortal = typename Id4Handle::ExecutionTypes::PortalConst; + using Id4ArrayPortal = typename Id4Handle::ReadPortalType; Id4ArrayPortal Triangles; public: diff --git a/vtkm/rendering/raytracing/VolumeRendererStructured.cxx b/vtkm/rendering/raytracing/VolumeRendererStructured.cxx index 823ef75a9..65bca37a4 100644 --- a/vtkm/rendering/raytracing/VolumeRendererStructured.cxx +++ b/vtkm/rendering/raytracing/VolumeRendererStructured.cxx @@ -44,8 +44,8 @@ protected: using DefaultHandle = vtkm::cont::ArrayHandle; using CartesianArrayHandle = vtkm::cont::ArrayHandleCartesianProduct; - using DefaultConstHandle = typename DefaultHandle::ExecutionTypes::PortalConst; - using CartesianConstPortal = typename CartesianArrayHandle::ExecutionTypes::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::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; - using ColorArrayPortal = typename ColorArrayHandle::ExecutionTypes::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; - using ColorArrayPortal = typename ColorArrayHandle::ExecutionTypes::PortalConst; + using ColorArrayPortal = typename ColorArrayHandle::ReadPortalType; ColorArrayPortal ColorMap; vtkm::Id ColorMapSize; vtkm::Float32 MinScalar; diff --git a/vtkm/worklet/Clip.h b/vtkm/worklet/Clip.h index 2d190af3c..34d3d50ef 100644 --- a/vtkm/worklet/Clip.h +++ b/vtkm/worklet/Clip.h @@ -123,12 +123,9 @@ template class ExecutionConnectivityExplicit { private: - using UInt8Portal = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal; - using IdComponentPortal = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal; - using IdPortal = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal; + using UInt8Portal = typename vtkm::cont::ArrayHandle::WritePortalType; + using IdComponentPortal = typename vtkm::cont::ArrayHandle::WritePortalType; + using IdPortal = typename vtkm::cont::ArrayHandle::WritePortalType; public: VTKM_CONT diff --git a/vtkm/worklet/Keys.h b/vtkm/worklet/Keys.h index de00c715f..1f9ee5c36 100644 --- a/vtkm/worklet/Keys.h +++ b/vtkm/worklet/Keys.h @@ -66,30 +66,27 @@ public: VTKM_CONT vtkm::Id GetNumberOfValues() const { return this->SortedValuesMap.GetNumberOfValues(); } - template - struct ExecutionTypes - { - using IdPortal = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; - using IdComponentPortal = typename vtkm::cont::ArrayHandle< - vtkm::IdComponent>::template ExecutionTypes::PortalConst; + using ExecLookup = vtkm::exec::internal::ReduceByKeyLookupBase< + typename vtkm::cont::ArrayHandle::ReadPortalType, + typename vtkm::cont::ArrayHandle::ReadPortalType>; - using Lookup = vtkm::exec::internal::ReduceByKeyLookupBase; + template + struct VTKM_DEPRECATED(1.6, "Use ExecLookup.") ExecutionTypes + { + using Lookup = ExecLookup; }; - template - VTKM_CONT typename ExecutionTypes::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::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 - VTKM_CONT VTKM_DEPRECATED(1.6, "PrepareForInput now requires a vtkm::cont::Token object.") - typename ExecutionTypes::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 - struct ExecutionTypes - { - using KeyPortal = typename KeyArrayHandleType::template ExecutionTypes::PortalConst; - using IdPortal = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; - using IdComponentPortal = typename vtkm::cont::ArrayHandle< - vtkm::IdComponent>::template ExecutionTypes::PortalConst; + using ExecLookup = vtkm::exec::internal::ReduceByKeyLookup< + typename KeyArrayHandleType::ReadPortalType, + typename vtkm::cont::ArrayHandle::ReadPortalType, + typename vtkm::cont::ArrayHandle::ReadPortalType>; - using Lookup = vtkm::exec::internal::ReduceByKeyLookup; + template + struct VTKM_DEPRECATED(1.6, "Use ExecLookup.") ExecutionTypes + { + using Lookup = ExecLookup; }; - template - VTKM_CONT typename ExecutionTypes::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::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 - VTKM_CONT VTKM_DEPRECATED(1.6, "PrepareForInput now requires a vtkm::cont::Token object.") - typename ExecutionTypes::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 struct Transport { using ContObjectType = KeyType; - using ExecObjectType = typename ContObjectType::template ExecutionTypes::Lookup; + using ExecObjectType = typename ContObjectType::ExecLookup; VTKM_CONT ExecObjectType operator()(const ContObjectType& object, @@ -339,7 +333,7 @@ struct Transport; using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable; - using ExecObjectType = typename GroupedArrayType::template ExecutionTypes::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; using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable; - using ExecObjectType = typename GroupedArrayType::template ExecutionTypes::Portal; + using ExecObjectType = typename GroupedArrayType::WritePortalType; VTKM_CONT ExecObjectType operator()(ContObjectType object, const vtkm::worklet::internal::KeysBase& keys, @@ -409,7 +403,7 @@ struct Transport; using GroupedArrayType = vtkm::cont::ArrayHandleGroupVecVariable; - using ExecObjectType = typename GroupedArrayType::template ExecutionTypes::Portal; + using ExecObjectType = typename GroupedArrayType::WritePortalType; VTKM_CONT ExecObjectType operator()(ContObjectType object, const vtkm::worklet::internal::KeysBase& keys, diff --git a/vtkm/worklet/StableSortIndices.h b/vtkm/worklet/StableSortIndices.h index 9891188f1..b28231758 100644 --- a/vtkm/worklet/StableSortIndices.h +++ b/vtkm/worklet/StableSortIndices.h @@ -76,8 +76,9 @@ struct StableSortIndices } template - IndirectSortPredicate::PortalConst> - PrepareForExecution(Device, vtkm::cont::Token& token) const + IndirectSortPredicate PrepareForExecution( + Device, + vtkm::cont::Token& token) const { auto keyPortal = this->KeyArray.PrepareForInput(Device(), token); return IndirectSortPredicate(keyPortal); @@ -115,8 +116,9 @@ struct StableSortIndices } template - IndirectUniquePredicate::PortalConst> - PrepareForExecution(Device, vtkm::cont::Token& token) const + IndirectUniquePredicate PrepareForExecution( + Device, + vtkm::cont::Token& token) const { auto keyPortal = this->KeyArray.PrepareForInput(Device(), token); return IndirectUniquePredicate(keyPortal); diff --git a/vtkm/worklet/clip/ClipTables.h b/vtkm/worklet/clip/ClipTables.h index 8770270a7..5e3dd18c5 100644 --- a/vtkm/worklet/clip/ClipTables.h +++ b/vtkm/worklet/clip/ClipTables.h @@ -2511,12 +2511,9 @@ public: } private: - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - ClipTablesDataPortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - ClipTablesIndicesPortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - CellEdgesPortal; + typename vtkm::cont::ArrayHandle::ReadPortalType ClipTablesDataPortal; + typename vtkm::cont::ArrayHandle::ReadPortalType ClipTablesIndicesPortal; + typename vtkm::cont::ArrayHandle::ReadPortalType CellEdgesPortal; friend class ClipTables; }; diff --git a/vtkm/worklet/contour/MarchingCellTables.h b/vtkm/worklet/contour/MarchingCellTables.h index 03d94240d..f6929c162 100644 --- a/vtkm/worklet/contour/MarchingCellTables.h +++ b/vtkm/worklet/contour/MarchingCellTables.h @@ -495,11 +495,9 @@ public: } private: - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - NumVerticesPerCellPortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - NumTrianglesTablePortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst + typename vtkm::cont::ArrayHandle::ReadPortalType NumVerticesPerCellPortal; + typename vtkm::cont::ArrayHandle::ReadPortalType NumTrianglesTablePortal; + typename vtkm::cont::ArrayHandle::ReadPortalType NumTrianglesTableOffsetPortal; friend class CellClassifyTable; @@ -580,14 +578,10 @@ public: } private: - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - EdgeTablePortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - EdgeTableOffsetPortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - TriangleTablePortal; - typename vtkm::cont::ArrayHandle::ExecutionTypes::PortalConst - TriangleTableOffsetPortal; + typename vtkm::cont::ArrayHandle::ReadPortalType EdgeTablePortal; + typename vtkm::cont::ArrayHandle::ReadPortalType EdgeTableOffsetPortal; + typename vtkm::cont::ArrayHandle::ReadPortalType TriangleTablePortal; + typename vtkm::cont::ArrayHandle::ReadPortalType TriangleTableOffsetPortal; friend class TriangleGenerationTable; }; diff --git a/vtkm/worklet/contour/MarchingCells.h b/vtkm/worklet/contour/MarchingCells.h index 7f1376e0c..1555b065a 100644 --- a/vtkm/worklet/contour/MarchingCells.h +++ b/vtkm/worklet/contour/MarchingCells.h @@ -119,18 +119,12 @@ public: class EdgeWeightGenerateMetaData : vtkm::cont::ExecutionObjectBase { public: - template class ExecObject { template - struct PortalTypes - { - using HandleType = vtkm::cont::ArrayHandle; - using ExecutionTypes = typename HandleType::template ExecutionTypes; - - using Portal = typename ExecutionTypes::Portal; - using PortalConst = typename ExecutionTypes::PortalConst; - }; + using ReadPortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; + template + using WritePortalType = typename vtkm::cont::ArrayHandle::WritePortalType; public: ExecObject() = default; @@ -141,19 +135,20 @@ public: vtkm::cont::ArrayHandle& interpIds, vtkm::cont::ArrayHandle& interpCellIds, vtkm::cont::ArrayHandle& 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::Portal InterpWeightsPortal; - typename PortalTypes::Portal InterpIdPortal; - typename PortalTypes::Portal InterpCellIdPortal; - typename PortalTypes::Portal InterpContourPortal; + WritePortalType InterpWeightsPortal; + WritePortalType InterpIdPortal; + WritePortalType InterpCellIdPortal; + WritePortalType InterpContourPortal; }; VTKM_CONT @@ -170,15 +165,16 @@ public: { } - template - VTKM_CONT ExecObject PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) + VTKM_CONT ExecObject PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) { - return ExecObject(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& metaData, + const EdgeWeightGenerateMetaData::ExecObject& metaData, const ClassifyTableType& classifyTable, const TriTableType& triTable, vtkm::Id inputCellId, diff --git a/vtkm/worklet/contourtree/EdgePeakComparator.h b/vtkm/worklet/contourtree/EdgePeakComparator.h index 152a79657..a2fddb36f 100644 --- a/vtkm/worklet/contourtree/EdgePeakComparator.h +++ b/vtkm/worklet/contourtree/EdgePeakComparator.h @@ -113,13 +113,11 @@ public: IdArrayType ArcArray; bool IsJoinGraph; - template class ExecObject { public: - using ValuePortalType = - typename ValueArrayType::template ExecutionTypes::PortalConst; - using IdPortalType = typename IdArrayType::template ExecutionTypes::PortalConst; + using ValuePortalType = typename ValueArrayType::ReadPortalType; + using IdPortalType = typename IdArrayType::ReadPortalType; VTKM_CONT ExecObject(ValuePortalType values, @@ -178,16 +176,15 @@ public: } }; - template - VTKM_CONT ExecObject PrepareForExecution(DeviceAdapter, - vtkm::cont::Token& token) const + VTKM_CONT ExecObject PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return ExecObject(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 } diff --git a/vtkm/worklet/contourtree/VertexMergeComparator.h b/vtkm/worklet/contourtree/VertexMergeComparator.h index ec5de295a..e0292ec0c 100644 --- a/vtkm/worklet/contourtree/VertexMergeComparator.h +++ b/vtkm/worklet/contourtree/VertexMergeComparator.h @@ -107,13 +107,11 @@ public: { } - template class ExecObject { public: - using ValuePortalType = - typename ValueArrayType::template ExecutionTypes::PortalConst; - using IdPortalType = typename IdArrayType::template ExecutionTypes::PortalConst; + using ValuePortalType = typename ValueArrayType::ReadPortalType; + using IdPortalType = typename IdArrayType::ReadPortalType; ValuePortalType Values; IdPortalType Extrema; @@ -162,13 +160,12 @@ public: } }; - template - VTKM_CONT ExecObject PrepareForExecution(DeviceAdapter, - vtkm::cont::Token& token) const + VTKM_CONT ExecObject PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return ExecObject(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 } diff --git a/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h b/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h index adf7babe5..4ef556ae9 100644 --- a/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h +++ b/vtkm/worklet/contourtree_augmented/ContourTreeMaker.h @@ -793,7 +793,7 @@ struct LeafChainsToContourTree inline bool operator()(DeviceAdapter device, Args&&... args) const { vtkm::cont::Token token; - contourtree_maker_inc_ns::TransferLeafChains_TransferToContourTree 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 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) diff --git a/vtkm/worklet/contourtree_augmented/activegraph/EdgePeakComparator.h b/vtkm/worklet/contourtree_augmented/activegraph/EdgePeakComparator.h index ed3f0f841..6e8b24573 100644 --- a/vtkm/worklet/contourtree_augmented/activegraph/EdgePeakComparator.h +++ b/vtkm/worklet/contourtree_augmented/activegraph/EdgePeakComparator.h @@ -68,23 +68,22 @@ namespace active_graph_inc // comparator used for initial sort of data values -template class EdgePeakComparatorImpl { public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = typename vtkm::cont::ArrayHandle::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 - VTKM_CONT EdgePeakComparatorImpl PrepareForExecution( - DeviceAdapter, - vtkm::cont::Token& token) const + VTKM_CONT EdgePeakComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return EdgePeakComparatorImpl( - this->EdgeFar, this->EdgeNear, this->JoinGraph, token); + return EdgePeakComparatorImpl(this->EdgeFar, this->EdgeNear, this->JoinGraph, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/activegraph/HyperArcSuperNodeComparator.h b/vtkm/worklet/contourtree_augmented/activegraph/HyperArcSuperNodeComparator.h index 7ec8dea11..3f096094f 100644 --- a/vtkm/worklet/contourtree_augmented/activegraph/HyperArcSuperNodeComparator.h +++ b/vtkm/worklet/contourtree_augmented/activegraph/HyperArcSuperNodeComparator.h @@ -68,12 +68,10 @@ namespace active_graph_inc // comparator used for initial sort of data values -template class HyperArcSuperNodeComparatorImpl { public: - using IdArrayPortalType = - typename IdArrayType::template ExecutionTypes::PortalConst; + using IdArrayPortalType = typename IdArrayType::ReadPortalType; // constructor - takes vectors as parameters VTKM_CONT @@ -132,15 +130,12 @@ public: { } - template - VTKM_CONT HyperArcSuperNodeComparatorImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT HyperArcSuperNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return HyperArcSuperNodeComparatorImpl( - 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: diff --git a/vtkm/worklet/contourtree_augmented/activegraph/SuperArcNodeComparator.h b/vtkm/worklet/contourtree_augmented/activegraph/SuperArcNodeComparator.h index a9ead909b..4ab9d7ab2 100644 --- a/vtkm/worklet/contourtree_augmented/activegraph/SuperArcNodeComparator.h +++ b/vtkm/worklet/contourtree_augmented/activegraph/SuperArcNodeComparator.h @@ -69,21 +69,20 @@ namespace active_graph_inc // comparator used for initial sort of data values -template class SuperArcNodeComparatorImpl { public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = typename vtkm::cont::ArrayHandle::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 - VTKM_CONT SuperArcNodeComparatorImpl PrepareForExecution( - DeviceAdapter, - vtkm::cont::Token& token) const + VTKM_CONT SuperArcNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return SuperArcNodeComparatorImpl(this->Superparents, this->JoinSweep, token); + return SuperArcNodeComparatorImpl(this->Superparents, this->JoinSweep, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeNodeComparator.h b/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeNodeComparator.h index d4a858cb0..0379d2ee8 100644 --- a/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeNodeComparator.h +++ b/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeNodeComparator.h @@ -68,12 +68,10 @@ namespace contourtree_maker_inc // comparator used for initial sort of data values -template class ContourTreeNodeComparatorImpl { public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = vtkm::cont::ArrayHandle::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 - VTKM_CONT ContourTreeNodeComparatorImpl PrepareForExecution( - DeviceAdapter, - vtkm::cont::Token& token) + VTKM_CONT ContourTreeNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) { - return ContourTreeNodeComparatorImpl(this->Superparents, this->Superarcs, token); + return ContourTreeNodeComparatorImpl(this->Superparents, this->Superarcs, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeSuperNodeComparator.h b/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeSuperNodeComparator.h index bab80f136..dff3421ef 100644 --- a/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeSuperNodeComparator.h +++ b/vtkm/worklet/contourtree_augmented/contourtreemaker/ContourTreeSuperNodeComparator.h @@ -68,12 +68,10 @@ namespace contourtree_maker_inc // comparator used for initial sort of data values -template class ContourTreeSuperNodeComparatorImpl { public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = vtkm::cont::ArrayHandle::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 - VTKM_CONT ContourTreeSuperNodeComparatorImpl PrepareForExecution( - DeviceAdapter, - vtkm::cont::Token& token) + VTKM_CONT ContourTreeSuperNodeComparatorImpl + PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) { - return ContourTreeSuperNodeComparatorImpl( - this->Hyperparents, this->Supernodes, this->WhenTransferred, token); + return ContourTreeSuperNodeComparatorImpl( + this->Hyperparents, this->Supernodes, this->WhenTransferred, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/contourtreemaker/TransferLeafChains_TransferToContourTree.h b/vtkm/worklet/contourtree_augmented/contourtreemaker/TransferLeafChains_TransferToContourTree.h index e48f6b6e7..453ab5e62 100644 --- a/vtkm/worklet/contourtree_augmented/contourtreemaker/TransferLeafChains_TransferToContourTree.h +++ b/vtkm/worklet/contourtree_augmented/contourtreemaker/TransferLeafChains_TransferToContourTree.h @@ -75,7 +75,6 @@ namespace contourtree_maker_inc // ii. we use inwards as the superarc // c. for all other vertics // ignore -template 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::template ExecutionTypes::PortalConst; + using IdPortalType = vtkm::cont::ArrayHandle::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); } diff --git a/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure2D.h b/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure2D.h index c54bfd933..fbbdc163c 100644 --- a/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure2D.h +++ b/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure2D.h @@ -65,7 +65,6 @@ namespace data_set_mesh { // Worklet for computing the sort indices from the sort order -template class MeshStructure2D { public: diff --git a/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure3D.h b/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure3D.h index 18bb62fe2..7bff84132 100644 --- a/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure3D.h +++ b/vtkm/worklet/contourtree_augmented/data_set_mesh/MeshStructure3D.h @@ -65,7 +65,6 @@ namespace data_set_mesh { // Worklet for computing the sort indices from the sort order -template class MeshStructure3D { public: diff --git a/vtkm/worklet/contourtree_augmented/data_set_mesh/SimulatedSimplicityComperator.h b/vtkm/worklet/contourtree_augmented/data_set_mesh/SimulatedSimplicityComperator.h index b21e8987a..c67235d7d 100644 --- a/vtkm/worklet/contourtree_augmented/data_set_mesh/SimulatedSimplicityComperator.h +++ b/vtkm/worklet/contourtree_augmented/data_set_mesh/SimulatedSimplicityComperator.h @@ -67,12 +67,11 @@ namespace mesh_dem // comparator used for initial sort of data values -template +template class SimulatedSimplicityIndexComparatorImpl { public: - using ValuePortalType = typename vtkm::cont::ArrayHandle::template ExecutionTypes< - DeviceAdapter>::PortalConst; + using ValuePortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; ValuePortalType values; @@ -113,11 +112,11 @@ public: { // constructor } // constructor - template - VTKM_CONT SimulatedSimplicityIndexComparatorImpl - PrepareForExecution(DeviceAdapter device, vtkm::cont::Token& token) const + VTKM_CONT SimulatedSimplicityIndexComparatorImpl PrepareForExecution( + vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return SimulatedSimplicityIndexComparatorImpl( + return SimulatedSimplicityIndexComparatorImpl( this->Values.PrepareForInput(device, token)); } diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/ContourTreeMesh.h b/vtkm/worklet/contourtree_augmented/meshtypes/ContourTreeMesh.h index 0c0ba8dc4..741c9a26f 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/ContourTreeMesh.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/ContourTreeMesh.h @@ -67,10 +67,10 @@ #include #include #include +#include #include #include #include -#include #include #include #include @@ -123,9 +123,8 @@ public: //Mesh dependent helper functions void SetPrepareForExecutionBehavior(bool getMax); - template - contourtree_mesh_inc_ns::MeshStructureContourTreeMesh 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 void MergeWith(ContourTreeMesh& other); // Save/Load the mesh helpers @@ -506,12 +504,12 @@ inline void ContourTreeMesh::SetPrepareForExecutionBehavior(bool getM // Get VTKM execution object that represents the structure of the mesh and provides the mesh helper functions on the device template -template -contourtree_mesh_inc_ns::MeshStructureContourTreeMesh 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( - 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 -template inline void ContourTreeMesh::MergeWith(ContourTreeMesh& other) { // Merge With #ifdef DEBUG_PRINT @@ -565,16 +562,11 @@ inline void ContourTreeMesh::MergeWith(ContourTreeMesh& 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 - 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::MergeWith(ContourTreeMesh& 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); diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation2DFreudenthal.h b/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation2DFreudenthal.h index 044eb6871..fc1f606a7 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation2DFreudenthal.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation2DFreudenthal.h @@ -82,9 +82,8 @@ public: //Mesh dependent helper functions void SetPrepareForExecutionBehavior(bool getMax); - template - MeshStructureFreudenthal2D 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 -inline MeshStructureFreudenthal2D -DataSetMeshTriangulation2DFreudenthal::PrepareForExecution(DeviceTag, - vtkm::cont::Token& token) const +inline MeshStructureFreudenthal2D DataSetMeshTriangulation2DFreudenthal::PrepareForExecution( + vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return MeshStructureFreudenthal2D(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() diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DFreudenthal.h b/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DFreudenthal.h index 7e70f0a7e..f7918a8f3 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DFreudenthal.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DFreudenthal.h @@ -87,9 +87,8 @@ public: // Mesh helper functions void SetPrepareForExecutionBehavior(bool getMax); - template - MeshStructureFreudenthal3D 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 -inline MeshStructureFreudenthal3D -DataSetMeshTriangulation3DFreudenthal::PrepareForExecution(DeviceTag, - vtkm::cont::Token& token) const +inline MeshStructureFreudenthal3D DataSetMeshTriangulation3DFreudenthal::PrepareForExecution( + vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return MeshStructureFreudenthal3D(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() diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DMarchingCubes.h b/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DMarchingCubes.h index 2a63b9cea..d3488aabe 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DMarchingCubes.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/DataSetMeshTriangulation3DMarchingCubes.h @@ -91,9 +91,8 @@ public: // mesh depended helper functions void SetPrepareForExecutionBehavior(bool getMax); - template - MeshStructureMarchingCubes 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 -inline MeshStructureMarchingCubes -DataSetMeshTriangulation3DMarchingCubes::PrepareForExecution(DeviceTag, - vtkm::cont::Token& token) const +inline MeshStructureMarchingCubes DataSetMeshTriangulation3DMarchingCubes::PrepareForExecution( + vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return MeshStructureMarchingCubes(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() diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureContourTreeMesh.h b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureContourTreeMesh.h index d8089be15..e6f4ce054 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureContourTreeMesh.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureContourTreeMesh.h @@ -83,12 +83,10 @@ namespace mesh_dem_contourtree_mesh_inc { // Worklet for computing the sort indices from the sort order -template class MeshStructureContourTreeMesh { public: - typedef typename cpp2_ns::IdArrayType::template ExecutionTypes::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 diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal2D.h b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal2D.h index 1d5e875b6..6e6d1f4bc 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal2D.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal2D.h @@ -69,20 +69,17 @@ namespace contourtree_augmented { // Worklet for computing the sort indices from the sort order -template -class MeshStructureFreudenthal2D : public data_set_mesh::MeshStructure2D +class MeshStructureFreudenthal2D : public data_set_mesh::MeshStructure2D { public: - using SortIndicesPortalType = - typename IdArrayType::template ExecutionTypes::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() + : 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(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 diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal3D.h b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal3D.h index 6cc8111b9..920bbf2ec 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal3D.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureFreudenthal3D.h @@ -70,29 +70,23 @@ namespace contourtree_augmented { // Worklet for computing the sort indices from the sort order -template -class MeshStructureFreudenthal3D : public data_set_mesh::MeshStructure3D +class MeshStructureFreudenthal3D : public data_set_mesh::MeshStructure3D { public: - using SortIndicesPortalType = - typename IdArrayType::template ExecutionTypes::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() + : 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(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 diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureMarchingCubes.h b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureMarchingCubes.h index f68b37a64..c6aca9902 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureMarchingCubes.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/MeshStructureMarchingCubes.h @@ -69,38 +69,31 @@ namespace contourtree_augmented { // Worklet for computing the sort indices from the sort order -template -class MeshStructureMarchingCubes : public data_set_mesh::MeshStructure3D +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::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() + : 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(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 diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/ArcComparator.h b/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/ArcComparator.h index 6798c3ee7..64e9a0058 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/ArcComparator.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/ArcComparator.h @@ -78,19 +78,19 @@ namespace mesh_dem_contourtree_mesh_inc // comparator used for initial sort of data values -template class ArcComparatorImpl { public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = vtkm::cont::ArrayHandle::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 - VTKM_CONT ArcComparatorImpl PrepareForExecution(DeviceAdapter, - vtkm::cont::Token& token) const + VTKM_CONT ArcComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return ArcComparatorImpl(this->Arcs, token); + return ArcComparatorImpl(this->Arcs, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedSimulatedSimplicityIndexComparator.h b/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedSimulatedSimplicityIndexComparator.h index c00c05a4b..8908ce229 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedSimulatedSimplicityIndexComparator.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedSimulatedSimplicityIndexComparator.h @@ -77,14 +77,12 @@ namespace mesh_dem_contourtree_mesh_inc /// Implementation of the comparator used initial sort of data values in ContourTreeMesh::MergeWith -template +template class CombinedSimulatedSimplicityIndexComparatorImpl { public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; - using ValuePortalType = typename vtkm::cont::ArrayHandle::template ExecutionTypes< - DeviceAdapter>::PortalConst; + using IdPortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; + using ValuePortalType = typename vtkm::cont::ArrayHandle::ReadPortalType; VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl( @@ -92,13 +90,14 @@ public: const IdArrayType& otherGlobalMeshIndex, const vtkm::cont::ArrayHandle& thisSortedValues, const vtkm::cont::ArrayHandle& 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 - VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl - PrepareForExecution(DeviceAdapter, vtkm::cont::Token& token) + VTKM_CONT CombinedSimulatedSimplicityIndexComparatorImpl PrepareForExecution( + vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) { - return CombinedSimulatedSimplicityIndexComparatorImpl( - this->ThisGlobalMeshIndex, - this->OtherGlobalMeshIndex, - this->ThisSortedValues, - this->OtherSortedValues, - token); + return CombinedSimulatedSimplicityIndexComparatorImpl(this->ThisGlobalMeshIndex, + this->OtherGlobalMeshIndex, + this->ThisSortedValues, + this->OtherSortedValues, + device, + token); } private: diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedVectorDifferentFromNext.h b/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedVectorDifferentFromNext.h index 88be0e152..31281481d 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedVectorDifferentFromNext.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/contourtreemesh/CombinedVectorDifferentFromNext.h @@ -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 -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::template ExecutionTypes::PortalConst; + using IdPortalType = typename vtkm::cont::ArrayHandle::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 diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary2D.h b/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary2D.h index a292284cf..def37bdf5 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary2D.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary2D.h @@ -74,25 +74,26 @@ namespace contourtree_augmented { -template class MeshBoundary2D { public: // Sort indicies types - using SortIndicesPortalType = - typename IdArrayType::template ExecutionTypes::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& GetMeshStructure() const - { - return this->MeshStructure; - } + const data_set_mesh::MeshStructure2D& GetMeshStructure() const { return this->MeshStructure; } private: // 2D Mesh size parameters - data_set_mesh::MeshStructure2D MeshStructure; + data_set_mesh::MeshStructure2D MeshStructure; SortIndicesPortalType SortIndicesPortal; }; @@ -177,10 +175,10 @@ public: } VTKM_CONT - template - MeshBoundary2D PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const + MeshBoundary2D PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return MeshBoundary2D(this->MeshSize, this->SortIndices, token); + return MeshBoundary2D(this->MeshSize, this->SortIndices, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary3D.h b/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary3D.h index 36471f0b6..d68373fb4 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary3D.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundary3D.h @@ -73,25 +73,26 @@ namespace worklet namespace contourtree_augmented { -template -class MeshBoundary3D : public vtkm::cont::ExecutionObjectBase +class MeshBoundary3D { public: // Sort indicies types - using SortIndicesPortalType = - typename IdArrayType::template ExecutionTypes::PortalConst; + using SortIndicesPortalType = IdArrayType::ReadPortalType; VTKM_EXEC_CONT MeshBoundary3D() - : MeshStructure(data_set_mesh::MeshStructure3D(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(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& GetMeshStructure() const - { - return this->MeshStructure; - } + const data_set_mesh::MeshStructure3D& GetMeshStructure() const { return this->MeshStructure; } protected: // 3D Mesh size parameters - data_set_mesh::MeshStructure3D MeshStructure; + data_set_mesh::MeshStructure3D MeshStructure; SortIndicesPortalType SortIndicesPortal; }; @@ -281,11 +279,10 @@ public: { } - VTKM_CONT - template - MeshBoundary3D PrepareForExecution(DeviceTag, vtkm::cont::Token& token) const + VTKM_CONT MeshBoundary3D PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return MeshBoundary3D(this->MeshSize, this->SortIndices, token); + return MeshBoundary3D(this->MeshSize, this->SortIndices, device, token); } protected: diff --git a/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundaryContourTreeMesh.h b/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundaryContourTreeMesh.h index 0f968db8e..7a3e23175 100644 --- a/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundaryContourTreeMesh.h +++ b/vtkm/worklet/contourtree_augmented/meshtypes/mesh_boundary/MeshBoundaryContourTreeMesh.h @@ -71,13 +71,10 @@ namespace worklet namespace contourtree_augmented { - - -template class MeshBoundaryContourTreeMesh { public: - using IndicesPortalType = typename IdArrayType::template ExecutionTypes::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 - MeshBoundaryContourTreeMesh PrepareForExecution(DeviceTag, - vtkm::cont::Token& token) const + VTKM_CONT MeshBoundaryContourTreeMesh PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return MeshBoundaryContourTreeMesh( - this->GlobalMeshIndex, this->GlobalSize, this->MinIdx, this->MaxIdx, token); + return MeshBoundaryContourTreeMesh( + this->GlobalMeshIndex, this->GlobalSize, this->MinIdx, this->MaxIdx, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/processcontourtree/SuperArcVolumetricComparator.h b/vtkm/worklet/contourtree_augmented/processcontourtree/SuperArcVolumetricComparator.h index c576027e2..730fa13cf 100644 --- a/vtkm/worklet/contourtree_augmented/processcontourtree/SuperArcVolumetricComparator.h +++ b/vtkm/worklet/contourtree_augmented/processcontourtree/SuperArcVolumetricComparator.h @@ -68,14 +68,11 @@ namespace contourtree_augmented namespace process_contourtree_inc { -template class SuperArcVolumetricComparatorImpl { // SuperArcVolumetricComparatorImpl public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; - using EdgePairArrayPortalType = - typename EdgePairArray::template ExecutionTypes::PortalConst; + using IdPortalType = vtkm::cont::ArrayHandle::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 - VTKM_CONT SuperArcVolumetricComparatorImpl PrepareForExecution( - DeviceAdapter, - vtkm::cont::Token& token) + VTKM_CONT SuperArcVolumetricComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) { - return SuperArcVolumetricComparatorImpl( - this->Weight, this->SuperArcList, this->PairsAtLowEnd, token); + return SuperArcVolumetricComparatorImpl( + this->Weight, this->SuperArcList, this->PairsAtLowEnd, device, token); } private: diff --git a/vtkm/worklet/contourtree_augmented/processcontourtree/SuperNodeBranchComparator.h b/vtkm/worklet/contourtree_augmented/processcontourtree/SuperNodeBranchComparator.h index d19c199f8..239e80f51 100644 --- a/vtkm/worklet/contourtree_augmented/processcontourtree/SuperNodeBranchComparator.h +++ b/vtkm/worklet/contourtree_augmented/processcontourtree/SuperNodeBranchComparator.h @@ -68,22 +68,21 @@ namespace contourtree_augmented namespace process_contourtree_inc { -template class SuperNodeBranchComparatorImpl { // SuperNodeBranchComparatorImpl public: - using IdPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdPortalType = vtkm::cont::ArrayHandle::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 - VTKM_CONT SuperNodeBranchComparatorImpl PrepareForExecution( - DeviceAdapter, - vtkm::cont::Token& token) + VTKM_CONT SuperNodeBranchComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) { - return SuperNodeBranchComparatorImpl(this->WhichBranch, this->Supernodes, token); + return SuperNodeBranchComparatorImpl(this->WhichBranch, this->Supernodes, device, token); } private: diff --git a/vtkm/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h b/vtkm/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h index 44bf87b81..c0b09b938 100644 --- a/vtkm/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h +++ b/vtkm/worklet/contourtree_distributed/ComputeDistributedContourTreeFunctor.h @@ -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 - bool operator()(DeviceAdapterTag, - vtkm::worklet::contourtree_augmented::ContourTreeMesh& in, - vtkm::worklet::contourtree_augmented::ContourTreeMesh& out) const - { - out.template MergeWith(in); - return true; - } -}; - /// Functor used by DIY reduce the merge data blocks in parallel template 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; diff --git a/vtkm/worklet/contourtree_distributed/MergeBlockFunctor.h b/vtkm/worklet/contourtree_distributed/MergeBlockFunctor.h index 80cf076f2..4a790599f 100644 --- a/vtkm/worklet/contourtree_distributed/MergeBlockFunctor.h +++ b/vtkm/worklet/contourtree_distributed/MergeBlockFunctor.h @@ -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 - bool operator()(DeviceAdapterTag, - vtkm::worklet::contourtree_augmented::ContourTreeMesh& in, - vtkm::worklet::contourtree_augmented::ContourTreeMesh& out) const - { - out.template MergeWith(in); - return true; - } -}; - - // Functor used by DIY reduce the merge data blocks in parallel template 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; diff --git a/vtkm/worklet/contourtree_distributed/boundary_tree_maker/BoundaryTreeNodeComparator.h b/vtkm/worklet/contourtree_distributed/boundary_tree_maker/BoundaryTreeNodeComparator.h index 26f51445f..354679f59 100644 --- a/vtkm/worklet/contourtree_distributed/boundary_tree_maker/BoundaryTreeNodeComparator.h +++ b/vtkm/worklet/contourtree_distributed/boundary_tree_maker/BoundaryTreeNodeComparator.h @@ -70,17 +70,15 @@ namespace bract_maker /// device implementation of the comparator used for sorting hyperarcs -template class BoundaryTreeNodeComparatorImpl { public: - using IdArrayPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::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::cont::ArrayHandleIndex>::template ExecutionTypes::PortalConst; - //typename vtkm::cont::ArrayHandleVirtual::template ExecutionTypes::PortalConst; + using IdArrayPortalType = vtkm::cont::ArrayHandle::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::ArrayHandleIndex>::ReadPortalType; // constructor - takes vectors as parameters VTKM_CONT @@ -134,14 +132,11 @@ public: { // constructor } // constructor - template - VTKM_CONT BoundaryTreeNodeComparatorImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT BoundaryTreeNodeComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return BoundaryTreeNodeComparatorImpl( - this->RegularId.PrepareForInput(device, token), - this->MeshSortIndex.PrepareForInput(device, token)); + return BoundaryTreeNodeComparatorImpl(this->RegularId.PrepareForInput(device, token), + this->MeshSortIndex.PrepareForInput(device, token)); } private: diff --git a/vtkm/worklet/contourtree_distributed/boundary_tree_maker/ContourTreeNodeHyperArcComparator.h b/vtkm/worklet/contourtree_distributed/boundary_tree_maker/ContourTreeNodeHyperArcComparator.h index c0e89b0a1..a6a6b3639 100644 --- a/vtkm/worklet/contourtree_distributed/boundary_tree_maker/ContourTreeNodeHyperArcComparator.h +++ b/vtkm/worklet/contourtree_distributed/boundary_tree_maker/ContourTreeNodeHyperArcComparator.h @@ -70,12 +70,10 @@ namespace bract_maker // device implementation of the ContourTreeNodeHyperArcComparator -template class ContourTreeNodeHyperArcComparatorImpl { public: - using IdArrayPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdArrayPortalType = vtkm::cont::ArrayHandle::ReadPortalType; // constructor - takes vectors as parameters VTKM_CONT @@ -143,14 +141,11 @@ public: { // constructor } // constructor - template - VTKM_CONT ContourTreeNodeHyperArcComparatorImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT ContourTreeNodeHyperArcComparatorImpl + PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return ContourTreeNodeHyperArcComparatorImpl( - this->Superarcs.PrepareForInput(device, token), - this->Superparents.PrepareForInput(device, token)); + return ContourTreeNodeHyperArcComparatorImpl(this->Superarcs.PrepareForInput(device, token), + this->Superparents.PrepareForInput(device, token)); } private: diff --git a/vtkm/worklet/contourtree_distributed/boundary_tree_maker/HyperarcComparator.h b/vtkm/worklet/contourtree_distributed/boundary_tree_maker/HyperarcComparator.h index 7fff6e392..b757e2db7 100644 --- a/vtkm/worklet/contourtree_distributed/boundary_tree_maker/HyperarcComparator.h +++ b/vtkm/worklet/contourtree_distributed/boundary_tree_maker/HyperarcComparator.h @@ -68,12 +68,10 @@ namespace bract_maker // device implementation of the comparator used for sorting hyperarcs -template class HyperarcComparatorImpl { public: - using IdArrayPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + using IdArrayPortalType = vtkm::cont::ArrayHandle::ReadPortalType; // constructor - takes vectors as parameters VTKM_CONT @@ -105,12 +103,10 @@ public: { // constructor } // constructor - template - VTKM_CONT HyperarcComparatorImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT HyperarcComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return HyperarcComparatorImpl(this->Hyperarcs.PrepareForInput(device, token)); + return HyperarcComparatorImpl(this->Hyperarcs.PrepareForInput(device, token)); } private: diff --git a/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindRegularByGlobal.h b/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindRegularByGlobal.h index 5257e955e..3bd946c0f 100644 --- a/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindRegularByGlobal.h +++ b/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindRegularByGlobal.h @@ -66,24 +66,23 @@ namespace contourtree_distributed /// Device implementation of FindRegularByGlobal for the HierarchicalContourTree -template 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 - FindRegularByGlobalDeviceData PrepareForExecution(DeviceTag, - vtkm::cont::Token& token) const + VTKM_CONT FindRegularByGlobalDeviceData PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return FindRegularByGlobalDeviceData( - token, this->RegularNodeSortOrder, this->RegularNodeGlobalIds); + return FindRegularByGlobalDeviceData( + device, token, this->RegularNodeSortOrder, this->RegularNodeGlobalIds); } private: diff --git a/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindSuperArcForUnknownNode.h b/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindSuperArcForUnknownNode.h index 018882537..0dccbe93f 100644 --- a/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindSuperArcForUnknownNode.h +++ b/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/FindSuperArcForUnknownNode.h @@ -66,18 +66,17 @@ namespace contourtree_distributed /// Device implementation of FindSuperArcForUnknownNode for the HierarchicalContourTree -template +template class FindSuperArcForUnknownNodeDeviceData { public: using IndicesPortalType = - typename vtkm::worklet::contourtree_augmented::IdArrayType::template ExecutionTypes< - DeviceTag>::PortalConst; - using DataPortalType = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::PortalConst; + typename vtkm::worklet::contourtree_augmented::IdArrayType::ReadPortalType; + using DataPortalType = typename vtkm::cont::ArrayHandle::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 - FindSuperArcForUnknownNodeDeviceData PrepareForExecution( - DeviceTag, + VTKM_CONT FindSuperArcForUnknownNodeDeviceData PrepareForExecution( + vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return FindSuperArcForUnknownNodeDeviceData(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(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: diff --git a/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/PermuteComparator.h b/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/PermuteComparator.h index 4ca8edcfe..9925f83ef 100644 --- a/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/PermuteComparator.h +++ b/vtkm/worklet/contourtree_distributed/hierarchical_contour_tree/PermuteComparator.h @@ -67,20 +67,18 @@ namespace contourtree_distributed // comparator used for initial sort of data values -template 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 - VTKM_CONT PermuteComparatorImpl PrepareForExecution(DeviceAdapter, - vtkm::cont::Token& token) const + VTKM_CONT PermuteComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return PermuteComparatorImpl(this->Lookup, token); + return PermuteComparatorImpl(this->Lookup, device, token); } private: diff --git a/vtkm/worklet/contourtree_distributed/tree_grafter/HyperNodeWhenComparator.h b/vtkm/worklet/contourtree_distributed/tree_grafter/HyperNodeWhenComparator.h index ca69b5dd7..fa156a7ca 100644 --- a/vtkm/worklet/contourtree_distributed/tree_grafter/HyperNodeWhenComparator.h +++ b/vtkm/worklet/contourtree_distributed/tree_grafter/HyperNodeWhenComparator.h @@ -67,13 +67,10 @@ namespace tree_grafter { /// Comparator used in TreeGrafter::ListNewHypernodes to sort the NewHypernodes arrays -template 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 - VTKM_CONT HyperNodeWhenComparatorImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT HyperNodeWhenComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return HyperNodeWhenComparatorImpl( - this->WhenTransferred.PrepareForInput(device, token)); + return HyperNodeWhenComparatorImpl(this->WhenTransferred.PrepareForInput(device, token)); } private: diff --git a/vtkm/worklet/contourtree_distributed/tree_grafter/PermuteComparator.h b/vtkm/worklet/contourtree_distributed/tree_grafter/PermuteComparator.h index a8dd2b9c5..ee8e09111 100644 --- a/vtkm/worklet/contourtree_distributed/tree_grafter/PermuteComparator.h +++ b/vtkm/worklet/contourtree_distributed/tree_grafter/PermuteComparator.h @@ -67,13 +67,10 @@ namespace tree_grafter { /// Comparator used in TreeGrafter::ListNewSupernodes to sort the NewSupernodes arrays -template 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 - VTKM_CONT PermuteComparatorImpl PrepareForExecution(DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT PermuteComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - return PermuteComparatorImpl(this->LookupArray.PrepareForInput(device, token)); + return PermuteComparatorImpl(this->LookupArray.PrepareForInput(device, token)); } private: diff --git a/vtkm/worklet/contourtree_distributed/tree_grafter/SuperNodeWhenComparator.h b/vtkm/worklet/contourtree_distributed/tree_grafter/SuperNodeWhenComparator.h index 4f4032b65..0e2738ffa 100644 --- a/vtkm/worklet/contourtree_distributed/tree_grafter/SuperNodeWhenComparator.h +++ b/vtkm/worklet/contourtree_distributed/tree_grafter/SuperNodeWhenComparator.h @@ -67,13 +67,10 @@ namespace tree_grafter { /// Comparator used in TreeGrafter::ListNewSupernodes to sort the NewSupernodes arrays -template 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 - VTKM_CONT SuperNodeWhenComparatorImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT SuperNodeWhenComparatorImpl PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { - 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)); + 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: diff --git a/vtkm/worklet/contourtree_distributed/tree_grafter/SuperarcWasNotTransferredPredicate.h b/vtkm/worklet/contourtree_distributed/tree_grafter/SuperarcWasNotTransferredPredicate.h index d9872fe8e..5d8a38270 100644 --- a/vtkm/worklet/contourtree_distributed/tree_grafter/SuperarcWasNotTransferredPredicate.h +++ b/vtkm/worklet/contourtree_distributed/tree_grafter/SuperarcWasNotTransferredPredicate.h @@ -67,13 +67,11 @@ namespace tree_grafter { // Uniary predicate used in TreeGrafter.CompressActiveArrays to decide which active superarcs to keep -template 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 - VTKM_CONT SuperarcWasNotTransferredPredicateImpl PrepareForExecution( - DeviceAdapter device, - vtkm::cont::Token& token) const + VTKM_CONT SuperarcWasNotTransferredPredicateImpl + PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return SuperarcWasNotTransferredPredicateImpl( + return SuperarcWasNotTransferredPredicateImpl( this->WhenTransferred.PrepareForInput(device, token)); } diff --git a/vtkm/worklet/gradient/GradientOutput.h b/vtkm/worklet/gradient/GradientOutput.h index eddb73df4..e6513be29 100644 --- a/vtkm/worklet/gradient/GradientOutput.h +++ b/vtkm/worklet/gradient/GradientOutput.h @@ -27,26 +27,24 @@ namespace vtkm { namespace exec { -template + +template struct GradientScalarOutputExecutionObject { using ValueType = vtkm::Vec; using BaseTType = typename vtkm::VecTraits::BaseComponentType; - struct PortalTypes - { - using HandleType = vtkm::cont::ArrayHandle; - using ExecutionTypes = typename HandleType::template ExecutionTypes; - using Portal = typename ExecutionTypes::Portal; - }; + using HandleType = vtkm::cont::ArrayHandle; + using PortalType = typename HandleType::WritePortalType; GradientScalarOutputExecutionObject() = default; GradientScalarOutputExecutionObject(vtkm::cont::ArrayHandle 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 @@ -64,14 +62,13 @@ struct GradientScalarOutput : public vtkm::cont::ExecutionObjectBase { using ValueType = vtkm::Vec; using BaseTType = typename vtkm::VecTraits::BaseComponentType; - template - VTKM_CONT vtkm::exec::GradientScalarOutputExecutionObject PrepareForExecution( - Device, + VTKM_CONT vtkm::exec::GradientScalarOutputExecutionObject PrepareForExecution( + vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return vtkm::exec::GradientScalarOutputExecutionObject( - this->Gradient, this->Size, token); + return vtkm::exec::GradientScalarOutputExecutionObject( + this->Gradient, this->Size, device, token); } GradientScalarOutput() = default; @@ -93,19 +90,14 @@ struct GradientScalarOutput : public vtkm::cont::ExecutionObjectBase vtkm::cont::ArrayHandle Gradient; }; -template +template struct GradientVecOutputExecutionObject { using ValueType = vtkm::Vec; using BaseTType = typename vtkm::VecTraits::BaseComponentType; template - struct PortalTypes - { - using HandleType = vtkm::cont::ArrayHandle; - using ExecutionTypes = typename HandleType::template ExecutionTypes; - using Portal = typename ExecutionTypes::Portal; - }; + using PortalType = typename vtkm::cont::ArrayHandle::WritePortalType; GradientVecOutputExecutionObject() = default; @@ -118,6 +110,7 @@ struct GradientVecOutputExecutionObject vtkm::cont::ArrayHandle> vorticity, vtkm::cont::ArrayHandle 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::Portal GradientPortal; - typename PortalTypes::Portal DivergencePortal; - typename PortalTypes>::Portal VorticityPortal; - typename PortalTypes::Portal QCriterionPortal; + PortalType GradientPortal; + PortalType DivergencePortal; + PortalType> VorticityPortal; + PortalType QCriterionPortal; }; template @@ -192,21 +184,21 @@ struct GradientVecOutput : public vtkm::cont::ExecutionObjectBase using ValueType = vtkm::Vec; using BaseTType = typename vtkm::VecTraits::BaseComponentType; - template - VTKM_CONT vtkm::exec::GradientVecOutputExecutionObject PrepareForExecution( - Device, + VTKM_CONT vtkm::exec::GradientVecOutputExecutionObject PrepareForExecution( + vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return vtkm::exec::GradientVecOutputExecutionObject(this->G, - this->D, - this->V, - this->Q, - this->Gradient, - this->Divergence, - this->Vorticity, - this->Qcriterion, - this->Size, - token); + return vtkm::exec::GradientVecOutputExecutionObject(this->G, + this->D, + this->V, + this->Q, + this->Gradient, + this->Divergence, + this->Vorticity, + this->Qcriterion, + this->Size, + device, + token); } GradientVecOutput() = default; diff --git a/vtkm/worklet/internal/TriangulateTables.h b/vtkm/worklet/internal/TriangulateTables.h index 3b198f3b9..1d5f0c8c8 100644 --- a/vtkm/worklet/internal/TriangulateTables.h +++ b/vtkm/worklet/internal/TriangulateTables.h @@ -77,11 +77,10 @@ static vtkm::IdComponent TriangleIndexData[] = { 3 }; -template class TriangulateTablesExecutionObject { public: - using PortalType = typename TriangulateArrayHandle::ExecutionTypes::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 - VTKM_CONT TriangulateTablesExecutionObject PrepareForExecution( - Device, - vtkm::cont::Token& token) const + VTKM_CONT TriangulateTablesExecutionObject PrepareForExecution(vtkm::cont::DeviceAdapterId device, + vtkm::cont::Token& token) const { if (BasicImpl) { - return TriangulateTablesExecutionObject(); + return TriangulateTablesExecutionObject(); } - return TriangulateTablesExecutionObject( - 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 class TetrahedralizeTablesExecutionObject { public: - using PortalType = typename TriangulateArrayHandle::ExecutionTypes::PortalConst; + using PortalType = typename TriangulateArrayHandle::ReadPortalType; template 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 - VTKM_CONT TetrahedralizeTablesExecutionObject PrepareForExecution( - Device, - vtkm::cont::Token& token) const + VTKM_CONT TetrahedralizeTablesExecutionObject + PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { if (BasicImpl) { - return TetrahedralizeTablesExecutionObject(); + return TetrahedralizeTablesExecutionObject(); } - return TetrahedralizeTablesExecutionObject( - this->Counts, this->Offsets, this->Indices, token); + return TetrahedralizeTablesExecutionObject( + this->Counts, this->Offsets, this->Indices, device, token); } VTKM_CONT diff --git a/vtkm/worklet/particleadvection/CellInterpolationHelper.h b/vtkm/worklet/particleadvection/CellInterpolationHelper.h index 3215679a7..930edf32d 100644 --- a/vtkm/worklet/particleadvection/CellInterpolationHelper.h +++ b/vtkm/worklet/particleadvection/CellInterpolationHelper.h @@ -16,7 +16,10 @@ #include #include +#include +#include #include +#include #include /* @@ -99,11 +102,10 @@ private: bool Is3D = true; }; -template class SingleCellTypeInterpolationHelper : public vtkm::exec::CellInterpolationHelper { using ConnType = vtkm::cont::ArrayHandle; - using ConnPortalType = typename ConnType::template ExecutionTypes::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 class ExplicitCellInterpolationHelper : public vtkm::exec::CellInterpolationHelper { using ShapeType = vtkm::cont::ArrayHandle; using OffsetType = vtkm::cont::ArrayHandle; using ConnType = vtkm::cont::ArrayHandle; - using ShapePortalType = typename ShapeType::template ExecutionTypes::PortalConst; - using OffsetPortalType = typename OffsetType::template ExecutionTypes::PortalConst; - using ConnPortalType = typename ConnType::template ExecutionTypes::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 - 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; + 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 - VTKM_CONT bool operator()(DeviceAdapter, - const vtkm::cont::ExplicitCellInterpolationHelper& contInterpolator, - HandleType& execInterpolator, - vtkm::cont::Token& token) const - { - using ExecutionType = vtkm::exec::ExplicitCellInterpolationHelper; - 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: diff --git a/vtkm/worklet/particleadvection/Field.h b/vtkm/worklet/particleadvection/Field.h index 3dbff42c5..d776ede20 100644 --- a/vtkm/worklet/particleadvection/Field.h +++ b/vtkm/worklet/particleadvection/Field.h @@ -13,8 +13,10 @@ #include +#include #include #include +#include #include namespace vtkm @@ -38,16 +40,17 @@ public: vtkm::VecVariable& value) const = 0; }; -template +template class ExecutionVelocityField : public vtkm::worklet::particleadvection::ExecutionField { public: - using FieldPortalType = - typename FieldArrayType::template ExecutionTypes::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 +template class ExecutionElectroMagneticField : public vtkm::worklet::particleadvection::ExecutionField { public: - using FieldPortalType = - typename FieldArrayType::template ExecutionTypes::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 - VTKM_CONT bool operator()(DeviceAdapter, - FieldArrayType fieldValues, - HandleType& execHandle, - vtkm::cont::Token& token) const - { - using ExecutionType = ExecutionVelocityField; - 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; + 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 - VTKM_CONT bool operator()(DeviceAdapter, - FieldArrayType electricField, - FieldArrayType magneticField, - HandleType& execHandle, - vtkm::cont::Token& token) const - { - using ExecutionType = ExecutionElectroMagneticField; - 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; + ExecutionType* execObject = + new ExecutionType(this->ElectricField, this->MagneticField, device, token); + this->ExecHandle.Reset(execObject); + return this->ExecHandle.PrepareForExecution(device, token); } private: diff --git a/vtkm/worklet/particleadvection/GridEvaluators.h b/vtkm/worklet/particleadvection/GridEvaluators.h index c21f43fa7..708998a63 100644 --- a/vtkm/worklet/particleadvection/GridEvaluators.h +++ b/vtkm/worklet/particleadvection/GridEvaluators.h @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -36,7 +35,7 @@ namespace worklet namespace particleadvection { -template +template class ExecutionGridEvaluator { using GhostCellArrayType = vtkm::cont::ArrayHandle; @@ -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::template ExecutionTypes< - DeviceAdapter>::PortalConst; + using GhostCellPortal = typename vtkm::cont::ArrayHandle::ReadPortalType; vtkm::Bounds Bounds; const vtkm::worklet::particleadvection::ExecutionField* Field; @@ -198,17 +197,17 @@ public: this->InitializeLocator(coordinates, cellset); } - template - VTKM_CONT ExecutionGridEvaluator PrepareForExecution( - DeviceAdapter, + VTKM_CONT ExecutionGridEvaluator PrepareForExecution( + vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return ExecutionGridEvaluator(this->Locator, - this->InterpolationHelper, - this->Bounds, - this->Field, - this->GhostCellArray, - token); + return ExecutionGridEvaluator(this->Locator, + this->InterpolationHelper, + this->Bounds, + this->Field, + this->GhostCellArray, + device, + token); } private: diff --git a/vtkm/worklet/particleadvection/Particles.h b/vtkm/worklet/particleadvection/Particles.h index b4897e155..d7ea7a91b 100644 --- a/vtkm/worklet/particleadvection/Particles.h +++ b/vtkm/worklet/particleadvection/Particles.h @@ -16,7 +16,6 @@ #include #include #include -#include #include #include @@ -26,7 +25,7 @@ namespace worklet { namespace particleadvection { -template +template class ParticleExecutionObject { public: @@ -39,9 +38,10 @@ public: ParticleExecutionObject(vtkm::cont::ArrayHandle 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::template ExecutionTypes::Portal; + using ParticlePortal = typename vtkm::cont::ArrayHandle::WritePortalType; ParticlePortal Particles; vtkm::Id MaxSteps; @@ -114,12 +113,11 @@ template class Particles : public vtkm::cont::ExecutionObjectBase { public: - template - VTKM_CONT vtkm::worklet::particleadvection::ParticleExecutionObject - PrepareForExecution(Device, vtkm::cont::Token& token) const + VTKM_CONT vtkm::worklet::particleadvection::ParticleExecutionObject + PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return vtkm::worklet::particleadvection::ParticleExecutionObject( - this->ParticleArray, this->MaxSteps, token); + return vtkm::worklet::particleadvection::ParticleExecutionObject( + this->ParticleArray, this->MaxSteps, device, token); } VTKM_CONT @@ -137,13 +135,13 @@ protected: }; -template -class StateRecordingParticleExecutionObject : public ParticleExecutionObject +template +class StateRecordingParticleExecutionObject : public ParticleExecutionObject { public: VTKM_EXEC_CONT StateRecordingParticleExecutionObject() - : ParticleExecutionObject() + : ParticleExecutionObject() , History() , Length(0) , StepCount() @@ -156,20 +154,21 @@ public: vtkm::cont::ArrayHandle validPointArray, vtkm::cont::ArrayHandle stepCountArray, vtkm::Id maxSteps, + vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) - : ParticleExecutionObject(pArray, maxSteps, token) + : ParticleExecutionObject(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::GetParticle(idx); + ParticleType p = this->ParticleExecutionObject::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::StepUpdate(idx, time, pt); + this->ParticleExecutionObject::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::template ExecutionTypes::Portal; - using HistoryPortal = - typename vtkm::cont::ArrayHandle::template ExecutionTypes::Portal; + using IdPortal = typename vtkm::cont::ArrayHandle::WritePortalType; + using HistoryPortal = typename vtkm::cont::ArrayHandle::WritePortalType; HistoryPortal History; vtkm::Id Length; @@ -220,18 +217,16 @@ public: }; - template - VTKM_CONT - vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject - PrepareForExecution(Device, vtkm::cont::Token& token) const + VTKM_CONT vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject + PrepareForExecution(vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject( + return vtkm::worklet::particleadvection::StateRecordingParticleExecutionObject( this->ParticleArray, this->HistoryArray, this->ValidPointArray, this->StepCountArray, this->MaxSteps, + device, token); } VTKM_CONT diff --git a/vtkm/worklet/particleadvection/TemporalGridEvaluators.h b/vtkm/worklet/particleadvection/TemporalGridEvaluators.h index d3fd87c82..1cafc8569 100644 --- a/vtkm/worklet/particleadvection/TemporalGridEvaluators.h +++ b/vtkm/worklet/particleadvection/TemporalGridEvaluators.h @@ -21,13 +21,13 @@ namespace worklet namespace particleadvection { -template +template class ExecutionTemporalGridEvaluator { private: using GridEvaluator = vtkm::worklet::particleadvection::GridEvaluator; using ExecutionGridEvaluator = - vtkm::worklet::particleadvection::ExecutionGridEvaluator; + vtkm::worklet::particleadvection::ExecutionGridEvaluator; 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 - VTKM_CONT ExecutionTemporalGridEvaluator PrepareForExecution( - DeviceAdapter, + VTKM_CONT ExecutionTemporalGridEvaluator PrepareForExecution( + vtkm::cont::DeviceAdapterId device, vtkm::cont::Token& token) const { - return ExecutionTemporalGridEvaluator( - this->EvaluatorOne, this->TimeOne, this->EvaluatorTwo, this->TimeTwo, token); + return ExecutionTemporalGridEvaluator( + this->EvaluatorOne, this->TimeOne, this->EvaluatorTwo, this->TimeTwo, device, token); } private: diff --git a/vtkm/worklet/testing/UnitTestContourTreeUniformDistributed.cxx b/vtkm/worklet/testing/UnitTestContourTreeUniformDistributed.cxx index 1ee65f07b..e6745feee 100644 --- a/vtkm/worklet/testing/UnitTestContourTreeUniformDistributed.cxx +++ b/vtkm/worklet/testing/UnitTestContourTreeUniformDistributed.cxx @@ -58,19 +58,6 @@ namespace { -// Functor needed so we can discover the FieldType and DeviceAdapter template parameters to call MergeWith -struct MergeContourTreeMeshFunctor -{ - template - bool operator()(DeviceAdapterTag, - vtkm::worklet::contourtree_augmented::ContourTreeMesh& in, - vtkm::worklet::contourtree_augmented::ContourTreeMesh& out) const - { - out.template MergeWith(in); - return true; - } -}; - template 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 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 combinedContourTreeMesh; combinedContourTreeMesh.Load(combined_filename.c_str()); diff --git a/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h b/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h index 6067aa7bf..4fb9edf08 100644 --- a/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h +++ b/vtkm/worklet/tetrahedralize/TetrahedralizeExplicit.h @@ -15,7 +15,6 @@ #include #include #include -#include #include #include @@ -50,11 +49,9 @@ public: VTKM_CONT TetrahedraPerCell() {} - template VTKM_EXEC vtkm::IdComponent operator()( vtkm::UInt8 shape, - const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject& 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 + template VTKM_EXEC void operator()( CellShapeTag shape, const ConnectivityInVec& connectivityIn, - const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject& tables, + const vtkm::worklet::internal::TetrahedralizeTablesExecutionObject& tables, ConnectivityOutVec& connectivityOut, vtkm::IdComponent visitIndex) const { diff --git a/vtkm/worklet/triangulate/TriangulateExplicit.h b/vtkm/worklet/triangulate/TriangulateExplicit.h index b4268a46f..a963c27dd 100644 --- a/vtkm/worklet/triangulate/TriangulateExplicit.h +++ b/vtkm/worklet/triangulate/TriangulateExplicit.h @@ -52,11 +52,10 @@ public: VTKM_CONT TrianglesPerCell() {} - template VTKM_EXEC vtkm::IdComponent operator()( vtkm::UInt8 shape, vtkm::IdComponent numPoints, - const vtkm::worklet::internal::TriangulateTablesExecutionObject& 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 + template VTKM_EXEC void operator()( CellShapeTag shape, const ConnectivityInVec& connectivityIn, - const vtkm::worklet::internal::TriangulateTablesExecutionObject& tables, + const vtkm::worklet::internal::TriangulateTablesExecutionObject& tables, ConnectivityOutVec& connectivityOut, vtkm::IdComponent visitIndex) const {