Support coordinates of both float32 and float64

Previously there were issues if the coordinate system was using floating
point values that were not FloatDefault. This remedies that issue.
This commit is contained in:
Kenneth Moreland 2020-07-09 12:56:23 -06:00
parent 453e314044
commit f6b13df513
20 changed files with 209 additions and 88 deletions

@ -42,7 +42,7 @@ vtkm::cont::DataSet make_test3DImageData(vtkm::Id3 dims)
vtkm::cont::ArrayHandle<vtkm::Vec3f> field;
vtkm::cont::Invoker invoke;
invoke(WaveField{}, ds.GetCoordinateSystem(), field);
invoke(WaveField{}, ds.GetCoordinateSystem().GetDataAsMultiplexer(), field);
ds.AddPointField("vec_field", field);
return ds;

@ -33,9 +33,9 @@ namespace detail
// supported. Once the behavior is removed (probably when
// ArrayHandleVirtualCoordinates is removed), then this class should be removed.
class VTKM_ALWAYS_EXPORT CoordDataDepWrapper
: public vtkm::cont::VariantArrayHandleBase<vtkm::List<vtkm::Vec3f>>
: public vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3>
{
using Superclass = vtkm::cont::VariantArrayHandleBase<vtkm::List<vtkm::Vec3f>>;
using Superclass = vtkm::cont::VariantArrayHandleBase<vtkm::TypeListFieldVec3>;
VTKM_DEPRECATED_SUPPRESS_BEGIN
VTKM_CONT_EXPORT VTKM_CONT vtkm::cont::ArrayHandleVirtualCoordinates ToArray() const;
@ -149,7 +149,14 @@ public:
VTKM_CONT detail::CoordDataDepWrapper GetData() const;
private:
struct StorageToArray
#ifdef VTKM_USE_DOUBLE_PRECISION
using FloatNonDefault = vtkm::Float32;
#else
using FloatNonDefault = vtkm::Float64;
#endif
using Vec3f_nd = vtkm::Vec<FloatNonDefault, 3>;
struct StorageToArrayDefault
{
template <typename S>
using IsInvalid = vtkm::cont::internal::IsInvalidArrayHandle<vtkm::Vec3f, S>;
@ -158,12 +165,27 @@ private:
using Transform = vtkm::cont::ArrayHandle<vtkm::Vec3f, S>;
};
struct StorageToArrayNonDefault
{
template <typename S>
using IsInvalid = vtkm::cont::internal::IsInvalidArrayHandle<Vec3f_nd, S>;
template <typename S>
using Transform =
vtkm::cont::ArrayHandleCast<vtkm::Vec3f, vtkm::cont::ArrayHandle<Vec3f_nd, S>>;
};
using ArraysFloatDefault = vtkm::ListTransform<
vtkm::ListRemoveIf<VTKM_DEFAULT_STORAGE_LIST, StorageToArrayDefault::IsInvalid>,
StorageToArrayDefault::Transform>;
using ArraysFloatNonDefault = vtkm::ListTransform<
vtkm::ListRemoveIf<VTKM_DEFAULT_STORAGE_LIST, StorageToArrayNonDefault::IsInvalid>,
StorageToArrayNonDefault::Transform>;
public:
using MultiplexerArrayType = //
vtkm::cont::ArrayHandleMultiplexerFromList< //
vtkm::ListTransform< //
vtkm::ListRemoveIf<VTKM_DEFAULT_STORAGE_LIST, StorageToArray::IsInvalid>, //
StorageToArray::Transform>>;
using MultiplexerArrayType = //
vtkm::cont::ArrayHandleMultiplexerFromList<
vtkm::ListAppend<ArraysFloatDefault, ArraysFloatNonDefault>>;
/// \brief Returns the data for the coordinate system as an `ArrayHandleMultiplexer`.
///

@ -90,6 +90,21 @@ static void ComputeChunkSize(const vtkm::Id numVals,
valuesPerChunk = CeilDivide(pagesPerChunk * VTKM_PAGE_SIZE, bytesPerValue);
}
template <typename T>
struct CleanArrayRefImpl
{
using type = T;
};
template <typename PortalType>
struct CleanArrayRefImpl<vtkm::internal::ArrayPortalValueReference<PortalType>>
{
using type = typename PortalType::ValueType;
};
template <typename T>
using CleanArrayRef = typename CleanArrayRefImpl<T>::type;
template <typename T, typename U>
static void DoCopy(T src, U dst, vtkm::Id numVals, std::true_type)
{
@ -103,19 +118,24 @@ static void DoCopy(T src, U dst, vtkm::Id numVals, std::true_type)
template <typename InIterT, typename OutIterT>
static void DoCopy(InIterT inIter, OutIterT outIter, vtkm::Id numVals, std::false_type)
{
using ValueType = typename std::iterator_traits<OutIterT>::value_type;
using InValueType = CleanArrayRef<typename std::iterator_traits<InIterT>::value_type>;
using OutValueType = CleanArrayRef<typename std::iterator_traits<OutIterT>::value_type>;
for (vtkm::Id i = 0; i < numVals; ++i)
{
*(outIter++) = static_cast<ValueType>(*(inIter++));
// The conversion to InputType and then OutputType looks weird, but it is necessary.
// *inItr actually returns an ArrayPortalValueReference, which can automatically convert
// itself to InputType but not necessarily OutputType. Thus, we first convert to
// InputType, and then allow the conversion to OutputType.
*(outIter++) = static_cast<OutValueType>(static_cast<InValueType>(*(inIter++)));
}
}
template <typename InIterT, typename OutIterT>
static void DoCopy(InIterT inIter, OutIterT outIter, vtkm::Id numVals)
{
using InValueType = typename std::iterator_traits<InIterT>::value_type;
using OutValueType = typename std::iterator_traits<OutIterT>::value_type;
using InValueType = CleanArrayRef<typename std::iterator_traits<InIterT>::value_type>;
using OutValueType = CleanArrayRef<typename std::iterator_traits<OutIterT>::value_type>;
DoCopy(inIter, outIter, numVals, std::is_same<InValueType, OutValueType>());
}

@ -46,22 +46,32 @@ private:
// template calls std::copy if and only if the types match, otherwise falls
// back to a iterative casting approach. Since std::copy can only really
// optimize same-type copies, this shouldn't affect performance.
template <typename InIter, typename OutIter>
static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::false_type)
template <typename InPortal, typename OutPortal>
static void DoCopy(InPortal src,
OutPortal dst,
std::false_type,
vtkm::Id startIndex,
vtkm::Id numToCopy,
vtkm::Id outIndex)
{
using OutputType = typename std::iterator_traits<OutIter>::value_type;
while (src != srcEnd)
using OutputType = typename OutPortal::ValueType;
for (vtkm::Id index = 0; index < numToCopy; ++index)
{
*dst = static_cast<OutputType>(*src);
++src;
++dst;
dst.Set(index + startIndex, static_cast<OutputType>(src.Get(index + outIndex)));
}
}
template <typename InIter, typename OutIter>
static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type)
template <typename InPortal, typename OutPortal>
static void DoCopy(InPortal src,
OutPortal dst,
std::true_type,
vtkm::Id startIndex,
vtkm::Id numToCopy,
vtkm::Id outIndex)
{
std::copy(src, srcEnd, dst);
std::copy(vtkm::cont::ArrayPortalToIteratorBegin(src) + startIndex,
vtkm::cont::ArrayPortalToIteratorBegin(src) + startIndex + numToCopy,
vtkm::cont::ArrayPortalToIteratorBegin(dst) + outIndex);
}
public:
@ -85,10 +95,7 @@ public:
using InputType = decltype(inputPortal.Get(0));
using OutputType = decltype(outputPortal.Get(0));
DoCopy(vtkm::cont::ArrayPortalToIteratorBegin(inputPortal),
vtkm::cont::ArrayPortalToIteratorEnd(inputPortal),
vtkm::cont::ArrayPortalToIteratorBegin(outputPortal),
std::is_same<InputType, OutputType>());
DoCopy(inputPortal, outputPortal, std::is_same<InputType, OutputType>{}, 0, inSize, 0);
}
template <typename T, typename U, class CIn, class CStencil, class COut>
@ -188,16 +195,16 @@ public:
vtkm::cont::Token token;
auto inputPortal = input.PrepareForInput(DeviceAdapterTagSerial(), token);
auto outputPortal = output.PrepareForInPlace(DeviceAdapterTagSerial(), token);
auto inIter = vtkm::cont::ArrayPortalToIteratorBegin(inputPortal);
auto outIter = vtkm::cont::ArrayPortalToIteratorBegin(outputPortal);
using InputType = decltype(inputPortal.Get(0));
using OutputType = decltype(outputPortal.Get(0));
DoCopy(inIter + inputStartIndex,
inIter + inputStartIndex + numberOfElementsToCopy,
outIter + outputIndex,
std::is_same<InputType, OutputType>());
DoCopy(inputPortal,
outputPortal,
std::is_same<InputType, OutputType>(),
inputStartIndex,
numberOfElementsToCopy,
outputIndex);
return true;
}

