From 29458137552a1c033378ae3b878036eea393f16a Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Thu, 27 Oct 2022 15:07:41 -0600 Subject: [PATCH] Removed ExecutionWholeArray class `ExecutionWholeArray` is an archaic class in VTK-m that is a thin wrapper around an array portal. In the early days of VTK-m, this class was used to transfer whole arrays to the execution environment. However, now the supported method is to use `WholeArray*` tags in the `ControlSignature` of a worklet. Nevertheless, the `WholeArray*` tags caused the array portal transferred to the worklet to be wrapped inside of an `ExecutionWholeArray` class. This is unnecessary and can cause confusion about the types of data being used. Most code is unaffected by this change. Some code that had to work around the issue of the portal wrapped in another class used the `GetPortal` method which is no longer needed (for obvious reasons). One extra feature that `ExecutionWholeArray` had was that it provided an subscript operator (somewhat incorrectly). Thus, any use of '[..]' to index the array portal have to be changed to use the `Get` method. --- benchmarking/BenchmarkFieldAlgorithms.cxx | 25 ++- docs/changelog/no-execution-whole-array.md | 18 ++ vtkm/cont/arg/TransportTagWholeArrayIn.h | 6 +- vtkm/cont/arg/TransportTagWholeArrayInOut.h | 6 +- vtkm/cont/arg/TransportTagWholeArrayOut.h | 6 +- .../UnitTestCellLocatorRectilinearGrid.cxx | 2 +- vtkm/exec/CMakeLists.txt | 1 - vtkm/exec/ExecutionWholeArray.h | 191 ------------------ vtkm/filter/contour/worklet/MIR.h | 26 +-- .../contour/worklet/contour/MarchingCells.h | 19 +- vtkm/filter/resampling/worklet/Probe.h | 11 +- .../activegraph/SetArcsSlideVertices.h | 6 +- .../meshextrema/PointerDoubling.h | 1 - .../worklet/gradient/PointGradient.h | 13 +- vtkm/source/PerlinNoise.cxx | 17 +- .../BoundingIntervalHierarchy.h | 14 +- 16 files changed, 90 insertions(+), 272 deletions(-) create mode 100644 docs/changelog/no-execution-whole-array.md delete mode 100644 vtkm/exec/ExecutionWholeArray.h diff --git a/benchmarking/BenchmarkFieldAlgorithms.cxx b/benchmarking/BenchmarkFieldAlgorithms.cxx index 13899d63c..ed3a3f871 100644 --- a/benchmarking/BenchmarkFieldAlgorithms.cxx +++ b/benchmarking/BenchmarkFieldAlgorithms.cxx @@ -225,21 +225,30 @@ public: using ExecutionSignature = void(_1, _2, _3, _4); using InputDomain = _1; - template + template VTKM_EXEC void operator()(const vtkm::Id2& low_high, const WeightType& weight, - const vtkm::exec::ExecutionWholeArrayConst& inPortal, - T& result) const + const PortalType& inPortal, + U& result) const + { + using T = typename PortalType::ValueType; + this->DoIt(low_high, weight, inPortal, result, typename std::is_same::type{}); + } + + template + VTKM_EXEC void DoIt(const vtkm::Id2& low_high, + const WeightType& weight, + const PortalType& inPortal, + typename PortalType::ValueType& result, + std::true_type) const { //fetch the low / high values from inPortal result = vtkm::Lerp(inPortal.Get(low_high[0]), inPortal.Get(low_high[1]), weight); } - template - VTKM_EXEC void operator()(const vtkm::Id2&, - const WeightType&, - const vtkm::exec::ExecutionWholeArrayConst&, - U&) const + template + VTKM_EXEC void DoIt(const vtkm::Id2&, const WeightType&, const PortalType&, U&, std::false_type) + const { //the inPortal and result need to be the same type so this version only //exists to generate code when using dynamic arrays diff --git a/docs/changelog/no-execution-whole-array.md b/docs/changelog/no-execution-whole-array.md new file mode 100644 index 000000000..d7eb97ba7 --- /dev/null +++ b/docs/changelog/no-execution-whole-array.md @@ -0,0 +1,18 @@ +# Removed ExecutionWholeArray class + +`ExecutionWholeArray` is an archaic class in VTK-m that is a thin wrapper +around an array portal. In the early days of VTK-m, this class was used to +transfer whole arrays to the execution environment. However, now the +supported method is to use `WholeArray*` tags in the `ControlSignature` of +a worklet. + +Nevertheless, the `WholeArray*` tags caused the array portal transferred to +the worklet to be wrapped inside of an `ExecutionWholeArray` class. This +is unnecessary and can cause confusion about the types of data being used. + +Most code is unaffected by this change. Some code that had to work around +the issue of the portal wrapped in another class used the `GetPortal` +method which is no longer needed (for obvious reasons). One extra feature +that `ExecutionWholeArray` had was that it provided an subscript operator +(somewhat incorrectly). Thus, any use of '[..]' to index the array portal +have to be changed to use the `Get` method. diff --git a/vtkm/cont/arg/TransportTagWholeArrayIn.h b/vtkm/cont/arg/TransportTagWholeArrayIn.h index 86454234d..1a9e75333 100644 --- a/vtkm/cont/arg/TransportTagWholeArrayIn.h +++ b/vtkm/cont/arg/TransportTagWholeArrayIn.h @@ -16,8 +16,6 @@ #include -#include - namespace vtkm { namespace cont @@ -56,7 +54,7 @@ struct Transport; + using ExecObjectType = typename ContObjectType::ReadPortalType; template VTKM_CONT ExecObjectType operator()(ContObjectType& array, @@ -69,7 +67,7 @@ struct Transport -#include - namespace vtkm { namespace cont @@ -58,7 +56,7 @@ struct Transport; + using ExecObjectType = typename ContObjectType::WritePortalType; template VTKM_CONT ExecObjectType operator()(ContObjectType& array, @@ -71,7 +69,7 @@ struct Transport -#include - namespace vtkm { namespace cont @@ -58,7 +56,7 @@ struct Transport; + using ExecObjectType = typename ContObjectType::WritePortalType; template VTKM_CONT ExecObjectType operator()(ContObjectType& array, @@ -71,7 +69,7 @@ struct Transport -#include - -#include - -namespace vtkm -{ -namespace exec -{ - -/// The following classes have been sort of deprecated and are meant to be used -/// internally only. Please use the \c WholeArrayIn, \c WholeArrayOut, and -/// \c WholeArrayInOut \c ControlSignature tags instead. - -/// \c ExecutionWholeArray is an execution object that allows an array handle -/// content to be a parameter in an execution environment -/// function. This can be used to allow worklets to have a shared search -/// structure. -/// -template -class ExecutionWholeArray; - -template -class ExecutionWholeArray -{ -public: - using ValueType = T; - using HandleType = vtkm::cont::ArrayHandle; - using PortalType = typename HandleType::WritePortalType; - - VTKM_CONT - ExecutionWholeArray() - : Portal() - { - } - - VTKM_CONT - ExecutionWholeArray(HandleType& handle, - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) - : Portal(handle.PrepareForInPlace(device, token)) - { - } - - VTKM_CONT - ExecutionWholeArray(HandleType& handle, - vtkm::Id length, - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) - : Portal(handle.PrepareForOutput(length, device, token)) - { - } - - VTKM_EXEC - vtkm::Id GetNumberOfValues() const { return this->Portal.GetNumberOfValues(); } - - VTKM_EXEC - T Get(vtkm::Id index) const { return this->Portal.Get(index); } - - VTKM_EXEC - T operator[](vtkm::Id index) const { return this->Portal.Get(index); } - - VTKM_EXEC - void Set(vtkm::Id index, const T& t) const { this->Portal.Set(index, t); } - - VTKM_EXEC - const PortalType& GetPortal() const { return this->Portal; } - -private: - PortalType Portal; -}; - -template -class VTKM_DEPRECATED(1.6, "ExecutionWholeArray no longer uses Device template parameter.") - ExecutionWholeArray : public ExecutionWholeArray -{ - using Superclass = ExecutionWholeArray; - using HandleType = typename Superclass::HandleType; - -public: - using Superclass::Superclass; - - VTKM_CONT ExecutionWholeArray(HandleType& handle) - : Superclass(handle, Device{}, vtkm::cont::Token{}) - { - } - - VTKM_CONT - ExecutionWholeArray(HandleType& handle, vtkm::Id length) - : Superclass(handle, length, Device{}, vtkm::cont::Token{}) - { - } - - VTKM_CONT - ExecutionWholeArray(HandleType& handle, vtkm::cont::Token& token) - : Superclass(handle, Device{}, token) - { - } - - VTKM_CONT - ExecutionWholeArray(HandleType& handle, vtkm::Id length, vtkm::cont::Token& token) - : Superclass(handle, length, Device{}, token) - { - } -}; - -/// \c ExecutionWholeArrayConst is an execution object that allows an array handle -/// content to be a parameter in an execution environment -/// function. This can be used to allow worklets to have a shared search -/// structure -/// -template -class ExecutionWholeArrayConst; - -template -class ExecutionWholeArrayConst -{ -public: - using ValueType = T; - using HandleType = vtkm::cont::ArrayHandle; - using PortalType = typename HandleType::ReadPortalType; - - VTKM_CONT - ExecutionWholeArrayConst() - : Portal() - { - } - - VTKM_CONT - ExecutionWholeArrayConst(const HandleType& handle, - vtkm::cont::DeviceAdapterId device, - vtkm::cont::Token& token) - : Portal(handle.PrepareForInput(device, token)) - { - } - - VTKM_EXEC - vtkm::Id GetNumberOfValues() const { return this->Portal.GetNumberOfValues(); } - - VTKM_EXEC - T Get(vtkm::Id index) const { return this->Portal.Get(index); } - - VTKM_EXEC - T operator[](vtkm::Id index) const { return this->Portal.Get(index); } - - VTKM_EXEC - const PortalType& GetPortal() const { return this->Portal; } - -private: - PortalType Portal; -}; - -template -class VTKM_DEPRECATED(1.6, "ExecutionWholeArray no longer uses Device template parameter.") - ExecutionWholeArrayConst : public ExecutionWholeArrayConst -{ - using Superclass = ExecutionWholeArrayConst; - using HandleType = typename Superclass::HandleType; - -public: - using Superclass::Superclass; - - VTKM_CONT ExecutionWholeArrayConst(HandleType& handle) - : Superclass(handle, Device{}, vtkm::cont::Token{}) - { - } - - VTKM_CONT - ExecutionWholeArrayConst(HandleType& handle, vtkm::cont::Token& token) - : Superclass(handle, Device{}, token) - { - } -}; - - -} -} // namespace vtkm::exec - -#endif //vtk_m_exec_ExecutionWholeArray_h diff --git a/vtkm/filter/contour/worklet/MIR.h b/vtkm/filter/contour/worklet/MIR.h index 542f11da6..f3d794e79 100644 --- a/vtkm/filter/contour/worklet/MIR.h +++ b/vtkm/filter/contour/worklet/MIR.h @@ -271,8 +271,8 @@ public: { for (vtkm::IdComponent iter = pointCount - 1; iter >= 0; iter--) { - if (static_cast(prevVals[valPositionStart + iter]) <= - static_cast(newVals[valPositionStart + iter])) + if (static_cast(prevVals.Get(valPositionStart + iter)) <= + static_cast(newVals.Get(valPositionStart + iter))) { caseId++; } @@ -548,11 +548,12 @@ public: // need to swap the weight of the point to be A-C / ((D-C) - (B-A)), // where A and C are edge0 mats 1 and 2, and B and D are edge1 mats 1 and 2. ei.Weight = vtkm::Float64(1) + - ((static_cast(curScalars[valPositionStart + edge[0]] - - newScalars[valPositionStart + edge[0]])) / - static_cast( - curScalars[valPositionStart + edge[1]] - curScalars[valPositionStart + edge[0]] + - newScalars[valPositionStart + edge[0]] - newScalars[valPositionStart + edge[1]])); + ((static_cast(curScalars.Get(valPositionStart + edge[0]) - + newScalars.Get(valPositionStart + edge[0]))) / + static_cast(curScalars.Get(valPositionStart + edge[1]) - + curScalars.Get(valPositionStart + edge[0]) + + newScalars.Get(valPositionStart + edge[0]) - + newScalars.Get(valPositionStart + edge[1]))); inCellEdgeReverseConnectivity.Set(inCellEdgeInterpIndex, inCellInterpPointIndex); inCellEdgeInterpolation.Set(inCellEdgeInterpIndex, ei); @@ -609,11 +610,12 @@ public: } ei.Weight = vtkm::Float64(1) + - ((static_cast(curScalars[valPositionStart + edge[0]] - - newScalars[valPositionStart + edge[0]])) / - static_cast( - curScalars[valPositionStart + edge[1]] - curScalars[valPositionStart + edge[0]] + - newScalars[valPositionStart + edge[0]] - newScalars[valPositionStart + edge[1]])); + ((static_cast(curScalars.Get(valPositionStart + edge[0]) - + newScalars.Get(valPositionStart + edge[0]))) / + static_cast(curScalars.Get(valPositionStart + edge[1]) - + curScalars.Get(valPositionStart + edge[0]) + + newScalars.Get(valPositionStart + edge[0]) - + newScalars.Get(valPositionStart + edge[1]))); //Add to set of new edge points //Add reverse connectivity; edgePointReverseConnectivity.Set(edgeIndex, connectivityIndex++); diff --git a/vtkm/filter/contour/worklet/contour/MarchingCells.h b/vtkm/filter/contour/worklet/contour/MarchingCells.h index 292ec8557..4f25997e1 100644 --- a/vtkm/filter/contour/worklet/contour/MarchingCells.h +++ b/vtkm/filter/contour/worklet/contour/MarchingCells.h @@ -103,7 +103,7 @@ public: vtkm::IdComponent caseNumber = 0; for (vtkm::IdComponent j = 0; j < numVerticesPerCell; ++j) { - caseNumber |= (fieldIn[j] > isovalues[i]) << j; + caseNumber |= (fieldIn[j] > isovalues.Get(i)) << j; } sum += classifyTable.GetNumTriangles(shape.Id, caseNumber); @@ -239,7 +239,7 @@ public: for (i = 0; i < numIsoValues; ++i) { - const FieldType ivalue = isovalues[i]; + const FieldType ivalue = isovalues.Get(i); // Compute the Marching Cubes case number for this cell. We need to iterate // the isovalues until the sum >= our visit index. But we need to make // sure the caseNumber is correct before stopping @@ -275,7 +275,8 @@ public: outputPointId + triVertex, vtkm::Id2(indices[edgeVertices.first], indices[edgeVertices.second])); - vtkm::FloatDefault interpolant = static_cast(isovalues[i] - fieldValue0) / + vtkm::FloatDefault interpolant = + static_cast(isovalues.Get(i) - fieldValue0) / static_cast(fieldValue1 - fieldValue0); metaData.InterpWeightsPortal.Set(outputPointId + triVertex, interpolant); @@ -448,10 +449,8 @@ public: vtkm::exec::arg::ThreadIndicesPointNeighborhood tpn(pointId, pointId, 0, pointId, pointGeom); const auto& boundary = tpn.GetBoundaryState(); - auto pointPortal = pointCoordinates.GetPortal(); - auto fieldPortal = inputField.GetPortal(); - vtkm::exec::FieldNeighborhood points(pointPortal, boundary); - vtkm::exec::FieldNeighborhood field(fieldPortal, boundary); + vtkm::exec::FieldNeighborhood points(pointCoordinates, boundary); + vtkm::exec::FieldNeighborhood field(inputField, boundary); vtkm::worklet::gradient::StructuredPointGradient gradient; gradient(boundary, points, field, normal); @@ -530,10 +529,8 @@ public: vtkm::exec::arg::ThreadIndicesPointNeighborhood tpn(pointId, pointId, 0, pointId, pointGeom); const auto& boundary = tpn.GetBoundaryState(); - auto pointPortal = pointCoordinates.GetPortal(); - auto fieldPortal = inputField.GetPortal(); - vtkm::exec::FieldNeighborhood points(pointPortal, boundary); - vtkm::exec::FieldNeighborhood field(fieldPortal, boundary); + vtkm::exec::FieldNeighborhood points(pointCoordinates, boundary); + vtkm::exec::FieldNeighborhood field(inputField, boundary); vtkm::worklet::gradient::StructuredPointGradient gradient; NormalType grad1; diff --git a/vtkm/filter/resampling/worklet/Probe.h b/vtkm/filter/resampling/worklet/Probe.h index 178a94255..10ce47ac3 100644 --- a/vtkm/filter/resampling/worklet/Probe.h +++ b/vtkm/filter/resampling/worklet/Probe.h @@ -109,15 +109,14 @@ public: } // Compute points inside cell bounds - auto portal = points.GetPortal(); auto minp = - static_cast(vtkm::Ceil((cbmin - portal.GetOrigin()) / portal.GetSpacing())); + static_cast(vtkm::Ceil((cbmin - points.GetOrigin()) / points.GetSpacing())); auto maxp = - static_cast(vtkm::Floor((cbmax - portal.GetOrigin()) / portal.GetSpacing())); + static_cast(vtkm::Floor((cbmax - points.GetOrigin()) / points.GetSpacing())); // clamp minp = vtkm::Max(minp, vtkm::Id3(0)); - maxp = vtkm::Min(maxp, portal.GetDimensions() - vtkm::Id3(1)); + maxp = vtkm::Min(maxp, points.GetDimensions() - vtkm::Id3(1)); for (vtkm::Id k = minp[2]; k <= maxp[2]; ++k) { @@ -125,13 +124,13 @@ public: { for (vtkm::Id i = minp[0]; i <= maxp[0]; ++i) { - auto pt = portal.Get(vtkm::Id3(i, j, k)); + auto pt = points.Get(vtkm::Id3(i, j, k)); CoordsType pc; vtkm::ErrorCode status = vtkm::exec::WorldCoordinatesToParametricCoordinates(cellPoints, pt, cellShape, pc); if ((status == vtkm::ErrorCode::Success) && vtkm::exec::CellInside(pc, cellShape)) { - auto pointId = i + portal.GetDimensions()[0] * (j + portal.GetDimensions()[1] * k); + auto pointId = i + points.GetDimensions()[0] * (j + points.GetDimensions()[1] * k); cellIds.Set(pointId, cellId); pcoords.Set(pointId, pc); } diff --git a/vtkm/filter/scalar_topology/worklet/contourtree_augmented/activegraph/SetArcsSlideVertices.h b/vtkm/filter/scalar_topology/worklet/contourtree_augmented/activegraph/SetArcsSlideVertices.h index 5af78866c..1885b2cf3 100644 --- a/vtkm/filter/scalar_topology/worklet/contourtree_augmented/activegraph/SetArcsSlideVertices.h +++ b/vtkm/filter/scalar_topology/worklet/contourtree_augmented/activegraph/SetArcsSlideVertices.h @@ -148,14 +148,14 @@ public: if (hyperID == NumHypernodes - 1) rightSupernodeID = NumSupernodes - 1; else - rightSupernodeID = treeFirstSuperchildPortal[hyperID + 1] - 1; + rightSupernodeID = treeFirstSuperchildPortal.Get(hyperID + 1) - 1; } // join graph else { // split graph if (hyperID == 0) rightSupernodeID = NumSupernodes - 1; else - rightSupernodeID = treeFirstSuperchildPortal[hyperID - 1] - 1; + rightSupernodeID = treeFirstSuperchildPortal.Get(hyperID - 1) - 1; } // split graph // the right end is guaranteed to be the hypernode at the top, which is not @@ -164,7 +164,7 @@ public: while (leftSupernodeID != rightSupernodeID - 1) { // binary search vtkm::Id midSupernodeID = (leftSupernodeID + rightSupernodeID) / 2; - vtkm::Id midNodeID = treeSupernodesPortal[midSupernodeID]; + vtkm::Id midNodeID = treeSupernodesPortal.Get(midSupernodeID); // this is NEVER equal, because nodeID cannot be a supernode if (IsJoinGraph ? (midNodeID > nodeID) : (midNodeID < nodeID)) rightSupernodeID = midSupernodeID; diff --git a/vtkm/filter/scalar_topology/worklet/contourtree_augmented/meshextrema/PointerDoubling.h b/vtkm/filter/scalar_topology/worklet/contourtree_augmented/meshextrema/PointerDoubling.h index 2292603b6..3bd04dabf 100644 --- a/vtkm/filter/scalar_topology/worklet/contourtree_augmented/meshextrema/PointerDoubling.h +++ b/vtkm/filter/scalar_topology/worklet/contourtree_augmented/meshextrema/PointerDoubling.h @@ -53,7 +53,6 @@ #ifndef vtk_m_worklet_contourtree_augmented_pointer_doubling_h #define vtk_m_worklet_contourtree_augmented_pointer_doubling_h -#include #include #include diff --git a/vtkm/filter/vector_analysis/worklet/gradient/PointGradient.h b/vtkm/filter/vector_analysis/worklet/gradient/PointGradient.h index 2fbc4caa5..2dc069e5d 100644 --- a/vtkm/filter/vector_analysis/worklet/gradient/PointGradient.h +++ b/vtkm/filter/vector_analysis/worklet/gradient/PointGradient.h @@ -128,26 +128,17 @@ private: return result; } - //This is fairly complex so that we can trigger code to extract - //VecRectilinearPointCoordinates when using structured connectivity, and - //uniform point coordinates. - //c++14 would make the return type simply auto template VTKM_EXEC auto GetValues(const ThreadIndicesType& indices, const WholeFieldIn& in) const - -> decltype(std::declval>() - .Load(indices, in.GetPortal())) { //the current problem is that when the topology is structured //we are passing in an vtkm::Id when it wants a Id2 or an Id3 that //represents the flat index of the topology - using ExecObjectType = typename WholeFieldIn::PortalType; using Fetch = vtkm::exec::arg::Fetch; + WholeFieldIn>; Fetch fetch; - return fetch.Load(indices, in.GetPortal()); + return fetch.Load(indices, in); } }; } diff --git a/vtkm/source/PerlinNoise.cxx b/vtkm/source/PerlinNoise.cxx index d5116b90b..6391dc136 100644 --- a/vtkm/source/PerlinNoise.cxx +++ b/vtkm/source/PerlinNoise.cxx @@ -46,14 +46,15 @@ struct PerlinNoiseWorklet : public vtkm::worklet::WorkletVisitPointsWithCells vtkm::FloatDefault w = this->Fade(zf); vtkm::Id aaa, aba, aab, abb, baa, bba, bab, bbb; - aaa = perms[perms[perms[xi] + yi] + zi]; - aba = perms[perms[perms[xi] + this->Increment(yi)] + zi]; - aab = perms[perms[perms[xi] + yi] + this->Increment(zi)]; - abb = perms[perms[perms[xi] + this->Increment(yi)] + this->Increment(zi)]; - baa = perms[perms[perms[this->Increment(xi)] + yi] + zi]; - bba = perms[perms[perms[this->Increment(xi)] + this->Increment(yi)] + zi]; - bab = perms[perms[perms[this->Increment(xi)] + yi] + this->Increment(zi)]; - bbb = perms[perms[perms[this->Increment(xi)] + this->Increment(yi)] + this->Increment(zi)]; + aaa = perms.Get(perms.Get(perms.Get(xi) + yi) + zi); + aba = perms.Get(perms.Get(perms.Get(xi) + this->Increment(yi)) + zi); + aab = perms.Get(perms.Get(perms.Get(xi) + yi) + this->Increment(zi)); + abb = perms.Get(perms.Get(perms.Get(xi) + this->Increment(yi)) + this->Increment(zi)); + baa = perms.Get(perms.Get(perms.Get(this->Increment(xi)) + yi) + zi); + bba = perms.Get(perms.Get(perms.Get(this->Increment(xi)) + this->Increment(yi)) + zi); + bab = perms.Get(perms.Get(perms.Get(this->Increment(xi)) + yi) + this->Increment(zi)); + bbb = perms.Get(perms.Get(perms.Get(this->Increment(xi)) + this->Increment(yi)) + + this->Increment(zi)); vtkm::FloatDefault x1, x2, y1, y2; x1 = vtkm::Lerp(this->Gradient(aaa, xf, yf, zf), this->Gradient(baa, xf - 1, yf, zf), u); diff --git a/vtkm/worklet/spatialstructure/BoundingIntervalHierarchy.h b/vtkm/worklet/spatialstructure/BoundingIntervalHierarchy.h index 167c7c810..3ab0821a7 100644 --- a/vtkm/worklet/spatialstructure/BoundingIntervalHierarchy.h +++ b/vtkm/worklet/spatialstructure/BoundingIntervalHierarchy.h @@ -281,7 +281,7 @@ public: choice = 1; using Split = SplitProperties; vtkm::FloatDefault minCost = vtkm::Infinity(); - const Split& xSplit = xSplits[ArgMin(xSplits, index * Stride, Stride)]; + const Split& xSplit = xSplits.Get(ArgMin(xSplits, index * Stride, Stride)); bool found = false; if (xSplit.Cost < minCost && xSplit.NumLeftPoints != 0 && xSplit.NumRightPoints != 0) { @@ -292,7 +292,7 @@ public: plane = xSplit.Plane; found = true; } - const Split& ySplit = ySplits[ArgMin(ySplits, index * Stride, Stride)]; + const Split& ySplit = ySplits.Get(ArgMin(ySplits, index * Stride, Stride)); if (ySplit.Cost < minCost && ySplit.NumLeftPoints != 0 && ySplit.NumRightPoints != 0) { minCost = ySplit.Cost; @@ -302,7 +302,7 @@ public: plane = ySplit.Plane; found = true; } - const Split& zSplit = zSplits[ArgMin(zSplits, index * Stride, Stride)]; + const Split& zSplit = zSplits.Get(ArgMin(zSplits, index * Stride, Stride)); if (zSplit.Cost < minCost && zSplit.NumLeftPoints != 0 && zSplit.NumRightPoints != 0) { minCost = zSplit.Cost; @@ -314,13 +314,13 @@ public: } if (!found) { - const Split& xMSplit = xSplits[NumPlanes]; + const Split& xMSplit = xSplits.Get(NumPlanes); minCost = xMSplit.Cost; node.Dimension = 0; node.LMax = xMSplit.LMax; node.RMin = xMSplit.RMin; plane = xMSplit.Plane; - const Split& yMSplit = ySplits[NumPlanes]; + const Split& yMSplit = ySplits.Get(NumPlanes); if (yMSplit.Cost < minCost && yMSplit.NumLeftPoints != 0 && yMSplit.NumRightPoints != 0) { minCost = yMSplit.Cost; @@ -329,7 +329,7 @@ public: node.RMin = yMSplit.RMin; plane = yMSplit.Plane; } - const Split& zMSplit = zSplits[NumPlanes]; + const Split& zMSplit = zSplits.Get(NumPlanes); if (zMSplit.Cost < minCost && zMSplit.NumLeftPoints != 0 && zMSplit.NumRightPoints != 0) { minCost = zMSplit.Cost; @@ -348,7 +348,7 @@ public: vtkm::Id minIdx = start; for (vtkm::Id i = start; i < (start + length); ++i) { - if (values[i].Cost < values[minIdx].Cost) + if (values.Get(i).Cost < values.Get(minIdx).Cost) { minIdx = i; }