diff --git a/examples/multi_backend/IOGenerator.cxx b/examples/multi_backend/IOGenerator.cxx index 86e92496d..f14f345c5 100644 --- a/examples/multi_backend/IOGenerator.cxx +++ b/examples/multi_backend/IOGenerator.cxx @@ -42,7 +42,7 @@ vtkm::cont::DataSet make_test3DImageData(vtkm::Id3 dims) vtkm::cont::ArrayHandle field; vtkm::cont::Invoker invoke; - invoke(WaveField{}, ds.GetCoordinateSystem(), field); + invoke(WaveField{}, ds.GetCoordinateSystem().GetDataAsMultiplexer(), field); ds.AddPointField("vec_field", field); return ds; diff --git a/vtkm/cont/CoordinateSystem.h b/vtkm/cont/CoordinateSystem.h index 44817d826..7ad9c5e21 100644 --- a/vtkm/cont/CoordinateSystem.h +++ b/vtkm/cont/CoordinateSystem.h @@ -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> + : public vtkm::cont::VariantArrayHandleBase { - using Superclass = vtkm::cont::VariantArrayHandleBase>; + using Superclass = vtkm::cont::VariantArrayHandleBase; 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; + + struct StorageToArrayDefault { template using IsInvalid = vtkm::cont::internal::IsInvalidArrayHandle; @@ -158,12 +165,27 @@ private: using Transform = vtkm::cont::ArrayHandle; }; + struct StorageToArrayNonDefault + { + template + using IsInvalid = vtkm::cont::internal::IsInvalidArrayHandle; + + template + using Transform = + vtkm::cont::ArrayHandleCast>; + }; + + using ArraysFloatDefault = vtkm::ListTransform< + vtkm::ListRemoveIf, + StorageToArrayDefault::Transform>; + using ArraysFloatNonDefault = vtkm::ListTransform< + vtkm::ListRemoveIf, + StorageToArrayNonDefault::Transform>; + public: - using MultiplexerArrayType = // - vtkm::cont::ArrayHandleMultiplexerFromList< // - vtkm::ListTransform< // - vtkm::ListRemoveIf, // - StorageToArray::Transform>>; + using MultiplexerArrayType = // + vtkm::cont::ArrayHandleMultiplexerFromList< + vtkm::ListAppend>; /// \brief Returns the data for the coordinate system as an `ArrayHandleMultiplexer`. /// diff --git a/vtkm/cont/openmp/internal/FunctorsOpenMP.h b/vtkm/cont/openmp/internal/FunctorsOpenMP.h index 6a86e2969..9417ea89b 100644 --- a/vtkm/cont/openmp/internal/FunctorsOpenMP.h +++ b/vtkm/cont/openmp/internal/FunctorsOpenMP.h @@ -90,6 +90,21 @@ static void ComputeChunkSize(const vtkm::Id numVals, valuesPerChunk = CeilDivide(pagesPerChunk * VTKM_PAGE_SIZE, bytesPerValue); } +template +struct CleanArrayRefImpl +{ + using type = T; +}; + +template +struct CleanArrayRefImpl> +{ + using type = typename PortalType::ValueType; +}; + +template +using CleanArrayRef = typename CleanArrayRefImpl::type; + template 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 static void DoCopy(InIterT inIter, OutIterT outIter, vtkm::Id numVals, std::false_type) { - using ValueType = typename std::iterator_traits::value_type; + using InValueType = CleanArrayRef::value_type>; + using OutValueType = CleanArrayRef::value_type>; for (vtkm::Id i = 0; i < numVals; ++i) { - *(outIter++) = static_cast(*(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(static_cast(*(inIter++))); } } template static void DoCopy(InIterT inIter, OutIterT outIter, vtkm::Id numVals) { - using InValueType = typename std::iterator_traits::value_type; - using OutValueType = typename std::iterator_traits::value_type; + using InValueType = CleanArrayRef::value_type>; + using OutValueType = CleanArrayRef::value_type>; DoCopy(inIter, outIter, numVals, std::is_same()); } diff --git a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h index 7d3148549..8f12f4d11 100644 --- a/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h +++ b/vtkm/cont/serial/internal/DeviceAdapterAlgorithmSerial.h @@ -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 - static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::false_type) + template + 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::value_type; - while (src != srcEnd) + using OutputType = typename OutPortal::ValueType; + for (vtkm::Id index = 0; index < numToCopy; ++index) { - *dst = static_cast(*src); - ++src; - ++dst; + dst.Set(index + startIndex, static_cast(src.Get(index + outIndex))); } } - template - static void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::true_type) + template + 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()); + DoCopy(inputPortal, outputPortal, std::is_same{}, 0, inSize, 0); } template @@ -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()); + DoCopy(inputPortal, + outputPortal, + std::is_same(), + inputStartIndex, + numberOfElementsToCopy, + outputIndex); return true; } diff --git a/vtkm/cont/tbb/internal/FunctorsTBB.h b/vtkm/cont/tbb/internal/FunctorsTBB.h index 46f605181..f1bdf2b69 100644 --- a/vtkm/cont/tbb/internal/FunctorsTBB.h +++ b/vtkm/cont/tbb/internal/FunctorsTBB.h @@ -107,10 +107,15 @@ struct CopyBody template void DoCopy(InIter src, InIter srcEnd, OutIter dst, std::false_type) const { - using OutputType = typename std::iterator_traits::value_type; + using InputType = typename InputPortalType::ValueType; + using OutputType = typename OutputPortalType::ValueType; while (src != srcEnd) { - *dst = static_cast(*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(static_cast(*src)); ++src; ++dst; } diff --git a/vtkm/cont/testing/TestingCellLocatorUniformBins.h b/vtkm/cont/testing/TestingCellLocatorUniformBins.h index b5c6cf261..8ea423f1e 100644 --- a/vtkm/cont/testing/TestingCellLocatorUniformBins.h +++ b/vtkm/cont/testing/TestingCellLocatorUniformBins.h @@ -154,7 +154,8 @@ void GenerateRandomInput(const vtkm::cont::DataSet& ds, vtkm::worklet::DispatcherMapTopology 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 diff --git a/vtkm/cont/testing/TestingImplicitFunction.h b/vtkm/cont/testing/TestingImplicitFunction.h index e1aef5ae1..f3e804fda 100644 --- a/vtkm/cont/testing/TestingImplicitFunction.h +++ b/vtkm/cont/testing/TestingImplicitFunction.h @@ -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 diff --git a/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx b/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx index 47ed2e5a2..1f283c933 100644 --- a/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx +++ b/vtkm/cont/testing/UnitTestCellLocatorGeneral.cxx @@ -140,7 +140,8 @@ void GenerateRandomInput(const vtkm::cont::DataSet& ds, vtkm::worklet::DispatcherMapTopology dispatcher( ParametricToWorldCoordinates::MakeScatter(cellIds)); - dispatcher.Invoke(ds.GetCellSet(), ds.GetCoordinateSystem().GetData(), pcoords, wcoords); + dispatcher.Invoke( + ds.GetCellSet(), ds.GetCoordinateSystem().GetDataAsMultiplexer(), pcoords, wcoords); } //----------------------------------------------------------------------------- diff --git a/vtkm/filter/CellMeasures.h b/vtkm/filter/CellMeasures.h index 0dd7a7e5f..8ca5017f4 100644 --- a/vtkm/filter/CellMeasures.h +++ b/vtkm/filter/CellMeasures.h @@ -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(); } diff --git a/vtkm/filter/CellMeasures.hxx b/vtkm/filter/CellMeasures.hxx index 8812ead91..248432246 100644 --- a/vtkm/filter/CellMeasures.hxx +++ b/vtkm/filter/CellMeasures.hxx @@ -25,6 +25,7 @@ inline VTKM_CONT CellMeasures::CellMeasures() : vtkm::filter::FilterCell>() { this->SetUseCoordinateSystemAsField(true); + this->SetCellMeasureName("measure"); } //----------------------------------------------------------------------------- diff --git a/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx b/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx index f56a450ae..f0a0cc8e1 100644 --- a/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx +++ b/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx @@ -18,6 +18,25 @@ namespace { +struct CheckCellMeasuresFunctor +{ + template + void operator()(const ArrayType& resultArrayHandle, + const std::vector& expected) const + { + VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() == + static_cast(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(i)), expected[i]), + "Wrong result for CellMeasure filter"); + } + } +}; + template void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset, const char* msg, @@ -29,28 +48,19 @@ void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset, vtkm::filter::CellMeasures 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(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(expected.size()), + auto result = outputData.GetField(vols.GetCellMeasureName()).GetData(); + VTKM_TEST_ASSERT(result.GetNumberOfValues() == static_cast(expected.size()), "Output field could not be found or was improper."); - vtkm::cont::ArrayHandle resultArrayHandle; - temp.CopyTo(resultArrayHandle); - VTKM_TEST_ASSERT(resultArrayHandle.GetNumberOfValues() == static_cast(expected.size()), - "Wrong number of entries in the output dataset"); - - for (unsigned int i = 0; i < static_cast(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() diff --git a/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx b/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx index cbda5dfee..0dacdc00a 100644 --- a/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx +++ b/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx @@ -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 values; + vtkm::cont::ArrayHandle values; output.GetField(outputname).GetData().CopyTo(values); auto portal1 = values.ReadPortal(); if (portal1.GetNumberOfValues() != (vtkm::Id)expectedVals.size()) diff --git a/vtkm/io/VTKDataSetWriter.cxx b/vtkm/io/VTKDataSetWriter.cxx index 85c365da8..64bb79f73 100644 --- a/vtkm/io/VTKDataSetWriter.cxx +++ b/vtkm/io/VTKDataSetWriter.cxx @@ -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::Name() - << " " << '\n'; + out << "POINTS " << npoints << " " << typeName << " " << '\n'; cdata.CastAndCall(OutputPointsFunctor{ out }); } diff --git a/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx b/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx index 3c0e1a7b1..562b09e59 100644 --- a/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx +++ b/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx @@ -64,16 +64,19 @@ struct CheckSameCoordinateSystem VTKM_TEST_ASSERT(test_equal(originalPortal.GetRange3(), filePortal.GetRange3())); } - using ArrayHandleRectilinearCoords = - vtkm::cont::ArrayHandleCartesianProduct, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle>; - void operator()(const ArrayHandleRectilinearCoords& originalArray, + template + using ArrayHandleRectilinearCoords = vtkm::cont::ArrayHandle< + T, + typename vtkm::cont::ArrayHandleCartesianProduct, + vtkm::cont::ArrayHandle, + vtkm::cont::ArrayHandle>::StorageTag>; + template + void operator()(const ArrayHandleRectilinearCoords& originalArray, const vtkm::cont::CoordinateSystem& fileCoords) const { - VTKM_TEST_ASSERT(fileCoords.GetData().IsType()); - ArrayHandleRectilinearCoords fileArray = - fileCoords.GetData().Cast(); + VTKM_TEST_ASSERT(fileCoords.GetData().IsType>()); + ArrayHandleRectilinearCoords fileArray = + fileCoords.GetData().Cast>(); auto originalPortal = originalArray.ReadPortal(); auto filePortal = fileArray.ReadPortal(); VTKM_TEST_ASSERT( diff --git a/vtkm/worklet/Contour.h b/vtkm/worklet/Contour.h index c28c5ec09..d72f0f6cb 100644 --- a/vtkm/worklet/Contour.h +++ b/vtkm/worklet/Contour.h @@ -41,10 +41,11 @@ struct DeduceCoordType } template - 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& coords, + const vtkm::cont::CellSetStructured<3>& cells, + vtkm::cont::CellSetSingleType<>& result, + Args&&... args) const { result = flying_edges::execute(cells, coords, std::forward(args)...); } diff --git a/vtkm/worklet/PointMerge.h b/vtkm/worklet/PointMerge.h index cd582436f..ce897a203 100644 --- a/vtkm/worklet/PointMerge.h +++ b/vtkm/worklet/PointMerge.h @@ -454,22 +454,46 @@ public: inCellSet, this->PointInputToOutputMap, this->MergeKeys.GetInputRange()); } +private: + struct MapPointFieldFunctor + { + template + VTKM_CONT void operator()(const vtkm::cont::ArrayHandle& inArray, + vtkm::cont::VariantArrayHandleCommon& outHolder, + const PointMerge& self) const + { + vtkm::cont::ArrayHandle outArray; + self.MapPointField(inArray, outArray); + outHolder = vtkm::cont::VariantArrayHandleCommon(outArray); + } + }; + +public: template VTKM_CONT void MapPointField(const InArrayHandle& inArray, OutArrayHandle& outArray) const { vtkm::worklet::AverageByKey::Run(this->MergeKeys, inArray, outArray); } - template - VTKM_CONT vtkm::cont::ArrayHandle MapPointField( - const InArrayHandle& inArray) const + template + VTKM_CONT vtkm::cont::ArrayHandle MapPointField( + const vtkm::cont::ArrayHandle& inArray) const { - vtkm::cont::ArrayHandle outArray; + vtkm::cont::ArrayHandle outArray; this->MapPointField(inArray, outArray); return outArray; } + template + VTKM_CONT vtkm::cont::VariantArrayHandleBase MapPointField( + const vtkm::cont::VariantArrayHandleBase& inArray) const + { + vtkm::cont::VariantArrayHandleBase outArray; + vtkm::cont::CastAndCall(inArray, MapPointFieldFunctor{}, outArray, *this); + return outArray; + } + vtkm::worklet::Keys GetMergeKeys() const { return this->MergeKeys; } private: diff --git a/vtkm/worklet/RemoveUnusedPoints.h b/vtkm/worklet/RemoveUnusedPoints.h index adb671841..83c61599f 100644 --- a/vtkm/worklet/RemoveUnusedPoints.h +++ b/vtkm/worklet/RemoveUnusedPoints.h @@ -204,13 +204,23 @@ public: private: struct MapPointFieldDeepFunctor { - template - VTKM_CONT void operator()(const InArrayHandle& inArray, - OutArrayHandle& outArray, + template + VTKM_CONT void operator()(const vtkm::cont::ArrayHandle& inArray, + vtkm::cont::ArrayHandle& outArray, const RemoveUnusedPoints& self) const { self.MapPointFieldDeep(inArray, outArray); } + + template + VTKM_CONT void operator()(const vtkm::cont::ArrayHandle& inArray, + vtkm::cont::VariantArrayHandleCommon& outHolder, + const RemoveUnusedPoints& self) const + { + vtkm::cont::ArrayHandle outArray; + (*this)(inArray, outArray, self); + outHolder = vtkm::cont::VariantArrayHandleCommon{ outArray }; + } }; public: @@ -231,6 +241,16 @@ public: vtkm::cont::ArrayCopy(this->MapPointFieldShallow(inArray), outArray); } + template + VTKM_CONT vtkm::cont::ArrayHandle MapPointFieldDeep( + const vtkm::cont::ArrayHandle& inArray) const + { + vtkm::cont::ArrayHandle outArray; + this->MapPointFieldDeep(inArray, outArray); + + return outArray; + } + template VTKM_CONT void MapPointFieldDeep(const vtkm::cont::VariantArrayHandleBase& inArray, OutArrayHandle& outArray) const @@ -238,12 +258,12 @@ public: vtkm::cont::CastAndCall(inArray, MapPointFieldDeepFunctor{}, outArray, *this); } - template - VTKM_CONT vtkm::cont::ArrayHandle MapPointFieldDeep( - const InArrayHandle& inArray) const + template + VTKM_CONT vtkm::cont::VariantArrayHandleBase MapPointFieldDeep( + const vtkm::cont::VariantArrayHandleBase& inArray) const { - vtkm::cont::ArrayHandle outArray; - this->MapPointFieldDeep(inArray, outArray); + vtkm::cont::VariantArrayHandleBase outArray; + vtkm::cont::CastAndCall(inArray, MapPointFieldDeepFunctor{}, outArray, *this); return outArray; } diff --git a/vtkm/worklet/testing/UnitTestCellMeasure.cxx b/vtkm/worklet/testing/UnitTestCellMeasure.cxx index a03eaa0bc..a6561abc7 100644 --- a/vtkm/worklet/testing/UnitTestCellMeasure.cxx +++ b/vtkm/worklet/testing/UnitTestCellMeasure.cxx @@ -27,7 +27,8 @@ void TestCellMeasureUniform3D() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology> 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 result; vtkm::worklet::DispatcherMapTopology> dispatcher; - dispatcher.Invoke(dataset.GetCellSet(), dataset.GetCoordinateSystem(), result); + dispatcher.Invoke( + dataset.GetCellSet(), dataset.GetCoordinateSystem().GetDataAsMultiplexer(), result); VTKM_TEST_ASSERT(result.GetNumberOfValues() == static_cast(expected.size()), "Wrong number of values in the output array"); diff --git a/vtkm/worklet/testing/UnitTestOrientNormals.cxx b/vtkm/worklet/testing/UnitTestOrientNormals.cxx index e8815f013..490753940 100644 --- a/vtkm/worklet/testing/UnitTestOrientNormals.cxx +++ b/vtkm/worklet/testing/UnitTestOrientNormals.cxx @@ -85,8 +85,7 @@ struct ValidateNormals using NormalType = vtkm::Vec; using NormalsArrayType = vtkm::cont::ArrayHandleVirtual; using NormalsPortalType = decltype(std::declval().ReadPortal()); - using PointsType = - decltype(std::declval().GetDataAsMultiplexer().ReadPortal()); + using PointsType = decltype(std::declval().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() } - , 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" diff --git a/vtkm/worklet/testing/UnitTestWarpScalar.cxx b/vtkm/worklet/testing/UnitTestWarpScalar.cxx index 032b04c42..e6f4260b2 100644 --- a/vtkm/worklet/testing/UnitTestWarpScalar.cxx +++ b/vtkm/worklet/testing/UnitTestWarpScalar.cxx @@ -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();