Merge topic 'no-execution-whole-array'

294581375 Removed ExecutionWholeArray class

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Li-Ta Lo <ollie@lanl.gov>
Merge-request: !2905
This commit is contained in:
Kenneth Moreland 2022-10-31 18:41:49 +00:00 committed by Kitware Robot
commit ef3c4c65c9
16 changed files with 90 additions and 272 deletions

@ -221,21 +221,30 @@ public:
using ExecutionSignature = void(_1, _2, _3, _4);
using InputDomain = _1;
template <typename WeightType, typename T, typename S>
template <typename WeightType, typename PortalType, typename U>
VTKM_EXEC void operator()(const vtkm::Id2& low_high,
const WeightType& weight,
const vtkm::exec::ExecutionWholeArrayConst<T, S>& 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<T, U>::type{});
}
template <typename WeightType, typename PortalType>
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 <typename WeightType, typename T, typename S, typename U>
VTKM_EXEC void operator()(const vtkm::Id2&,
const WeightType&,
const vtkm::exec::ExecutionWholeArrayConst<T, S>&,
U&) const
template <typename WeightType, typename PortalType, typename U>
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

@ -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.

@ -16,8 +16,6 @@
#include <vtkm/cont/arg/Transport.h>
#include <vtkm/exec/ExecutionWholeArray.h>
namespace vtkm
{
namespace cont
@ -56,7 +54,7 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayIn, ContObjectType, Devi
using ValueType = typename ContObjectType::ValueType;
using StorageTag = typename ContObjectType::StorageTag;
using ExecObjectType = vtkm::exec::ExecutionWholeArrayConst<ValueType, StorageTag>;
using ExecObjectType = typename ContObjectType::ReadPortalType;
template <typename InputDomainType>
VTKM_CONT ExecObjectType operator()(ContObjectType& array,
@ -69,7 +67,7 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayIn, ContObjectType, Devi
// array might not have the same size depending on how the user is using
// the array.
return ExecObjectType(array, Device{}, token);
return array.PrepareForInput(Device{}, token);
}
#ifdef VTKM_MSVC

@ -16,8 +16,6 @@
#include <vtkm/cont/arg/Transport.h>
#include <vtkm/exec/ExecutionWholeArray.h>
namespace vtkm
{
namespace cont
@ -58,7 +56,7 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayInOut, ContObjectType, D
using ValueType = typename ContObjectType::ValueType;
using StorageTag = typename ContObjectType::StorageTag;
using ExecObjectType = vtkm::exec::ExecutionWholeArray<ValueType, StorageTag>;
using ExecObjectType = typename ContObjectType::WritePortalType;
template <typename InputDomainType>
VTKM_CONT ExecObjectType operator()(ContObjectType& array,
@ -71,7 +69,7 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayInOut, ContObjectType, D
// array might not have the same size depending on how the user is using
// the array.
return ExecObjectType(array, Device{}, token);
return array.PrepareForInPlace(Device{}, token);
}
#ifdef VTKM_MSVC

@ -16,8 +16,6 @@
#include <vtkm/cont/arg/Transport.h>
#include <vtkm/exec/ExecutionWholeArray.h>
namespace vtkm
{
namespace cont
@ -58,7 +56,7 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Dev
using ValueType = typename ContObjectType::ValueType;
using StorageTag = typename ContObjectType::StorageTag;
using ExecObjectType = vtkm::exec::ExecutionWholeArray<ValueType, StorageTag>;
using ExecObjectType = typename ContObjectType::WritePortalType;
template <typename InputDomainType>
VTKM_CONT ExecObjectType operator()(ContObjectType& array,
@ -71,7 +69,7 @@ struct Transport<vtkm::cont::arg::TransportTagWholeArrayOut, ContObjectType, Dev
// array might not have the same size depending on how the user is using
// the array.
return ExecObjectType(array, array.GetNumberOfValues(), Device{}, token);
return array.PrepareForOutput(array.GetNumberOfValues(), Device{}, token);
}
#ifdef VTKM_MSVC

@ -103,7 +103,7 @@ public:
{
// Note that CoordPortalType is actually a RectilinearPortalType wrapped in an
// ExecutionWholeArrayConst. We need to get out the actual portal.
vtkm::Id calculated = CalculateCellId(pointIn, coordsPortal.GetPortal());
vtkm::Id calculated = CalculateCellId(pointIn, coordsPortal);
vtkm::ErrorCode status = locator.FindCell(pointIn, cellId, parametric);
if (status != vtkm::ErrorCode::Success)
{

@ -27,7 +27,6 @@ set(headers
ConnectivityExtrude.h
ConnectivityPermuted.h
ConnectivityStructured.h
ExecutionWholeArray.h
FieldNeighborhood.h
FunctorBase.h
ParametricCoordinates.h

@ -1,191 +0,0 @@
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_exec_ExecutionWholeArray_h
#define vtk_m_exec_ExecutionWholeArray_h
#include <vtkm/cont/ArrayHandle.h>
#include <vtkm/cont/DeviceAdapter.h>
#include <vtkm/Deprecated.h>
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 <typename T, typename StorageTag, typename... MaybeDevice>
class ExecutionWholeArray;
template <typename T, typename StorageTag>
class ExecutionWholeArray<T, StorageTag>
{
public:
using ValueType = T;
using HandleType = vtkm::cont::ArrayHandle<T, StorageTag>;
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 <typename T, typename StorageTag, typename Device>
class VTKM_DEPRECATED(1.6, "ExecutionWholeArray no longer uses Device template parameter.")
ExecutionWholeArray<T, StorageTag, Device> : public ExecutionWholeArray<T, StorageTag>
{
using Superclass = ExecutionWholeArray<T, StorageTag>;
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 <typename T, typename StorageTag, typename... MaybeDevice>
class ExecutionWholeArrayConst;
template <typename T, typename StorageTag>
class ExecutionWholeArrayConst<T, StorageTag>
{
public:
using ValueType = T;
using HandleType = vtkm::cont::ArrayHandle<T, StorageTag>;
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 <typename T, typename StorageTag, typename Device>
class VTKM_DEPRECATED(1.6, "ExecutionWholeArray no longer uses Device template parameter.")
ExecutionWholeArrayConst<T, StorageTag, Device> : public ExecutionWholeArrayConst<T, StorageTag>
{
using Superclass = ExecutionWholeArrayConst<T, StorageTag>;
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

@ -271,8 +271,8 @@ public:
{
for (vtkm::IdComponent iter = pointCount - 1; iter >= 0; iter--)
{
if (static_cast<vtkm::Float64>(prevVals[valPositionStart + iter]) <=
static_cast<vtkm::Float64>(newVals[valPositionStart + iter]))
if (static_cast<vtkm::Float64>(prevVals.Get(valPositionStart + iter)) <=
static_cast<vtkm::Float64>(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<vtkm::Float64>(curScalars[valPositionStart + edge[0]] -
newScalars[valPositionStart + edge[0]])) /
static_cast<vtkm::Float64>(
curScalars[valPositionStart + edge[1]] - curScalars[valPositionStart + edge[0]] +
newScalars[valPositionStart + edge[0]] - newScalars[valPositionStart + edge[1]]));
((static_cast<vtkm::Float64>(curScalars.Get(valPositionStart + edge[0]) -
newScalars.Get(valPositionStart + edge[0]))) /
static_cast<vtkm::Float64>(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<vtkm::Float64>(curScalars[valPositionStart + edge[0]] -
newScalars[valPositionStart + edge[0]])) /
static_cast<vtkm::Float64>(
curScalars[valPositionStart + edge[1]] - curScalars[valPositionStart + edge[0]] +
newScalars[valPositionStart + edge[0]] - newScalars[valPositionStart + edge[1]]));
((static_cast<vtkm::Float64>(curScalars.Get(valPositionStart + edge[0]) -
newScalars.Get(valPositionStart + edge[0]))) /
static_cast<vtkm::Float64>(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++);

@ -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<vtkm::FloatDefault>(isovalues[i] - fieldValue0) /
vtkm::FloatDefault interpolant =
static_cast<vtkm::FloatDefault>(isovalues.Get(i) - fieldValue0) /
static_cast<vtkm::FloatDefault>(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<decltype(pointPortal)> points(pointPortal, boundary);
vtkm::exec::FieldNeighborhood<decltype(fieldPortal)> field(fieldPortal, boundary);
vtkm::exec::FieldNeighborhood<WholeCoordinatesIn> points(pointCoordinates, boundary);
vtkm::exec::FieldNeighborhood<WholeFieldIn> 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<decltype(pointPortal)> points(pointPortal, boundary);
vtkm::exec::FieldNeighborhood<decltype(fieldPortal)> field(fieldPortal, boundary);
vtkm::exec::FieldNeighborhood<WholeCoordinatesIn> points(pointCoordinates, boundary);
vtkm::exec::FieldNeighborhood<WholeFieldIn> field(inputField, boundary);
vtkm::worklet::gradient::StructuredPointGradient gradient;
NormalType grad1;

@ -109,15 +109,14 @@ public:
}
// Compute points inside cell bounds
auto portal = points.GetPortal();
auto minp =
static_cast<vtkm::Id3>(vtkm::Ceil((cbmin - portal.GetOrigin()) / portal.GetSpacing()));
static_cast<vtkm::Id3>(vtkm::Ceil((cbmin - points.GetOrigin()) / points.GetSpacing()));
auto maxp =
static_cast<vtkm::Id3>(vtkm::Floor((cbmax - portal.GetOrigin()) / portal.GetSpacing()));
static_cast<vtkm::Id3>(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);
}

@ -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;

@ -53,7 +53,6 @@
#ifndef vtk_m_worklet_contourtree_augmented_pointer_doubling_h
#define vtk_m_worklet_contourtree_augmented_pointer_doubling_h
#include <vtkm/exec/ExecutionWholeArray.h>
#include <vtkm/filter/scalar_topology/worklet/contourtree_augmented/Types.h>
#include <vtkm/worklet/WorkletMapField.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 <typename ThreadIndicesType, typename WholeFieldIn>
VTKM_EXEC auto GetValues(const ThreadIndicesType& indices, const WholeFieldIn& in) const
-> decltype(std::declval<vtkm::exec::arg::Fetch<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
typename WholeFieldIn::PortalType>>()
.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<vtkm::exec::arg::FetchTagArrayTopologyMapIn,
vtkm::exec::arg::AspectTagDefault,
ExecObjectType>;
WholeFieldIn>;
Fetch fetch;
return fetch.Load(indices, in.GetPortal());
return fetch.Load(indices, in);
}
};
}

@ -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);

@ -281,7 +281,7 @@ public:
choice = 1;
using Split = SplitProperties;
vtkm::FloatDefault minCost = vtkm::Infinity<vtkm::FloatDefault>();
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;
}