diff --git a/examples/clipping/Clipping.cxx b/examples/clipping/Clipping.cxx index 678c63a9f..7a47bf82f 100644 --- a/examples/clipping/Clipping.cxx +++ b/examples/clipping/Clipping.cxx @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) timer.Reset(); vtkm::cont::DynamicArrayHandle coords = - clip.ProcessField(input.GetCoordinateSystem(0).GetData()); + clip.ProcessField(input.GetCoordinateSystem(0)); vtkm::Float64 processCoordinatesTime = timer.GetElapsedTime(); output.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coordinates", coords)); diff --git a/examples/streamline/StreamLineUniformGrid.cxx b/examples/streamline/StreamLineUniformGrid.cxx index 02ac53721..c916950f4 100755 --- a/examples/streamline/StreamLineUniformGrid.cxx +++ b/examples/streamline/StreamLineUniformGrid.cxx @@ -148,7 +148,7 @@ void displayCall() vtkm::cont::CellSetExplicit<> cellSet; outDataSet.GetCellSet(0).CopyTo(cellSet); const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = - outDataSet.GetCoordinateSystem(0).GetData(); + outDataSet.GetCoordinateSystem().GetData(); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); vtkm::Id numberOfPoints = coordArray.GetNumberOfValues(); @@ -156,7 +156,7 @@ void displayCall() // Need the actual vertex points from a static cast of the dynamic array but can't get it right // So use cast and call on a functor that stores that dynamic array into static array we created vertexArray.Allocate(numberOfPoints); - coordArray.CastAndCall(GetVertexArray()); + vtkm::cont::CastAndCall(coordArray, GetVertexArray()); // Each cell is a polyline glColor3f(1.0f, 0.0f, 0.0f); diff --git a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx index cc1c25527..238d5da76 100644 --- a/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeExplicitGrid.cxx @@ -204,14 +204,10 @@ void displayCall() outDataSet.GetCellSet(0).CopyTo(cellSet); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); - // Get the coordinate system and coordinate data - const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = - outDataSet.GetCoordinateSystem(0).GetData(); - // Need the actual vertex points from a static cast of the dynamic array but can't get it right // So use cast and call on a functor that stores that dynamic array into static array we created vertexArray.Allocate(numberOfInPoints); - coordArray.CastAndCall(GetVertexArray()); + vtkm::cont::CastAndCall(outDataSet.GetCoordinateSystem(), GetVertexArray()); // Draw the five tetrahedra belonging to each hexadron vtkm::Float32 color[5][3] = { diff --git a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx index 8abd8e28c..8ab6f0108 100644 --- a/examples/tetrahedra/TetrahedralizeUniformGrid.cxx +++ b/examples/tetrahedra/TetrahedralizeUniformGrid.cxx @@ -170,13 +170,11 @@ void displayCall() // Get the cell set, coordinate system and coordinate data vtkm::cont::CellSetSingleType<> cellSet; tetDataSet.GetCellSet(0).CopyTo(cellSet); - const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = - tetDataSet.GetCoordinateSystem(0).GetData(); // Need the actual vertex points from a static cast of the dynamic array but can't get it right // So use cast and call on a functor that stores that dynamic array into static array we created vertexArray.Allocate(numberOfInPoints); - coordArray.CastAndCall(GetVertexArray()); + vtkm::cont::CastAndCall(tetDataSet.GetCoordinateSystem(), GetVertexArray()); // Draw the five tetrahedra belonging to each hexadron vtkm::Id tetra = 0; diff --git a/examples/tetrahedra/TriangulateExplicitGrid.cxx b/examples/tetrahedra/TriangulateExplicitGrid.cxx index c70a4c7dd..844fe8743 100644 --- a/examples/tetrahedra/TriangulateExplicitGrid.cxx +++ b/examples/tetrahedra/TriangulateExplicitGrid.cxx @@ -176,14 +176,10 @@ void displayCall() outDataSet.GetCellSet(0).CopyTo(cellSet); vtkm::Id numberOfCells = cellSet.GetNumberOfCells(); - // Get the coordinate system and coordinate data - const vtkm::cont::DynamicArrayHandleCoordinateSystem coordArray = - outDataSet.GetCoordinateSystem(0).GetData(); - // Need the actual vertex points from a static cast of the dynamic array but can't get it right // So use cast and call on a functor that stores that dynamic array into static array we created vertexArray.Allocate(numberOfInPoints); - coordArray.CastAndCall(GetVertexArray()); + vtkm::cont::CastAndCall(outDataSet.GetCoordinateSystem(), GetVertexArray()); // Draw the two triangles belonging to each quad vtkm::Float32 color[4][3] = { diff --git a/examples/tetrahedra/TriangulateUniformGrid.cxx b/examples/tetrahedra/TriangulateUniformGrid.cxx index 2f0a1e511..270cbac2a 100644 --- a/examples/tetrahedra/TriangulateUniformGrid.cxx +++ b/examples/tetrahedra/TriangulateUniformGrid.cxx @@ -132,13 +132,11 @@ void displayCall() // Get the cellset, coordinate system and coordinate data vtkm::cont::CellSetSingleType<> cellSet; tetDataSet.GetCellSet(0).CopyTo(cellSet); - const vtkm::cont::DynamicArrayHandleCoordinateSystem &coordArray = - tetDataSet.GetCoordinateSystem(0).GetData(); // Need the actual vertex points from a static cast of the dynamic array but can't get it right // So use cast and call on a functor that stores that dynamic array into static array we created vertexArray.Allocate(numberOfInPoints); - coordArray.CastAndCall(GetVertexArray()); + vtkm::cont::CastAndCall(tetDataSet.GetCoordinateSystem(), GetVertexArray()); // Draw the two triangles belonging to each quad vtkm::Id triangle = 0; diff --git a/vtkm/cont/CoordinateSystem.h b/vtkm/cont/CoordinateSystem.h index de5556162..bf8d876d6 100644 --- a/vtkm/cont/CoordinateSystem.h +++ b/vtkm/cont/CoordinateSystem.h @@ -258,6 +258,12 @@ public: } }; +template +void CastAndCall(const vtkm::cont::CoordinateSystem& coords, const Functor &f) +{ + coords.GetData().CastAndCall(f); +} + namespace internal { template<> @@ -266,17 +272,6 @@ struct DynamicTransformTraits typedef vtkm::cont::internal::DynamicTransformTagCastAndCall DynamicTag; }; -template -struct CastAndCall -{ - VTKM_CONT_EXPORT - void operator()(const vtkm::cont::CoordinateSystem &coordinateSystem, - const Functor &func) const - { - coordinateSystem.GetData().CastAndCall(func); - } -}; - } // namespace internal } // namespace cont } // namespace vtkm diff --git a/vtkm/cont/Field.h b/vtkm/cont/Field.h index 7c29b247e..1162a8eb6 100644 --- a/vtkm/cont/Field.h +++ b/vtkm/cont/Field.h @@ -518,23 +518,19 @@ private: mutable bool ModifiedFlag; }; -namespace internal { +template +void CastAndCall(const vtkm::cont::Field& field, const Functor &f) +{ + field.GetData().CastAndCall(f); +} +namespace internal { template<> struct DynamicTransformTraits { typedef vtkm::cont::internal::DynamicTransformTagCastAndCall DynamicTag; }; -template -struct CastAndCall -{ - VTKM_CONT_EXPORT - void operator()(const vtkm::cont::Field &field, const Functor &func) const - { - field.GetData().CastAndCall(func); - } -}; } // namespace internal } // namespace cont diff --git a/vtkm/cont/internal/DynamicTransform.h b/vtkm/cont/internal/DynamicTransform.h index d08c68d04..5fe7ee2ed 100644 --- a/vtkm/cont/internal/DynamicTransform.h +++ b/vtkm/cont/internal/DynamicTransform.h @@ -25,6 +25,26 @@ namespace vtkm { namespace cont { +template class ArrayHandle; + +/// A Generic interface to CastAndCall. The default implementation simply calls +/// DynamicObject's CastAndCall, but specializations of this function exist for +/// other classes (e.g. Field, CoordinateSystem, ArrayHandle). +template +void CastAndCall(const DynamicObject& dynamicObject, const Functor &f) +{ + dynamicObject.CastAndCall(f); +} + +/// A specialization of CastAndCall for basic ArrayHandle types, +/// Since the type is already known no deduction is needed. +/// This specialization is used to simplify numerous worklet algorithms +template +void CastAndCall(const vtkm::cont::ArrayHandle& handle, const Functor &f) +{ + f(handle); +} + namespace internal { /// Tag used to identify an object that is a dynamic object that contains a @@ -57,19 +77,6 @@ struct DynamicTransformTraits { typedef vtkm::cont::internal::DynamicTransformTagStatic DynamicTag; }; -/// A Generic interface to CastAndCall. The default implementation simply calls -/// DynamicObject's CastAndCall, but specializations of this function exist for -/// other classes (e.g. Field, CoordinateSystem). -template -struct CastAndCall -{ - VTKM_CONT_EXPORT - void operator()(const DynamicObject& dynamicObject, const Functor &f) - { - dynamicObject.CastAndCall(f); - } -}; - /// This functor can be used as the transform in the \c DynamicTransformCont /// method of \c FunctionInterface. It will allow dynamic objects like /// \c DynamicArray to be cast to their concrete types for templated operation. @@ -106,8 +113,7 @@ private: const ContinueFunctor &continueFunc, vtkm::cont::internal::DynamicTransformTagCastAndCall) const { - CastAndCall castAndCall; - castAndCall(dynamicInput, continueFunc); + CastAndCall(dynamicInput, continueFunc); } }; diff --git a/vtkm/cont/testing/TestingDataSetSingleType.h b/vtkm/cont/testing/TestingDataSetSingleType.h index 96051106a..0ce020c2e 100644 --- a/vtkm/cont/testing/TestingDataSetSingleType.h +++ b/vtkm/cont/testing/TestingDataSetSingleType.h @@ -146,7 +146,7 @@ private: vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology< vtkm::worklet::CellAverage,DeviceAdapterTag> dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), cellset, result); diff --git a/vtkm/cont/testing/UnitTestDataSetPermutation.cxx b/vtkm/cont/testing/UnitTestDataSetPermutation.cxx index 42bef6af1..d35d4f350 100644 --- a/vtkm/cont/testing/UnitTestDataSetPermutation.cxx +++ b/vtkm/cont/testing/UnitTestDataSetPermutation.cxx @@ -125,7 +125,7 @@ void TestDataSet_Explicit() //run a basic for-each topology algorithm on this vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), subset, result); @@ -173,7 +173,7 @@ void TestDataSet_Structured2D() //run a basic for-each topology algorithm on this vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), subset, result); @@ -218,7 +218,7 @@ void TestDataSet_Structured3D() //run a basic for-each topology algorithm on this vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), subset, result); diff --git a/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx b/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx index 335c93134..a4acfb236 100644 --- a/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx +++ b/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx @@ -158,24 +158,6 @@ ThreeDimRectilinearTest() vtkm::cont::DataSet dataSet = testDataSet.Make3DRectilinearDataSet0(); - /* - dataSet.PrintSummary(std::cout); - vtkm::cont::CoordinateSystem cs = dataSet.GetCoordinateSystem(); - vtkm::cont::DynamicArrayHandleCoordinateSystem dcs = cs.GetData(); - vtkm::cont::ArrayHandleCartesianProduct< - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle, - vtkm::cont::ArrayHandle > coords; - dcs.CastToArrayHandle(coords); - vtkm::Id n = dcs.GetNumberOfValues(); - vtkm::Vec pt(0,0,0); - for (int i = 0; i < n; i++) - { - pt = coords.GetPortalConstControl().Get(i); - std::cout< cellSet; dataSet.GetCellSet(0).CopyTo(cellSet); diff --git a/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx b/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx index ad2367e44..af4726055 100644 --- a/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx +++ b/vtkm/cont/testing/UnitTestDynamicArrayHandle.cxx @@ -152,7 +152,7 @@ void CheckDynamicArray( { BasicDynamicArrayChecks(array, numComponents); - array.CastAndCall(CheckFunctor()); + CastAndCall(array,CheckFunctor()); VTKM_TEST_ASSERT(CheckCalled, "The functor was never called (and apparently a bad value exception not thrown)."); diff --git a/vtkm/cont/testing/UnitTestDynamicCellSet.cxx b/vtkm/cont/testing/UnitTestDynamicCellSet.cxx index 1701eebd5..fe8918b64 100644 --- a/vtkm/cont/testing/UnitTestDynamicCellSet.cxx +++ b/vtkm/cont/testing/UnitTestDynamicCellSet.cxx @@ -66,6 +66,12 @@ void CheckDynamicCellSet( CheckCalled = false; dynamicCellSet.CastAndCall(CheckFunctor()); + VTKM_TEST_ASSERT(CheckCalled, + "The functor was never called (and apparently a bad value exception not thrown)."); + + CheckCalled = false; + CastAndCall(dynamicCellSet, CheckFunctor()); + VTKM_TEST_ASSERT(CheckCalled, "The functor was never called (and apparently a bad value exception not thrown)."); } diff --git a/vtkm/filter/ExternalFaces.hxx b/vtkm/filter/ExternalFaces.hxx index d047af71b..f0fc5a58a 100644 --- a/vtkm/filter/ExternalFaces.hxx +++ b/vtkm/filter/ExternalFaces.hxx @@ -105,7 +105,8 @@ vtkm::filter::ResultDataSet ExternalFaces::DoExecute(const vtkm::cont::DataSet& vtkm::cont::DataSet output; bool workletRan = false; ExternalFacesWorkletWrapper wrapper(output, workletRan); - vtkm::filter::ApplyPolicyUnstructured(cells,policy).CastAndCall( wrapper ); + vtkm::cont::CastAndCall(vtkm::filter::ApplyPolicyUnstructured(cells,policy), + wrapper); if(!workletRan) { diff --git a/vtkm/filter/FilterDataSet.hxx b/vtkm/filter/FilterDataSet.hxx index 64b549551..eb8113f48 100644 --- a/vtkm/filter/FilterDataSet.hxx +++ b/vtkm/filter/FilterDataSet.hxx @@ -127,7 +127,8 @@ bool FilterDataSet::MapFieldOntoOutput(ResultDataSet& result, valid); typedef vtkm::filter::FilterTraits< Derived > Traits; - vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor); + vtkm::cont::CastAndCall( vtkm::filter::ApplyPolicy(field, policy, Traits()), + functor ); } //the bool valid will be modified by the map algorithm to hold if the diff --git a/vtkm/filter/FilterDataSetWithField.hxx b/vtkm/filter/FilterDataSetWithField.hxx index 8873d51e8..d7ad81599 100644 --- a/vtkm/filter/FilterDataSetWithField.hxx +++ b/vtkm/filter/FilterDataSetWithField.hxx @@ -130,8 +130,8 @@ ResultDataSet FilterDataSetWithField::PrepareForExecution(const vtkm::c result); typedef vtkm::filter::FilterTraits< Derived > Traits; - vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor); - + vtkm::cont::CastAndCall( vtkm::filter::ApplyPolicy(field, policy, Traits()), + functor ); return result; } @@ -158,7 +158,8 @@ ResultDataSet FilterDataSetWithField::PrepareForExecution(const vtkm::c result); typedef vtkm::filter::FilterTraits< Derived > Traits; - vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor); + vtkm::cont::CastAndCall( vtkm::filter::ApplyPolicy(field, policy, Traits()), + functor ); return result; } @@ -192,7 +193,8 @@ bool FilterDataSetWithField::MapFieldOntoOutput(ResultDataSet& result, valid); typedef vtkm::filter::FilterTraits< Derived > Traits; - vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor); + vtkm::cont::CastAndCall( vtkm::filter::ApplyPolicy(field, policy, Traits()), + functor ); } //the bool valid will be modified by the map algorithm to hold if the diff --git a/vtkm/filter/FilterField.hxx b/vtkm/filter/FilterField.hxx index 321e3d223..2d065615d 100644 --- a/vtkm/filter/FilterField.hxx +++ b/vtkm/filter/FilterField.hxx @@ -119,7 +119,8 @@ ResultField FilterField::PrepareForExecution(const vtkm::cont::DataSet result); typedef vtkm::filter::FilterTraits< Derived > Traits; - vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor); + vtkm::cont::CastAndCall( vtkm::filter::ApplyPolicy(field, policy, Traits()), + functor ); return result; } @@ -146,7 +147,8 @@ ResultField FilterField::PrepareForExecution(const vtkm::cont::DataSet result); typedef vtkm::filter::FilterTraits< Derived > Traits; - vtkm::filter::ApplyPolicy(field, policy, Traits()).CastAndCall(functor); + vtkm::cont::CastAndCall( vtkm::filter::ApplyPolicy(field, policy, Traits()), + functor ); return result; } diff --git a/vtkm/filter/Threshold.hxx b/vtkm/filter/Threshold.hxx index 393add70d..5b5012608 100644 --- a/vtkm/filter/Threshold.hxx +++ b/vtkm/filter/Threshold.hxx @@ -143,7 +143,8 @@ vtkm::filter::ResultDataSet Threshold::DoExecute(const vtkm::cont::DataSet& inpu //can use to reduce code duplication, and make it easier to write filters //that return complex dataset types. AddPermutationCellSet addCellSet(output, this->ValidCellIds); - vtkm::filter::ApplyPolicy(cells, policy).CastAndCall(addCellSet); + vtkm::cont::CastAndCall(vtkm::filter::ApplyPolicy(cells, policy), + addCellSet); //todo: We need to generate a new output policy that replaces //the original storage tag with a new storage tag where everything is diff --git a/vtkm/io/reader/VTKDataSetReaderBase.h b/vtkm/io/reader/VTKDataSetReaderBase.h index 7aeefeca9..5ac6fb0b9 100644 --- a/vtkm/io/reader/VTKDataSetReaderBase.h +++ b/vtkm/io/reader/VTKDataSetReaderBase.h @@ -358,9 +358,10 @@ protected: this->DataSet.AddField(vtkm::cont::Field(name, association, data)); break; case vtkm::cont::Field::ASSOC_CELL_SET: - data.CastAndCall(PermuteCellData(this->CellsPermutation, data)); + vtkm::cont::CastAndCall( data, + PermuteCellData(this->CellsPermutation, data) ); this->DataSet.AddField( - vtkm::cont::Field(name, association, "cells", data)); + vtkm::cont::Field(name, association, "cells", data)); break; default: break; diff --git a/vtkm/io/writer/VTKDataSetWriter.h b/vtkm/io/writer/VTKDataSetWriter.h index af8671f8d..0a4db9358 100644 --- a/vtkm/io/writer/VTKDataSetWriter.h +++ b/vtkm/io/writer/VTKDataSetWriter.h @@ -165,10 +165,10 @@ private: vtkm::Id npoints = cdata.GetNumberOfValues(); std::string typeName; - cdata.CastAndCall(detail::GetDataTypeName(typeName)); + vtkm::cont::CastAndCall(cdata, detail::GetDataTypeName(typeName)); out << "POINTS " << npoints << " " << typeName << " " << std::endl; - cdata.CastAndCall(detail::OutputPointsFunctor(out)); + vtkm::cont::CastAndCall(cdata, detail::OutputPointsFunctor(out)); } template @@ -242,13 +242,13 @@ private: } std::string typeName; - field.GetData().CastAndCall(detail::GetDataTypeName(typeName)); + vtkm::cont::CastAndCall(field, detail::GetDataTypeName(typeName)); out << "SCALARS " << field.GetName() << " " << typeName << " " << ncomps << std::endl; out << "LOOKUP_TABLE default" << std::endl; - field.GetData().CastAndCall(detail::OutputFieldFunctor(out)); + vtkm::cont::CastAndCall(field, detail::OutputFieldFunctor(out)); } } @@ -281,13 +281,13 @@ private: } std::string typeName; - field.GetData().CastAndCall(detail::GetDataTypeName(typeName)); + vtkm::cont::CastAndCall(field, detail::GetDataTypeName(typeName)); out << "SCALARS " << field.GetName() << " " << typeName << " " << ncomps << std::endl; out << "LOOKUP_TABLE default" << std::endl; - field.GetData().CastAndCall(detail::OutputFieldFunctor(out)); + vtkm::cont::CastAndCall(field, detail::OutputFieldFunctor(out)); } } diff --git a/vtkm/rendering/raytracing/RayTracer.h b/vtkm/rendering/raytracing/RayTracer.h index c74d423e1..8a87106c5 100644 --- a/vtkm/rendering/raytracing/RayTracer.h +++ b/vtkm/rendering/raytracing/RayTracer.h @@ -259,7 +259,7 @@ public: rays.U, rays.V, rays.Scalar, - scalarField->GetData()); + *scalarField); } else { @@ -268,7 +268,7 @@ public: vtkm::Float32(scalarRange.Max)) ) .Invoke(rays.HitIdx, rays.Scalar, - scalarField->GetData()); + *scalarField); } } // Run diff --git a/vtkm/rendering/raytracing/VolumeRendererStructured.h b/vtkm/rendering/raytracing/VolumeRendererStructured.h index 3fb7cebb4..cf8bed636 100644 --- a/vtkm/rendering/raytracing/VolumeRendererStructured.h +++ b/vtkm/rendering/raytracing/VolumeRendererStructured.h @@ -1014,7 +1014,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField Rays.MinDistance, Rays.MaxDistance, camera.FrameBuffer, - ScalarField->GetData()); + *ScalarField); } else { @@ -1029,7 +1029,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField Rays.MinDistance, Rays.MaxDistance, camera.FrameBuffer, - ScalarField->GetData()); + *ScalarField); } } else @@ -1050,7 +1050,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField Rays.MinDistance, Rays.MaxDistance, camera.FrameBuffer, - ScalarField->GetData()); + *ScalarField); } else { @@ -1065,7 +1065,7 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField Rays.MinDistance, Rays.MaxDistance, camera.FrameBuffer, - ScalarField->GetData()); + *ScalarField); } } diff --git a/vtkm/worklet/Clip.h b/vtkm/worklet/Clip.h index 100574bef..3b9298731 100644 --- a/vtkm/worklet/Clip.h +++ b/vtkm/worklet/Clip.h @@ -608,7 +608,7 @@ public: vtkm::cont::CellSetExplicit<> output; ClipWithImplicitFunction clip(this, cellSet, clipFunction, &output); - coords.GetData().CastAndCall(clip); + CastAndCall(coords, clip); return output; } @@ -683,14 +683,14 @@ public: vtkm::cont::DynamicArrayHandle *Output; }; - template + template vtkm::cont::DynamicArrayHandle ProcessField( - const DynamicArrayHandleType &fieldData) const + const FieldType &fieldData) const { vtkm::cont::DynamicArrayHandle output; - fieldData.CastAndCall(InterpolateField(this->NewPointsInterpolation, - this->NewPointsOffset, - &output)); + CastAndCall(fieldData, InterpolateField(this->NewPointsInterpolation, + this->NewPointsOffset, + &output)); return output; } diff --git a/vtkm/worklet/Threshold.h b/vtkm/worklet/Threshold.h index 6d9f6d67e..c6007801b 100644 --- a/vtkm/worklet/Threshold.h +++ b/vtkm/worklet/Threshold.h @@ -119,7 +119,7 @@ public: ThresholdWorklet worklet(predicate); DispatcherMapTopology dispatcher(worklet); - dispatcher.Invoke(cellSet, field.GetData(), passFlags); + dispatcher.Invoke(cellSet, field, passFlags); break; } @@ -129,7 +129,7 @@ public: ThresholdWorklet worklet(predicate); DispatcherMapTopology dispatcher(worklet); - dispatcher.Invoke(cellSet, field.GetData(), passFlags); + dispatcher.Invoke(cellSet, field, passFlags); break; } @@ -171,7 +171,7 @@ public: } vtkm::cont::DynamicArrayHandle data; - field.GetData().CastAndCall(PermuteCellData(this->ValidCellIds, data)); + CastAndCall(field, PermuteCellData(this->ValidCellIds, data)); return vtkm::cont::Field(field.GetName(), field.GetAssociation(), field.GetAssocCellSet(), data); diff --git a/vtkm/worklet/VertexClustering.h b/vtkm/worklet/VertexClustering.h index 541036eb1..3f1d68f2c 100644 --- a/vtkm/worklet/VertexClustering.h +++ b/vtkm/worklet/VertexClustering.h @@ -305,7 +305,6 @@ struct VertexClustering } }; - public: /////////////////////////////////////////////////// @@ -375,8 +374,10 @@ public: internal::AverageByKeyDynamicValue, vtkm::cont::ArrayHandle, DeviceAdapter> - averageByKey(pointCidArray, pointCidArrayReduced, repPointArray); - coordinates.CastAndCall(averageByKey); + averageByKey(pointCidArray, + pointCidArrayReduced, + repPointArray); + CastAndCall(coordinates, averageByKey); #ifdef __VTKM_VERTEX_CLUSTERING_BENCHMARK std::cout << "Time after averaging (s): " << timer.GetElapsedTime() << std::endl; diff --git a/vtkm/worklet/testing/UnitTestCellAverage.cxx b/vtkm/worklet/testing/UnitTestCellAverage.cxx index c15ba03f5..d7d370477 100644 --- a/vtkm/worklet/testing/UnitTestCellAverage.cxx +++ b/vtkm/worklet/testing/UnitTestCellAverage.cxx @@ -40,7 +40,7 @@ void TestCellAverageUniform3D() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), dataSet.GetCellSet(), result); @@ -63,7 +63,7 @@ void TestCellAverageUniform2D() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), dataSet.GetCellSet(), result); @@ -86,7 +86,7 @@ void TestCellAverageExplicit() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), dataSet.GetCellSet(), result); diff --git a/vtkm/worklet/testing/UnitTestClipping.cxx b/vtkm/worklet/testing/UnitTestClipping.cxx index 755b81240..ecd8d34a3 100644 --- a/vtkm/worklet/testing/UnitTestClipping.cxx +++ b/vtkm/worklet/testing/UnitTestClipping.cxx @@ -120,13 +120,15 @@ void TestClippingExplicit() vtkm::worklet::Clip clip; vtkm::cont::CellSetExplicit<> outputCellSet = - clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue); + clip.Run(ds.GetCellSet(0), + ds.GetField("scalars").GetData(), + clipValue); vtkm::cont::DynamicArrayHandle coords = - clip.ProcessField(ds.GetCoordinateSystem("coords").GetData()); + clip.ProcessField(ds.GetCoordinateSystem("coords")); vtkm::cont::DynamicArrayHandle scalars = - clip.ProcessField(ds.GetField("scalars").GetData()); + clip.ProcessField(ds.GetField("scalars")); vtkm::Id connectivitySize = 12; @@ -169,13 +171,15 @@ void TestClippingStrucutred() vtkm::worklet::Clip clip; vtkm::cont::CellSetExplicit<> outputCellSet = - clip.Run(ds.GetCellSet(0), ds.GetField("scalars").GetData(), clipValue); + clip.Run(ds.GetCellSet(0), + ds.GetField("scalars").GetData(), + clipValue); vtkm::cont::DynamicArrayHandle coords = - clip.ProcessField(ds.GetCoordinateSystem("coords").GetData()); + clip.ProcessField(ds.GetCoordinateSystem("coords")); vtkm::cont::DynamicArrayHandle scalars = - clip.ProcessField(ds.GetField("scalars").GetData()); + clip.ProcessField(ds.GetField("scalars")); vtkm::Id connectivitySize = 36; vtkm::Id fieldSize = 13; @@ -228,9 +232,9 @@ void TestClippingWithImplicitFunction() vtkm::cont::DynamicArrayHandle coords = - clip.ProcessField(ds.GetCoordinateSystem("coords").GetData()); + clip.ProcessField(ds.GetCoordinateSystem("coords")); vtkm::cont::DynamicArrayHandle scalars = - clip.ProcessField(ds.GetField("scalars").GetData()); + clip.ProcessField(ds.GetField("scalars")); vtkm::Id connectivitySize = 36; vtkm::Id fieldSize = 13; diff --git a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx index 77b98daa3..4a036abab 100644 --- a/vtkm/worklet/testing/UnitTestMarchingCubes.cxx +++ b/vtkm/worklet/testing/UnitTestMarchingCubes.cxx @@ -308,7 +308,7 @@ void TestMarchingCubesExplicit() marchingCubes.Run(contourValue, cellSet, - dataSet.GetCoordinateSystem().GetData(), + dataSet.GetCoordinateSystem(), contourArray, vertices, normals, diff --git a/vtkm/worklet/testing/UnitTestPointElevation.cxx b/vtkm/worklet/testing/UnitTestPointElevation.cxx index 1e46dbd82..f6e61bcf0 100644 --- a/vtkm/worklet/testing/UnitTestPointElevation.cxx +++ b/vtkm/worklet/testing/UnitTestPointElevation.cxx @@ -90,7 +90,7 @@ void TestPointElevation() vtkm::worklet::DispatcherMapField dispatcher(pointElevationWorklet); - dispatcher.Invoke(dataSet.GetCoordinateSystem().GetData(), + dispatcher.Invoke(dataSet.GetCoordinateSystem(), result); vtkm::cont::ArrayHandle > coordinates; diff --git a/vtkm/worklet/testing/UnitTestVertexClustering.cxx b/vtkm/worklet/testing/UnitTestVertexClustering.cxx index 9b5c477d4..406546ac1 100644 --- a/vtkm/worklet/testing/UnitTestVertexClustering.cxx +++ b/vtkm/worklet/testing/UnitTestVertexClustering.cxx @@ -42,7 +42,7 @@ void TestVertexClustering() // run vtkm::worklet::VertexClustering clustering; vtkm::cont::DataSet outDataSet = clustering.Run(dataSet.GetCellSet(), - dataSet.GetCoordinateSystem().GetData(), + dataSet.GetCoordinateSystem(), bounds, divisions, VTKM_DEFAULT_DEVICE_ADAPTER_TAG()); diff --git a/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx b/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx index 3ad87e093..01e9d34e3 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx @@ -154,8 +154,8 @@ TestMaxPointOrCell() vtkm::worklet::DispatcherMapTopology< ::test_explicit::MaxPointOrCellValue > dispatcher; - dispatcher.Invoke(dataSet.GetField("cellvar").GetData(), - dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("cellvar"), + dataSet.GetField("pointvar"), dataSet.GetCellSet(0), result); @@ -177,7 +177,7 @@ TestAvgPointToCell() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology< ::test_explicit::AveragePointToCellValue > dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), dataSet.GetCellSet(), result); @@ -200,7 +200,7 @@ TestAvgCellToPoint() vtkm::worklet::DispatcherMapTopology< ::test_explicit::AverageCellToPointValue > dispatcher; - dispatcher.Invoke(dataSet.GetField("cellvar").GetData(), + dispatcher.Invoke(dataSet.GetField("cellvar"), dataSet.GetCellSet(), result); diff --git a/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx b/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx index e6c1fe45d..e0c750eba 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx @@ -181,8 +181,8 @@ TestMaxPointOrCell() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology< ::test_uniform::MaxPointOrCellValue > dispatcher; - dispatcher.Invoke(dataSet.GetField("cellvar").GetData(), - dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("cellvar"), + dataSet.GetField("pointvar"), // We know that the cell set is a structured 2D grid and // The worklet does not work with general types because // of the way we get cell indices. We need to make that @@ -209,7 +209,7 @@ TestAvgPointToCell() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology< ::test_uniform::AveragePointToCellValue > dispatcher; - dispatcher.Invoke(dataSet.GetField("pointvar").GetData(), + dispatcher.Invoke(dataSet.GetField("pointvar"), // We know that the cell set is a structured 2D grid and // The worklet does not work with general types because // of the way we get cell indices. We need to make that @@ -236,7 +236,7 @@ TestAvgCellToPoint() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology< ::test_uniform::AverageCellToPointValue > dispatcher; - dispatcher.Invoke(dataSet.GetField("cellvar").GetData(), + dispatcher.Invoke(dataSet.GetField("cellvar"), // We know that the cell set is a structured 2D grid and // The worklet does not work with general types because // of the way we get cell indices. We need to make that @@ -265,11 +265,11 @@ TestStructuredUniformPointCoords() vtkm::cont::DataSet dataSet3D = testDataSet.Make3DUniformDataSet0(); dispatcher.Invoke(dataSet3D.GetCellSet(), - dataSet3D.GetCoordinateSystem().GetData()); + dataSet3D.GetCoordinateSystem()); vtkm::cont::DataSet dataSet2D = testDataSet.Make2DUniformDataSet0(); dispatcher.Invoke(dataSet2D.GetCellSet(), - dataSet2D.GetCoordinateSystem().GetData()); + dataSet2D.GetCoordinateSystem()); } } // anonymous namespace