@ -107,10 +107,15 @@ struct CopyBody
template <typename InIter, typename OutIter>
void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::false_type) const
{
using OutputType = typename std::iterator_traits<OutIter>::value_type;
using InputType = typename InputPortalType::ValueType;
using OutputType = typename OutputPortalType::ValueType;
while (src != srcEnd)
{
*dst = static_cast<OutputType>(*src);
// The conversion to InputType and then OutputType looks weird, but it is necessary.
// *src actually returns an ArrayPortalValueReference, which can automatically convert
// itself to InputType but not necessarily OutputType. Thus, we first convert to
// InputType, and then allow the conversion to OutputType.
*dst = static_cast<OutputType>(static_cast<InputType>(*src));
++src;
++dst;
}

@ -154,7 +154,8 @@ void GenerateRandomInput(const vtkm::cont::DataSet& ds,
vtkm::worklet::DispatcherMapTopology<ParametricToWorldCoordinates> dispatcher(
ParametricToWorldCoordinates::MakeScatter(cellIds));
dispatcher.Invoke(ds.GetCellSet(), ds.GetCoordinateSystem().GetData(), pcoords, wcoords);
dispatcher.Invoke(
ds.GetCellSet(), ds.GetCoordinateSystem().GetDataAsMultiplexer(), pcoords, wcoords);
}
class FindCellWorklet : public vtkm::worklet::WorkletMapField

@ -69,7 +69,7 @@ void EvaluateOnCoordinates(vtkm::cont::CoordinateSystem points,
EvaluateImplicitFunction eval(function.PrepareForExecution(device, token));
EvalDispatcher dispatcher(eval);
dispatcher.SetDevice(DeviceAdapter());
dispatcher.Invoke(points, values, gradients);
dispatcher.Invoke(points.GetDataAsMultiplexer(), values, gradients);
}
template <typename ItemType, std::size_t N>

@ -140,7 +140,8 @@ void GenerateRandomInput(const vtkm::cont::DataSet& ds,
vtkm::worklet::DispatcherMapTopology<ParametricToWorldCoordinates> dispatcher(
ParametricToWorldCoordinates::MakeScatter(cellIds));
dispatcher.Invoke(ds.GetCellSet(), ds.GetCoordinateSystem().GetData(), pcoords, wcoords);
dispatcher.Invoke(
ds.GetCellSet(), ds.GetCoordinateSystem().GetDataAsMultiplexer(), pcoords, wcoords);
}
//-----------------------------------------------------------------------------

@ -35,7 +35,7 @@ public:
VTKM_CONT
CellMeasures();
/// Set/Get the name of the cell measure field. If empty, "measure" is used.
/// Set/Get the name of the cell measure field. If not set, "measure" is used.
void SetCellMeasureName(const std::string& name) { this->SetOutputFieldName(name); }
const std::string& GetCellMeasureName() const { return this->GetOutputFieldName(); }

@ -25,6 +25,7 @@ inline VTKM_CONT CellMeasures<IntegrationType>::CellMeasures()
: vtkm::filter::FilterCell<CellMeasures<IntegrationType>>()
{
this->SetUseCoordinateSystemAsField(true);
this->SetCellMeasureName("measure");
}
//-----------------------------------------------------------------------------

@ -18,6 +18,25 @@
namespace
{
struct CheckCellMeasuresFunctor
{
template <typename ArrayType>
void operator()(const ArrayType& resultArrayHandle,
const std::vector<vtkm::Float32>& expected) const
{
VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() ==
static_cast<vtkm::Id>(expected.size()),
"Wrong number of entries in the output dataset");
auto portal = resultArrayHandle.ReadPortal();
for (std::size_t i = 0; i < expected.size(); ++i)
{
VTKM_TEST_ASSERT(test_equal(portal.Get(static_cast<vtkm::Id>(i)), expected[i]),
"Wrong result for CellMeasure filter");
}
}
};
template <typename IntegrationType>
void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset,
const char* msg,
@ -29,28 +48,19 @@ void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset,
vtkm::filter::CellMeasures<IntegrationType> vols;
vtkm::cont::DataSet outputData = vols.Execute(dataset);
VTKM_TEST_ASSERT(vols.GetCellMeasureName().empty(), "Default output field name should be empty.");
VTKM_TEST_ASSERT(vols.GetCellMeasureName() == "measure");
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfCells() == static_cast<vtkm::Id>(expected.size()),
"Wrong number of cells in the output dataset");
// Check that the empty measure name above produced a field with the expected name.
vols.SetCellMeasureName("measure");
auto temp = outputData.GetField(vols.GetCellMeasureName()).GetData();
VTKM_TEST_ASSERT(temp.GetNumberOfValues() == static_cast<vtkm::Id>(expected.size()),
auto result = outputData.GetField(vols.GetCellMeasureName()).GetData();
VTKM_TEST_ASSERT(result.GetNumberOfValues() == static_cast<vtkm::Id>(expected.size()),
"Output field could not be found or was improper.");
vtkm::cont::ArrayHandle<vtkm::FloatDefault> resultArrayHandle;
temp.CopyTo(resultArrayHandle);
VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() == static_cast<vtkm::Id>(expected.size()),
"Wrong number of entries in the output dataset");
for (unsigned int i = 0; i < static_cast<unsigned int>(expected.size()); ++i)
{
VTKM_TEST_ASSERT(test_equal(resultArrayHandle.ReadPortal().Get(vtkm::Id(i)), expected[i]),
"Wrong result for CellMeasure filter");
}
vtkm::cont::CastAndCall(
result.ResetTypes(vtkm::TypeListFieldScalar{}), CheckCellMeasuresFunctor{}, expected);
}
void TestCellMeasures()

@ -122,7 +122,7 @@ bool TestMeshQualityFilter(const vtkm::cont::DataSet& input,
//Test the computed metric values (for all cells) and expected metric
//values for equality.
vtkm::cont::ArrayHandle<vtkm::FloatDefault> values;
vtkm::cont::ArrayHandle<vtkm::Float64> values;
output.GetField(outputname).GetData().CopyTo(values);
auto portal1 = values.ReadPortal();
if (portal1.GetNumberOfValues() != (vtkm::Id)expectedVals.size())

@ -159,9 +159,11 @@ void WritePoints(std::ostream& out, const vtkm::cont::DataSet& dataSet)
int cindex = 0;
auto cdata = dataSet.GetCoordinateSystem(cindex).GetData();
std::string typeName;
vtkm::cont::CastAndCall(cdata, GetDataTypeName(typeName));
vtkm::Id npoints = cdata.GetNumberOfValues();
out << "POINTS " << npoints << " " << vtkm::io::internal::DataTypeName<vtkm::FloatDefault>::Name()
<< " " << '\n';
out << "POINTS " << npoints << " " << typeName << " " << '\n';
cdata.CastAndCall(OutputPointsFunctor{ out });
}

@ -64,16 +64,19 @@ struct CheckSameCoordinateSystem
VTKM_TEST_ASSERT(test_equal(originalPortal.GetRange3(), filePortal.GetRange3()));
}
using ArrayHandleRectilinearCoords =
vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
vtkm::cont::ArrayHandle<vtkm::FloatDefault>,
vtkm::cont::ArrayHandle<vtkm::FloatDefault>>;
void operator()(const ArrayHandleRectilinearCoords& originalArray,
template <typename T>
using ArrayHandleRectilinearCoords = vtkm::cont::ArrayHandle<
T,
typename vtkm::cont::ArrayHandleCartesianProduct<vtkm::cont::ArrayHandle<T>,
vtkm::cont::ArrayHandle<T>,
vtkm::cont::ArrayHandle<T>>::StorageTag>;
template <typename T>
void operator()(const ArrayHandleRectilinearCoords<T>& originalArray,
const vtkm::cont::CoordinateSystem& fileCoords) const
{
VTKM_TEST_ASSERT(fileCoords.GetData().IsType<ArrayHandleRectilinearCoords>());
ArrayHandleRectilinearCoords fileArray =
fileCoords.GetData().Cast<ArrayHandleRectilinearCoords>();
VTKM_TEST_ASSERT(fileCoords.GetData().IsType<ArrayHandleRectilinearCoords<T>>());
ArrayHandleRectilinearCoords<T> fileArray =
fileCoords.GetData().Cast<ArrayHandleRectilinearCoords<T>>();
auto originalPortal = originalArray.ReadPortal();
auto filePortal = fileArray.ReadPortal();
VTKM_TEST_ASSERT(

@ -41,10 +41,11 @@ struct DeduceCoordType
}
template <typename... Args>
void operator()(const vtkm::cont::ArrayHandleUniformPointCoordinates& coords,
const vtkm::cont::CellSetStructured<3>& cells,
vtkm::cont::CellSetSingleType<>& result,
Args&&... args) const
void operator()(
const vtkm::cont::ArrayHandle<vtkm::Vec3f, vtkm::cont::StorageTagUniformPoints>& coords,
const vtkm::cont::CellSetStructured<3>& cells,
vtkm::cont::CellSetSingleType<>& result,
Args&&... args) const
{
result = flying_edges::execute(cells, coords, std::forward<Args>(args)...);
}

@ -454,22 +454,46 @@ public:
inCellSet, this->PointInputToOutputMap, this->MergeKeys.GetInputRange());
}
private:
struct MapPointFieldFunctor
{
template <typename T, typename S>
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<T, S>& inArray,
vtkm::cont::VariantArrayHandleCommon& outHolder,
const PointMerge& self) const
{
vtkm::cont::ArrayHandle<T> outArray;
self.MapPointField(inArray, outArray);
outHolder = vtkm::cont::VariantArrayHandleCommon(outArray);
}
};
public:
template <typename InArrayHandle, typename OutArrayHandle>
VTKM_CONT void MapPointField(const InArrayHandle& inArray, OutArrayHandle& outArray) const
{
vtkm::worklet::AverageByKey::Run(this->MergeKeys, inArray, outArray);
}
template <typename InArrayHandle>
VTKM_CONT vtkm::cont::ArrayHandle<typename InArrayHandle::ValueType> MapPointField(
const InArrayHandle& inArray) const
template <typename T, typename S>
VTKM_CONT vtkm::cont::ArrayHandle<T> MapPointField(
const vtkm::cont::ArrayHandle<T, S>& inArray) const
{
vtkm::cont::ArrayHandle<typename InArrayHandle::ValueType> outArray;
vtkm::cont::ArrayHandle<T> outArray;
this->MapPointField(inArray, outArray);
return outArray;
}
template <typename InTypes>
VTKM_CONT vtkm::cont::VariantArrayHandleBase<InTypes> MapPointField(
const vtkm::cont::VariantArrayHandleBase<InTypes>& inArray) const
{
vtkm::cont::VariantArrayHandleBase<InTypes> outArray;
vtkm::cont::CastAndCall(inArray, MapPointFieldFunctor{}, outArray, *this);
return outArray;
}
vtkm::worklet::Keys<vtkm::Id> GetMergeKeys() const { return this->MergeKeys; }
private:

@ -204,13 +204,23 @@ public:
private:
struct MapPointFieldDeepFunctor
{
template <typename InArrayHandle, typename OutArrayHandle>
VTKM_CONT void operator()(const InArrayHandle& inArray,
OutArrayHandle& outArray,
template <typename InT, typename InS, typename OutT, typename OutS>
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<InT, InS>& inArray,
vtkm::cont::ArrayHandle<OutT, OutS>& outArray,
const RemoveUnusedPoints& self) const
{
self.MapPointFieldDeep(inArray, outArray);
}
template <typename InT, typename InS>
VTKM_CONT void operator()(const vtkm::cont::ArrayHandle<InT, InS>& inArray,
vtkm::cont::VariantArrayHandleCommon& outHolder,
const RemoveUnusedPoints& self) const
{
vtkm::cont::ArrayHandle<InT> outArray;
(*this)(inArray, outArray, self);
outHolder = vtkm::cont::VariantArrayHandleCommon{ outArray };
}
};
public:
@ -231,6 +241,16 @@ public:
vtkm::cont::ArrayCopy(this->MapPointFieldShallow(inArray), outArray);
}
template <typename T, typename S>
VTKM_CONT vtkm::cont::ArrayHandle<T> MapPointFieldDeep(
const vtkm::cont::ArrayHandle<T, S>& inArray) const
{
vtkm::cont::ArrayHandle<T> outArray;
this->MapPointFieldDeep(inArray, outArray);
return outArray;
}
template <typename InArrayTypes, typename OutArrayHandle>
VTKM_CONT void MapPointFieldDeep(const vtkm::cont::VariantArrayHandleBase<InArrayTypes>& inArray,
OutArrayHandle& outArray) const
@ -238,12 +258,12 @@ public:
vtkm::cont::CastAndCall(inArray, MapPointFieldDeepFunctor{}, outArray, *this);
}
template <typename InArrayHandle>
VTKM_CONT vtkm::cont::ArrayHandle<typename InArrayHandle::ValueType> MapPointFieldDeep(
const InArrayHandle& inArray) const
template <typename InTypes>
VTKM_CONT vtkm::cont::VariantArrayHandleBase<InTypes> MapPointFieldDeep(
const vtkm::cont::VariantArrayHandleBase<InTypes>& inArray) const
{
vtkm::cont::ArrayHandle<typename InArrayHandle::ValueType> outArray;
this->MapPointFieldDeep(inArray, outArray);
vtkm::cont::VariantArrayHandleBase<InTypes> outArray;
vtkm::cont::CastAndCall(inArray, MapPointFieldDeepFunctor{}, outArray, *this);
return outArray;
}

@ -27,7 +27,8 @@ void TestCellMeasureUniform3D()
vtkm::cont::ArrayHandle<vtkm::FloatDefault> result;
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellMeasure<vtkm::Volume>> dispatcher;
dispatcher.Invoke(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), result);
dispatcher.Invoke(
dataSet.GetCellSet(), dataSet.GetCoordinateSystem().GetDataAsMultiplexer(), result);
vtkm::Float32 expected[4] = { 1.f, 1.f, 1.f, 1.f };
for (int i = 0; i < 4; ++i)
@ -48,7 +49,8 @@ void TestCellMeasureWorklet(vtkm::cont::DataSet& dataset,
vtkm::cont::ArrayHandle<vtkm::FloatDefault> result;
vtkm::worklet::DispatcherMapTopology<vtkm::worklet::CellMeasure<IntegrationType>> dispatcher;
dispatcher.Invoke(dataset.GetCellSet(), dataset.GetCoordinateSystem(), result);
dispatcher.Invoke(
dataset.GetCellSet(), dataset.GetCoordinateSystem().GetDataAsMultiplexer(), result);
VTKM_TEST_ASSERT(result.GetNumberOfValues() == static_cast<vtkm::Id>(expected.size()),
"Wrong number of values in the output array");

@ -85,8 +85,7 @@ struct ValidateNormals
using NormalType = vtkm::Vec<vtkm::FloatDefault, 3>;
using NormalsArrayType = vtkm::cont::ArrayHandleVirtual<NormalType>;
using NormalsPortalType = decltype(std::declval<NormalsArrayType>().ReadPortal());
using PointsType =
decltype(std::declval<vtkm::cont::CoordinateSystem>().GetDataAsMultiplexer().ReadPortal());
using PointsType = decltype(std::declval<vtkm::cont::CoordinateSystem>().GetDataAsMultiplexer());
vtkm::cont::CoordinateSystem Coords;
CellSetType Cells;
@ -140,7 +139,7 @@ struct ValidateNormals
const vtkm::cont::Field& cellNormalsField)
: Coords{ dataset.GetCoordinateSystem() }
, Cells{ dataset.GetCellSet().Cast<CellSetType>() }
, Points{ this->Coords.GetDataAsMultiplexer().ReadPortal() }
, Points{ this->Coords.GetDataAsMultiplexer() }
, CheckPoints(checkPoints)
, CheckCells(checkCells)
{
@ -171,7 +170,8 @@ struct ValidateNormals
// Locate a point with the minimum x coordinate:
const vtkm::Id startPoint = [&]() -> vtkm::Id {
const vtkm::Float64 xMin = this->Coords.GetBounds().X.Min;
const auto points = this->Coords.GetDataAsMultiplexer().ReadPortal();
const auto pointArray = this->Coords.GetDataAsMultiplexer();
const auto points = pointArray.ReadPortal();
const vtkm::Id numPoints = points.GetNumberOfValues();
vtkm::Id resultIdx = -1;
for (vtkm::Id pointIdx = 0; pointIdx < numPoints; ++pointIdx)
@ -241,6 +241,7 @@ private:
vtkm::TopologyElementTagCell{},
token);
auto points = this->Points.ReadPortal();
while (!queue.empty())
{
const vtkm::Id curPtIdx = queue.back().first;
@ -252,7 +253,7 @@ private:
const NormalType curNormal = this->PointNormals.Get(curPtIdx);
if (!this->SameHemisphere(curNormal, refNormal))
{
const auto coord = this->Points.Get(curPtIdx);
const auto coord = points.Get(curPtIdx);
std::cerr << "BadPointNormal PtId: " << curPtIdx << "\n\t"
<< "- Normal: {" << curNormal[0] << ", " << curNormal[1] << ", " << curNormal[2]
<< "}\n\t"

@ -70,7 +70,8 @@ void TestWarpScalar()
scaleFactor.CopyTo(scaleFactorArray);
vtkm::worklet::WarpScalar warpWorklet;
warpWorklet.Run(ds.GetCoordinateSystem(), normalAH, scaleFactor, scaleAmount, result);
warpWorklet.Run(
ds.GetCoordinateSystem().GetDataAsMultiplexer(), normalAH, scaleFactor, scaleAmount, result);
auto sFAPortal = scaleFactorArray.ReadPortal();
auto resultPortal = result.ReadPortal();