From 4650a1da96529daefc886cb8be5e55211306f5d6 Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Tue, 4 Jan 2022 16:42:55 -0700 Subject: [PATCH] Deprecate old methods from DynamicCellSet The `DynamicCellSet` (and the related `DynamicCellSetBase`) are deprecated and replaced with `UnknownCellSet` (and `UncertainCellSet`). Thus, `UnknownCellSet` has some methods inherited from `DynamicCellSet` but replaced with other functionality. These methods are now marked as deprecated and their use is removed. --- benchmarking/BenchmarkFilters.cxx | 2 +- .../ContourTreeApp.cxx | 4 +-- vtkm/cont/CastAndCall.h | 11 ++++++-- vtkm/cont/CellLocator.h | 8 +++--- .../CellLocatorBoundingIntervalHierarchy.cxx | 2 +- vtkm/cont/CellLocatorRectilinearGrid.cxx | 12 ++++---- vtkm/cont/CellLocatorTwoLevel.cxx | 2 +- vtkm/cont/CellLocatorUniformGrid.cxx | 8 +++--- vtkm/cont/MergePartitionedDataSet.cxx | 3 +- vtkm/cont/UnknownCellSet.h | 9 ++++-- .../TestingCellLocatorRectilinearGrid.h | 2 +- .../cont/testing/TestingCellLocatorTwoLevel.h | 2 +- .../testing/TestingCellLocatorUniformGrid.h | 2 +- vtkm/cont/testing/TestingDataSetExplicit.h | 2 +- vtkm/cont/testing/TestingDataSetSingleType.h | 2 +- .../testing/UnitTestCellSetPermutation.cxx | 8 +++--- .../UnitTestDataSetBuilderCurvilinear.cxx | 6 ++-- .../UnitTestDataSetBuilderRectilinear.cxx | 6 ++-- .../testing/UnitTestDataSetBuilderUniform.cxx | 6 ++-- .../testing/UnitTestDataSetPermutation.cxx | 6 ++-- .../testing/UnitTestDataSetRectilinear.cxx | 4 +-- vtkm/cont/testing/UnitTestDataSetUniform.cxx | 4 +-- vtkm/filter/AmrArrays.hxx | 4 +-- vtkm/filter/CleanGrid.hxx | 2 +- vtkm/filter/ContourTreeUniform.hxx | 4 +-- vtkm/filter/ExternalFaces.hxx | 4 +-- vtkm/filter/GhostCellClassify.hxx | 9 ++++-- vtkm/filter/GhostCellRemove.hxx | 18 ++++++------ vtkm/filter/Lagrangian.hxx | 15 ++++++---- vtkm/filter/ParticleDensityCloudInCell.hxx | 2 +- vtkm/filter/ZFPCompressor2D.hxx | 2 +- vtkm/filter/ZFPCompressor3D.hxx | 2 +- vtkm/filter/ZFPDecompressor2D.hxx | 2 +- vtkm/filter/ZFPDecompressor3D.hxx | 2 +- ...stingContourTreeUniformDistributedFilter.h | 8 +++--- vtkm/filter/testing/UnitTestCleanGrid.cxx | 2 +- vtkm/filter/testing/UnitTestContourFilter.cxx | 6 ++-- .../testing/UnitTestExternalFacesFilter.cxx | 2 +- .../testing/UnitTestGhostCellRemove.cxx | 8 +++--- .../testing/UnitTestImageMedianFilter.cxx | 2 +- .../testing/UnitTestSplitSharpEdgesFilter.cxx | 4 +-- .../testing/UnitTestStreamlineFilter.cxx | 10 +++---- .../testing/UnitTestStreamlineFilterMPI.cxx | 6 ++-- .../UnitTestVertexClusteringFilter.cxx | 2 +- vtkm/io/ImageWriterBase.cxx | 2 +- vtkm/io/VTKDataSetWriter.cxx | 13 +++++---- vtkm/rendering/Cylinderizer.h | 4 +-- vtkm/rendering/MapperVolume.cxx | 4 +-- vtkm/rendering/MapperWireframer.cxx | 8 +++--- vtkm/rendering/Quadralizer.h | 8 +++--- vtkm/rendering/Triangulator.h | 8 +++--- .../raytracing/CylinderExtractor.cxx | 4 +-- .../raytracing/MeshConnectivityBuilder.cxx | 15 +++++----- vtkm/rendering/raytracing/QuadExtractor.cxx | 4 +-- vtkm/rendering/raytracing/SphereExtractor.cxx | 8 +++--- vtkm/worklet/StreamLineUniformGrid.h | 2 +- vtkm/worklet/StreamSurface.h | 4 +-- vtkm/worklet/Tube.h | 4 +-- vtkm/worklet/lcs/GridMetaData.h | 6 ++-- .../CellInterpolationHelper.h | 20 ++++++------- vtkm/worklet/testing/GenerateTestDataSets.h | 8 +++--- vtkm/worklet/testing/UnitTestCellDeepCopy.cxx | 2 +- .../testing/UnitTestCellSetConnectivity.cxx | 4 +-- vtkm/worklet/testing/UnitTestContour.cxx | 6 ++-- .../testing/UnitTestContourTreeUniform.cxx | 4 +-- .../UnitTestContourTreeUniformAugmented.cxx | 8 +++--- .../worklet/testing/UnitTestExternalFaces.cxx | 13 +++++---- .../testing/UnitTestExtractGeometry.cxx | 12 ++++---- .../testing/UnitTestExtractStructured.cxx | 28 ++++++++++--------- .../testing/UnitTestImageConnectivity.cxx | 6 ++-- vtkm/worklet/testing/UnitTestMask.cxx | 6 ++-- .../worklet/testing/UnitTestOrientNormals.cxx | 2 +- .../testing/UnitTestScatterAndMask.cxx | 2 +- .../UnitTestScatterAndMaskWithTopology.cxx | 4 +-- .../testing/UnitTestStreamLineUniformGrid.cxx | 2 +- .../testing/UnitTestTetrahedralize.cxx | 4 +-- vtkm/worklet/testing/UnitTestThreshold.cxx | 6 ++-- .../testing/UnitTestTriangleWinding.cxx | 4 +-- vtkm/worklet/testing/UnitTestTriangulate.cxx | 4 +-- .../testing/UnitTestVertexClustering.cxx | 4 +-- .../testing/UnitTestWholeCellSetIn.cxx | 10 +++---- .../UnitTestWorkletMapTopologyExplicit.cxx | 2 +- 82 files changed, 253 insertions(+), 229 deletions(-) diff --git a/benchmarking/BenchmarkFilters.cxx b/benchmarking/BenchmarkFilters.cxx index ba34a4701..88a52bd9b 100644 --- a/benchmarking/BenchmarkFilters.cxx +++ b/benchmarking/BenchmarkFilters.cxx @@ -545,7 +545,7 @@ void BenchReverseConnectivityGen(::benchmark::State& state) for (auto _ : state) { (void)_; - cellset.CastAndCall(functor); + vtkm::cont::CastAndCall(cellset, functor); state.SetIterationTime(functor.Timer.GetElapsedTime()); } } diff --git a/examples/contour_tree_distributed/ContourTreeApp.cxx b/examples/contour_tree_distributed/ContourTreeApp.cxx index 7d2a68268..0278356bf 100644 --- a/examples/contour_tree_distributed/ContourTreeApp.cxx +++ b/examples/contour_tree_distributed/ContourTreeApp.cxx @@ -646,8 +646,8 @@ int main(int argc, char* argv[]) // in the values vector and copy the dimensions in the dims vector vtkm::Id3 pointDimensions; auto cellSet = inDataSet.GetCellSet(); - cellSet.CastAndCall(vtkm::worklet::contourtree_augmented::GetPointDimensions(), - pointDimensions); + vtkm::cont::CastAndCall( + cellSet, vtkm::worklet::contourtree_augmented::GetPointDimensions(), pointDimensions); std::cout << "Point dimensions are " << pointDimensions << std::endl; dims.resize(3); dims[0] = pointDimensions[0]; diff --git a/vtkm/cont/CastAndCall.h b/vtkm/cont/CastAndCall.h index 66c3d5741..45ed018fd 100644 --- a/vtkm/cont/CastAndCall.h +++ b/vtkm/cont/CastAndCall.h @@ -38,6 +38,8 @@ template class CellSetPermutation; class CellSetExtrude; +class UnknownCellSet; + /// 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). @@ -49,16 +51,21 @@ void CastAndCall(const DynamicObject& dynamicObject, Functor&& f, Args&&... args /// A specialization of CastAndCall for basic CoordinateSystem to make /// it be treated just like any other dynamic object -// actually implemented in vtkm/cont/CoordinateSystem +// actually implemented in vtkm/cont/CoordinateSystem.h template void CastAndCall(const CoordinateSystem& coords, Functor&& f, Args&&... args); /// A specialization of CastAndCall for basic Field to make /// it be treated just like any other dynamic object -// actually implemented in vtkm/cont/Field +// actually implemented in vtkm/cont/Field.h template void CastAndCall(const vtkm::cont::Field& field, Functor&& f, Args&&... args); +/// A specialization of CastAndCall for unknown cell sets. +// actually implemented in vtkm/cont/UnknownCellSet.h +template +void CastAndCall(const vtkm::cont::UnknownCellSet& cellSet, Functor&& f, Args&&... args); + /// 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 diff --git a/vtkm/cont/CellLocator.h b/vtkm/cont/CellLocator.h index 1a96564a1..a4c6596dc 100644 --- a/vtkm/cont/CellLocator.h +++ b/vtkm/cont/CellLocator.h @@ -15,8 +15,8 @@ #include #include #include -#include #include +#include #include @@ -39,9 +39,9 @@ class VTKM_CONT_EXPORT VTKM_DEPRECATED(1.6, public: virtual ~CellLocator(); - const vtkm::cont::DynamicCellSet& GetCellSet() const { return this->CellSet; } + const vtkm::cont::UnknownCellSet& GetCellSet() const { return this->CellSet; } - void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet) + void SetCellSet(const vtkm::cont::UnknownCellSet& cellSet) { this->CellSet = cellSet; this->SetModified(); @@ -84,7 +84,7 @@ protected: VTKM_CONT virtual void Build() = 0; private: - vtkm::cont::DynamicCellSet CellSet; + vtkm::cont::UnknownCellSet CellSet; vtkm::cont::CoordinateSystem Coords; bool Modified = true; }; diff --git a/vtkm/cont/CellLocatorBoundingIntervalHierarchy.cxx b/vtkm/cont/CellLocatorBoundingIntervalHierarchy.cxx index 93c8352f6..c0887942d 100644 --- a/vtkm/cont/CellLocatorBoundingIntervalHierarchy.cxx +++ b/vtkm/cont/CellLocatorBoundingIntervalHierarchy.cxx @@ -470,7 +470,7 @@ CellLocatorBoundingIntervalHierarchy::PrepareForExecution(vtkm::cont::DeviceAdap vtkm::cont::Token& token) const { ExecObjType execObject; - this->GetCellSet().CastAndCall(MakeExecObject{}, device, token, *this, execObject); + vtkm::cont::CastAndCall(this->GetCellSet(), MakeExecObject{}, device, token, *this, execObject); return execObject; } diff --git a/vtkm/cont/CellLocatorRectilinearGrid.cxx b/vtkm/cont/CellLocatorRectilinearGrid.cxx index 2f7a3c980..a3f13f6f4 100644 --- a/vtkm/cont/CellLocatorRectilinearGrid.cxx +++ b/vtkm/cont/CellLocatorRectilinearGrid.cxx @@ -28,19 +28,19 @@ void CellLocatorRectilinearGrid::Build() if (!coords.GetData().IsType()) throw vtkm::cont::ErrorBadType("Coordinates are not rectilinear type."); - if (cellSet.IsSameType(Structured2DType())) + if (cellSet.CanConvert()) { this->Is3D = false; vtkm::Vec celldims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); this->PlaneSize = celldims[0] * celldims[1]; this->RowSize = celldims[0]; } - else if (cellSet.IsSameType(Structured3DType())) + else if (cellSet.CanConvert()) { this->Is3D = true; vtkm::Vec celldims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); this->PlaneSize = celldims[0] * celldims[1]; this->RowSize = celldims[0]; } @@ -62,7 +62,7 @@ vtkm::exec::CellLocatorRectilinearGrid CellLocatorRectilinearGrid::PrepareForExe { return ExecObjType(this->PlaneSize, this->RowSize, - this->GetCellSet().template Cast(), + this->GetCellSet().AsCellSet(), this->GetCoordinates().GetData().template AsArrayHandle(), device, token); @@ -71,7 +71,7 @@ vtkm::exec::CellLocatorRectilinearGrid CellLocatorRectilinearGrid::PrepareForExe { return ExecObjType(this->PlaneSize, this->RowSize, - this->GetCellSet().template Cast(), + this->GetCellSet().AsCellSet(), this->GetCoordinates().GetData().template AsArrayHandle(), device, token); diff --git a/vtkm/cont/CellLocatorTwoLevel.cxx b/vtkm/cont/CellLocatorTwoLevel.cxx index e1294628f..47d4bedac 100644 --- a/vtkm/cont/CellLocatorTwoLevel.cxx +++ b/vtkm/cont/CellLocatorTwoLevel.cxx @@ -484,7 +484,7 @@ CellLocatorTwoLevel::ExecObjType CellLocatorTwoLevel::PrepareForExecution( { this->Update(); ExecObjType execObject; - this->GetCellSet().CastAndCall(MakeExecObject{}, device, token, *this, execObject); + vtkm::cont::CastAndCall(this->GetCellSet(), MakeExecObject{}, device, token, *this, execObject); return execObject; } diff --git a/vtkm/cont/CellLocatorUniformGrid.cxx b/vtkm/cont/CellLocatorUniformGrid.cxx index 4b23ddfe5..c8c8cc313 100644 --- a/vtkm/cont/CellLocatorUniformGrid.cxx +++ b/vtkm/cont/CellLocatorUniformGrid.cxx @@ -29,17 +29,17 @@ void CellLocatorUniformGrid::Build() if (!coords.GetData().IsType()) throw vtkm::cont::ErrorBadType("Coordinates are not uniform type."); - if (cellSet.IsSameType(Structured2DType())) + if (cellSet.CanConvert()) { this->Is3D = false; - Structured2DType structuredCellSet = cellSet.Cast(); + Structured2DType structuredCellSet = cellSet.AsCellSet(); vtkm::Id2 pointDims = structuredCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint()); this->PointDims = vtkm::Id3(pointDims[0], pointDims[1], 1); } - else if (cellSet.IsSameType(Structured3DType())) + else if (cellSet.CanConvert()) { this->Is3D = true; - Structured3DType structuredCellSet = cellSet.Cast(); + Structured3DType structuredCellSet = cellSet.AsCellSet(); this->PointDims = structuredCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint()); } else diff --git a/vtkm/cont/MergePartitionedDataSet.cxx b/vtkm/cont/MergePartitionedDataSet.cxx index aecea18d6..896e7a6a4 100644 --- a/vtkm/cont/MergePartitionedDataSet.cxx +++ b/vtkm/cont/MergePartitionedDataSet.cxx @@ -79,7 +79,8 @@ void TransferCells(const vtkm::cont::UnknownCellSet& cellSetIn, vtkm::cont::ArrayHandle& connectivity, vtkm::Id startIndex) { - cellSetIn.CastAndCall(TransferCellsFunctor{}, shapes, numIndices, connectivity, startIndex); + vtkm::cont::CastAndCall( + cellSetIn, TransferCellsFunctor{}, shapes, numIndices, connectivity, startIndex); } struct TransferArrayFunctor diff --git a/vtkm/cont/UnknownCellSet.h b/vtkm/cont/UnknownCellSet.h index 46b25e4d2..b8548c330 100644 --- a/vtkm/cont/UnknownCellSet.h +++ b/vtkm/cont/UnknownCellSet.h @@ -223,16 +223,17 @@ public: template VTKM_CONT void CastAndCallForTypes(Functor&& functor, Args&&... args) const; - // Support for (soon to be) deprecated DynamicCellSet - // TODO: Deprecate these methods + // Support for deprecated DynamicCellSet features template + VTKM_DEPRECATED(1.8, "Use CanConvert() (or IsType).") VTKM_CONT bool IsSameType(const CellSetType&) const { return this->IsType(); } template + VTKM_DEPRECATED(1.8, "Use AsCellSet().") VTKM_CONT CellSetType& Cast() const { VTKM_IS_CELL_SET(CellSetType); @@ -247,12 +248,16 @@ public: } template + VTKM_DEPRECATED(1.8, "Use AsCellSet(cellSet).") VTKM_CONT void CopyTo(CellSetType& cellSet) const { return this->AsCellSet(cellSet); } template + VTKM_DEPRECATED(1.8, + "Use the vtkm::cont::CastAndCall free function4 or use CastAndCallForTypes or " + "use ResetCellList and then CastAndCall.") VTKM_CONT void CastAndCall(Functor&& f, Args&&... args) const { this->CastAndCallForTypes(std::forward(f), diff --git a/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h b/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h index a79806227..8eb3e43f1 100644 --- a/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h +++ b/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h @@ -154,7 +154,7 @@ public: vtkm::cont::UnknownCellSet cellSet = dataset.GetCellSet(); vtkm::Bounds bounds = coords.GetBounds(); vtkm::Id3 dims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagPoint()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagPoint()); // Generate some sample points. using PointType = vtkm::Vec3f; diff --git a/vtkm/cont/testing/TestingCellLocatorTwoLevel.h b/vtkm/cont/testing/TestingCellLocatorTwoLevel.h index 3e7648cf8..562576460 100644 --- a/vtkm/cont/testing/TestingCellLocatorTwoLevel.h +++ b/vtkm/cont/testing/TestingCellLocatorTwoLevel.h @@ -77,7 +77,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec& dims) vtkm::Vec(1.0f)); auto uniformCs = - uniformDs.GetCellSet().template Cast>(); + uniformDs.GetCellSet().template AsCellSet>(); // triangulate the cellset vtkm::cont::CellSetSingleType<> cellset; diff --git a/vtkm/cont/testing/TestingCellLocatorUniformGrid.h b/vtkm/cont/testing/TestingCellLocatorUniformGrid.h index 3cbfef26b..3097743de 100644 --- a/vtkm/cont/testing/TestingCellLocatorUniformGrid.h +++ b/vtkm/cont/testing/TestingCellLocatorUniformGrid.h @@ -103,7 +103,7 @@ public: using StructuredType = vtkm::cont::CellSetStructured<3>; vtkm::Id3 cellDims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); std::cout << "Dimensions of dataset : " << cellDims << std::endl; vtkm::cont::CellLocatorUniformGrid locator; diff --git a/vtkm/cont/testing/TestingDataSetExplicit.h b/vtkm/cont/testing/TestingDataSetExplicit.h index 6d7896935..2379bfcad 100644 --- a/vtkm/cont/testing/TestingDataSetExplicit.h +++ b/vtkm/cont/testing/TestingDataSetExplicit.h @@ -90,7 +90,7 @@ private: // test cell-to-point connectivity vtkm::cont::CellSetExplicit<> cellset; - ds.GetCellSet().CopyTo(cellset); + ds.GetCellSet().AsCellSet(cellset); vtkm::Id connectivitySize = 7; vtkm::Id numPoints = 5; diff --git a/vtkm/cont/testing/TestingDataSetSingleType.h b/vtkm/cont/testing/TestingDataSetSingleType.h index a79c631f9..d7a6dea50 100644 --- a/vtkm/cont/testing/TestingDataSetSingleType.h +++ b/vtkm/cont/testing/TestingDataSetSingleType.h @@ -99,7 +99,7 @@ private: //verify that we can get a CellSetSingleType from a dataset vtkm::cont::CellSetSingleType<> cellset; - dataSet.GetCellSet().CopyTo(cellset); + dataSet.GetCellSet().AsCellSet(cellset); //verify that the point to cell connectivity types are correct vtkm::cont::ArrayHandleConstant shapesPointToCell = diff --git a/vtkm/cont/testing/UnitTestCellSetPermutation.cxx b/vtkm/cont/testing/UnitTestCellSetPermutation.cxx index 11641cce5..bf65b3139 100644 --- a/vtkm/cont/testing/UnitTestCellSetPermutation.cxx +++ b/vtkm/cont/testing/UnitTestCellSetPermutation.cxx @@ -170,19 +170,19 @@ void TestCellSetPermutation() std::cout << "Testing CellSetStructured<2>\n"; dataset = maker.Make2DUniformDataSet1(); - RunTests(dataset.GetCellSet().Cast>()); + RunTests(dataset.GetCellSet().AsCellSet>()); std::cout << "Testing CellSetStructured<3>\n"; dataset = maker.Make3DUniformDataSet1(); - RunTests(dataset.GetCellSet().Cast>()); + RunTests(dataset.GetCellSet().AsCellSet>()); std::cout << "Testing CellSetExplicit\n"; dataset = maker.Make3DExplicitDataSetPolygonal(); - RunTests(dataset.GetCellSet().Cast>()); + RunTests(dataset.GetCellSet().AsCellSet>()); std::cout << "Testing CellSetSingleType\n"; dataset = maker.Make3DExplicitDataSetCowNose(); - RunTests(dataset.GetCellSet().Cast>()); + RunTests(dataset.GetCellSet().AsCellSet>()); } } // anonymous namespace diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderCurvilinear.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderCurvilinear.cxx index c888c7653..12850422d 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderCurvilinear.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderCurvilinear.cxx @@ -62,21 +62,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds, if (dim == 1) { vtkm::cont::CellSetStructured<1> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_LINE, "Wrong element type"); } else if (dim == 2) { vtkm::cont::CellSetStructured<2> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Wrong element type"); } else if (dim == 3) { vtkm::cont::CellSetStructured<3> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type"); } diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx index 9c82c7914..b553e8fe3 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderRectilinear.cxx @@ -60,21 +60,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds, if (dim == 1) { vtkm::cont::CellSetStructured<1> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_LINE, "Wrong element type"); } else if (dim == 2) { vtkm::cont::CellSetStructured<2> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Wrong element type"); } else if (dim == 3) { vtkm::cont::CellSetStructured<3> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type"); } diff --git a/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx b/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx index 9c0691796..a58ac81e5 100644 --- a/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx +++ b/vtkm/cont/testing/UnitTestDataSetBuilderUniform.cxx @@ -61,21 +61,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds, if (dim == 1) { vtkm::cont::CellSetStructured<1> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_LINE, "Wrong element type"); } else if (dim == 2) { vtkm::cont::CellSetStructured<2> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Wrong element type"); } else if (dim == 3) { vtkm::cont::CellSetStructured<3> cellSet; - ds.GetCellSet().CopyTo(cellSet); + ds.GetCellSet().AsCellSet(cellSet); vtkm::IdComponent shape = cellSet.GetCellShape(); VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type"); } diff --git a/vtkm/cont/testing/UnitTestDataSetPermutation.cxx b/vtkm/cont/testing/UnitTestDataSetPermutation.cxx index d2449d8b1..93c0b5ca6 100644 --- a/vtkm/cont/testing/UnitTestDataSetPermutation.cxx +++ b/vtkm/cont/testing/UnitTestDataSetPermutation.cxx @@ -93,7 +93,7 @@ void TestDataSet_Explicit() //get the cellset single type from the dataset vtkm::cont::CellSetSingleType<> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); //verify that we can create a subset of a singlset using SubsetType = vtkm::cont::CellSetPermutation>; @@ -128,7 +128,7 @@ void TestDataSet_Structured2D() vtkm::cont::make_ArrayHandle({ 1, 1, 1, 1 }); vtkm::cont::CellSetStructured<2> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); //verify that we can create a subset of a 2d UniformDataSet vtkm::cont::CellSetPermutation> subset; @@ -161,7 +161,7 @@ void TestDataSet_Structured3D() vtkm::cont::make_ArrayHandle({ 1, 1, 1, 1 }); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); //verify that we can create a subset of a 2d UniformDataSet vtkm::cont::CellSetPermutation> subset; diff --git a/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx b/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx index 06ccf6dfc..8f1cb75fe 100644 --- a/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx +++ b/vtkm/cont/testing/UnitTestDataSetRectilinear.cxx @@ -40,7 +40,7 @@ static void TwoDimRectilinearTest() vtkm::cont::DataSet dataSet = testDataSet.Make2DRectilinearDataSet0(); vtkm::cont::CellSetStructured<2> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields"); VTKM_TEST_ASSERT(dataSet.GetNumberOfCoordinateSystems() == 1, @@ -126,7 +126,7 @@ static void ThreeDimRectilinearTest() vtkm::cont::DataSet dataSet = testDataSet.Make3DRectilinearDataSet0(); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields"); diff --git a/vtkm/cont/testing/UnitTestDataSetUniform.cxx b/vtkm/cont/testing/UnitTestDataSetUniform.cxx index 894419734..7b57d4d5c 100644 --- a/vtkm/cont/testing/UnitTestDataSetUniform.cxx +++ b/vtkm/cont/testing/UnitTestDataSetUniform.cxx @@ -41,7 +41,7 @@ static void TwoDimUniformTest() dataSet.PrintSummary(std::cout); vtkm::cont::CellSetStructured<2> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields"); VTKM_TEST_ASSERT(dataSet.GetNumberOfCoordinateSystems() == 1, @@ -130,7 +130,7 @@ static void ThreeDimUniformTest() dataSet.PrintSummary(std::cout); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields"); diff --git a/vtkm/filter/AmrArrays.hxx b/vtkm/filter/AmrArrays.hxx index 667dd86e2..b072d2150 100644 --- a/vtkm/filter/AmrArrays.hxx +++ b/vtkm/filter/AmrArrays.hxx @@ -152,7 +152,7 @@ void AmrArrays::ComputeGenerateParentChildInformation() vtkm::Id ptids[8]; this->AmrDataSet.GetPartition(this->PartitionIds.at(l).at(bParent)) .GetCellSet() - .CopyTo(cellset); + .AsCellSet(cellset); cellset.GetCellPointIds(0, ptids); vtkm::Bounds boundsCell = vtkm::Bounds(); for (vtkm::IdComponent pointId = 0; pointId < cellset.GetNumberOfPointsInCell(0); pointId++) @@ -221,7 +221,7 @@ void AmrArrays::ComputeGenerateGhostType() vtkm::cont::DataSet partition = this->AmrDataSet.GetPartition(this->PartitionIds.at(l).at(bParent)); vtkm::cont::CellSetStructured cellset; - partition.GetCellSet().CopyTo(cellset); + partition.GetCellSet().AsCellSet(cellset); vtkm::cont::ArrayHandle ghostField; if (!partition.HasField("vtkGhostType", vtkm::cont::Field::Association::CELL_SET)) { diff --git a/vtkm/filter/CleanGrid.hxx b/vtkm/filter/CleanGrid.hxx index df66f4e10..d84354ec3 100644 --- a/vtkm/filter/CleanGrid.hxx +++ b/vtkm/filter/CleanGrid.hxx @@ -35,7 +35,7 @@ vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::DataSet& inData, if (inCellSet.IsType()) { // Is expected type, do a shallow copy - outputCellSet = inCellSet.Cast(); + outputCellSet = inCellSet.AsCellSet(); } else { // Clean the grid diff --git a/vtkm/filter/ContourTreeUniform.hxx b/vtkm/filter/ContourTreeUniform.hxx index 56735f264..7195b3b53 100644 --- a/vtkm/filter/ContourTreeUniform.hxx +++ b/vtkm/filter/ContourTreeUniform.hxx @@ -90,7 +90,7 @@ vtkm::cont::DataSet ContourTreeMesh2D::DoExecute( // Collect sizing information from the dataset const auto& dynamicCellSet = input.GetCellSet(); vtkm::cont::CellSetStructured<2> cellSet; - dynamicCellSet.CopyTo(cellSet); + dynamicCellSet.AsCellSet(cellSet); vtkm::Id2 pointDimensions = cellSet.GetPointDimensions(); vtkm::Id nRows = pointDimensions[0]; @@ -125,7 +125,7 @@ vtkm::cont::DataSet ContourTreeMesh3D::DoExecute( // Collect sizing information from the dataset vtkm::cont::CellSetStructured<3> cellSet; - input.GetCellSet().CopyTo(cellSet); + input.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); vtkm::Id nRows = pointDimensions[0]; diff --git a/vtkm/filter/ExternalFaces.hxx b/vtkm/filter/ExternalFaces.hxx index 186af776f..060d305d6 100644 --- a/vtkm/filter/ExternalFaces.hxx +++ b/vtkm/filter/ExternalFaces.hxx @@ -28,9 +28,9 @@ vtkm::cont::DataSet ExternalFaces::DoExecute(const vtkm::cont::DataSet& input, // external faces worklet vtkm::cont::CellSetExplicit<> outCellSet; - if (cells.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (cells.CanConvert>()) { - this->Worklet.Run(cells.Cast>(), + this->Worklet.Run(cells.AsCellSet>(), input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()), outCellSet); } diff --git a/vtkm/filter/GhostCellClassify.hxx b/vtkm/filter/GhostCellClassify.hxx index f05635e69..6e56370bf 100644 --- a/vtkm/filter/GhostCellClassify.hxx +++ b/vtkm/filter/GhostCellClassify.hxx @@ -108,7 +108,8 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co if (numCells <= 2) throw vtkm::cont::ErrorFilterExecution("insufficient number of cells for GhostCellClassify."); - vtkm::cont::CellSetStructured<1> cellset1d = cellset.Cast>(); + vtkm::cont::CellSetStructured<1> cellset1d = + cellset.AsCellSet>(); //We use the dual of the cellset since we are using the PointNeighborhood worklet vtkm::cont::CellSetStructured<3> dual; @@ -121,7 +122,8 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co if (numCells <= 4) throw vtkm::cont::ErrorFilterExecution("insufficient number of cells for GhostCellClassify."); - vtkm::cont::CellSetStructured<2> cellset2d = cellset.Cast>(); + vtkm::cont::CellSetStructured<2> cellset2d = + cellset.AsCellSet>(); //We use the dual of the cellset since we are using the PointNeighborhood worklet vtkm::cont::CellSetStructured<3> dual; @@ -134,7 +136,8 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co if (numCells <= 8) throw vtkm::cont::ErrorFilterExecution("insufficient number of cells for GhostCellClassify."); - vtkm::cont::CellSetStructured<3> cellset3d = cellset.Cast>(); + vtkm::cont::CellSetStructured<3> cellset3d = + cellset.AsCellSet>(); //We use the dual of the cellset since we are using the PointNeighborhood worklet vtkm::cont::CellSetStructured<3> dual; diff --git a/vtkm/filter/GhostCellRemove.hxx b/vtkm/filter/GhostCellRemove.hxx index c5e9acb2f..c01c46dce 100644 --- a/vtkm/filter/GhostCellRemove.hxx +++ b/vtkm/filter/GhostCellRemove.hxx @@ -250,27 +250,27 @@ bool CanDoStructuredStrip(const vtkm::cont::UnknownCellSet& cells, bool canDo = false; vtkm::Id3 cellDims(1, 1, 1); - if (cells.IsSameType(vtkm::cont::CellSetStructured<1>())) + if (cells.CanConvert>()) { - auto cells1D = cells.Cast>(); + auto cells1D = cells.AsCellSet>(); vtkm::Id d = cells1D.GetCellDimensions(); cellDims[0] = d; vtkm::Id sz = d; canDo = CanStrip<1>(ghostField, invoke, removeAllGhost, removeType, range, cellDims, sz); } - else if (cells.IsSameType(vtkm::cont::CellSetStructured<2>())) + else if (cells.CanConvert>()) { - auto cells2D = cells.Cast>(); + auto cells2D = cells.AsCellSet>(); vtkm::Id2 d = cells2D.GetCellDimensions(); cellDims[0] = d[0]; cellDims[1] = d[1]; vtkm::Id sz = cellDims[0] * cellDims[1]; canDo = CanStrip<2>(ghostField, invoke, removeAllGhost, removeType, range, cellDims, sz); } - else if (cells.IsSameType(vtkm::cont::CellSetStructured<3>())) + else if (cells.CanConvert>()) { - auto cells3D = cells.Cast>(); + auto cells3D = cells.AsCellSet>(); cellDims = cells3D.GetCellDimensions(); vtkm::Id sz = cellDims[0] * cellDims[1] * cellDims[2]; canDo = CanStrip<3>(ghostField, invoke, removeAllGhost, removeType, range, cellDims, sz); @@ -310,9 +310,9 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellRemove::DoExecute( vtkm::cont::UnknownCellSet cellOut; //Preserve structured output where possible. - if (cells.IsSameType(vtkm::cont::CellSetStructured<1>()) || - cells.IsSameType(vtkm::cont::CellSetStructured<2>()) || - cells.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (cells.CanConvert>() || + cells.CanConvert>() || + cells.CanConvert>()) { vtkm::RangeId3 range; if (CanDoStructuredStrip( diff --git a/vtkm/filter/Lagrangian.hxx b/vtkm/filter/Lagrangian.hxx index b4662fbe5..260b63c7e 100644 --- a/vtkm/filter/Lagrangian.hxx +++ b/vtkm/filter/Lagrangian.hxx @@ -123,9 +123,10 @@ inline void Lagrangian::UpdateSeedResolution(const vtkm::cont::DataSet input) { vtkm::cont::UnknownCellSet cell_set = input.GetCellSet(); - if (cell_set.IsSameType(vtkm::cont::CellSetStructured<1>())) + if (cell_set.CanConvert>()) { - vtkm::cont::CellSetStructured<1> cell_set1 = cell_set.Cast>(); + vtkm::cont::CellSetStructured<1> cell_set1 = + cell_set.AsCellSet>(); vtkm::Id dims1 = cell_set1.GetPointDimensions(); this->SeedRes[0] = dims1; if (this->cust_res) @@ -133,9 +134,10 @@ inline void Lagrangian::UpdateSeedResolution(const vtkm::cont::DataSet input) this->SeedRes[0] = dims1 / this->x_res; } } - else if (cell_set.IsSameType(vtkm::cont::CellSetStructured<2>())) + else if (cell_set.CanConvert>()) { - vtkm::cont::CellSetStructured<2> cell_set2 = cell_set.Cast>(); + vtkm::cont::CellSetStructured<2> cell_set2 = + cell_set.AsCellSet>(); vtkm::Id2 dims2 = cell_set2.GetPointDimensions(); this->SeedRes[0] = dims2[0]; this->SeedRes[1] = dims2[1]; @@ -145,9 +147,10 @@ inline void Lagrangian::UpdateSeedResolution(const vtkm::cont::DataSet input) this->SeedRes[1] = dims2[1] / this->y_res; } } - else if (cell_set.IsSameType(vtkm::cont::CellSetStructured<3>())) + else if (cell_set.CanConvert>()) { - vtkm::cont::CellSetStructured<3> cell_set3 = cell_set.Cast>(); + vtkm::cont::CellSetStructured<3> cell_set3 = + cell_set.AsCellSet>(); vtkm::Id3 dims3 = cell_set3.GetPointDimensions(); this->SeedRes[0] = dims3[0]; this->SeedRes[1] = dims3[1]; diff --git a/vtkm/filter/ParticleDensityCloudInCell.hxx b/vtkm/filter/ParticleDensityCloudInCell.hxx index 1dca626c9..1070a5347 100644 --- a/vtkm/filter/ParticleDensityCloudInCell.hxx +++ b/vtkm/filter/ParticleDensityCloudInCell.hxx @@ -114,7 +114,7 @@ inline VTKM_CONT vtkm::cont::DataSet ParticleDensityCloudInCell::DoExecute( coords, field, locator, - uniform.GetCellSet().template Cast>(), + uniform.GetCellSet().template AsCellSet>(), density); if (DivideByVolume) diff --git a/vtkm/filter/ZFPCompressor2D.hxx b/vtkm/filter/ZFPCompressor2D.hxx index 4dc94ee19..7ecde6e6f 100644 --- a/vtkm/filter/ZFPCompressor2D.hxx +++ b/vtkm/filter/ZFPCompressor2D.hxx @@ -50,7 +50,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor2D::DoExecute( const vtkm::filter::PolicyBase&) { vtkm::cont::CellSetStructured<2> cellSet; - input.GetCellSet().CopyTo(cellSet); + input.GetCellSet().AsCellSet(cellSet); vtkm::Id2 pointDimensions = cellSet.GetPointDimensions(); diff --git a/vtkm/filter/ZFPCompressor3D.hxx b/vtkm/filter/ZFPCompressor3D.hxx index ab46e3abd..8bc14a407 100644 --- a/vtkm/filter/ZFPCompressor3D.hxx +++ b/vtkm/filter/ZFPCompressor3D.hxx @@ -50,7 +50,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor3D::DoExecute( const vtkm::filter::PolicyBase&) { vtkm::cont::CellSetStructured<3> cellSet; - input.GetCellSet().CopyTo(cellSet); + input.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); diff --git a/vtkm/filter/ZFPDecompressor2D.hxx b/vtkm/filter/ZFPDecompressor2D.hxx index 311df03b4..a3b3b915b 100644 --- a/vtkm/filter/ZFPDecompressor2D.hxx +++ b/vtkm/filter/ZFPDecompressor2D.hxx @@ -47,7 +47,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor2D::DoExecute( const vtkm::filter::PolicyBase&) { vtkm::cont::CellSetStructured<2> cellSet; - input.GetCellSet().CopyTo(cellSet); + input.GetCellSet().AsCellSet(cellSet); vtkm::Id2 pointDimensions = cellSet.GetPointDimensions(); vtkm::cont::ArrayHandle decompress; diff --git a/vtkm/filter/ZFPDecompressor3D.hxx b/vtkm/filter/ZFPDecompressor3D.hxx index 01ca44bf2..f2eb76654 100644 --- a/vtkm/filter/ZFPDecompressor3D.hxx +++ b/vtkm/filter/ZFPDecompressor3D.hxx @@ -46,7 +46,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor3D::DoExecute( const vtkm::filter::PolicyBase&) { vtkm::cont::CellSetStructured<3> cellSet; - input.GetCellSet().CopyTo(cellSet); + input.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); vtkm::cont::ArrayHandle decompress; diff --git a/vtkm/filter/testing/TestingContourTreeUniformDistributedFilter.h b/vtkm/filter/testing/TestingContourTreeUniformDistributedFilter.h index 5bf45490d..c41def4d0 100644 --- a/vtkm/filter/testing/TestingContourTreeUniformDistributedFilter.h +++ b/vtkm/filter/testing/TestingContourTreeUniformDistributedFilter.h @@ -162,8 +162,8 @@ inline vtkm::cont::DataSet CreateSubDataSet(const vtkm::cont::DataSet& ds, const std::string& fieldName) { vtkm::Id3 globalSize; - ds.GetCellSet().CastAndCall(vtkm::worklet::contourtree_augmented::GetPointDimensions(), - globalSize); + vtkm::cont::CastAndCall( + ds.GetCellSet(), vtkm::worklet::contourtree_augmented::GetPointDimensions(), globalSize); const vtkm::Id nOutValues = blockSize[0] * blockSize[1] * blockSize[2]; const auto inDataArrayHandle = ds.GetPointField(fieldName).GetData(); @@ -237,8 +237,8 @@ inline vtkm::cont::PartitionedDataSet RunContourTreeDUniformDistributed( { // Get dimensions of data set vtkm::Id3 globalSize; - ds.GetCellSet().CastAndCall(vtkm::worklet::contourtree_augmented::GetPointDimensions(), - globalSize); + vtkm::cont::CastAndCall( + ds.GetCellSet(), vtkm::worklet::contourtree_augmented::GetPointDimensions(), globalSize); // Determine split vtkm::Id3 blocksPerAxis = ComputeNumberOfBlocksPerAxis(globalSize, numberOfBlocks); diff --git a/vtkm/filter/testing/UnitTestCleanGrid.cxx b/vtkm/filter/testing/UnitTestCleanGrid.cxx index f6dddae72..1dd6b4cd3 100644 --- a/vtkm/filter/testing/UnitTestCleanGrid.cxx +++ b/vtkm/filter/testing/UnitTestCleanGrid.cxx @@ -32,7 +32,7 @@ void TestUniformGrid(vtkm::filter::CleanGrid clean) VTKM_TEST_ASSERT(outData.HasField("cellvar"), "Failed to map cell field"); vtkm::cont::CellSetExplicit<> outCellSet; - outData.GetCellSet().CopyTo(outCellSet); + outData.GetCellSet().AsCellSet(outCellSet); VTKM_TEST_ASSERT(outCellSet.GetNumberOfPoints() == 6, "Wrong number of points: ", outCellSet.GetNumberOfPoints()); diff --git a/vtkm/filter/testing/UnitTestContourFilter.cxx b/vtkm/filter/testing/UnitTestContourFilter.cxx index 0d5a262bc..06e720a5d 100644 --- a/vtkm/filter/testing/UnitTestContourFilter.cxx +++ b/vtkm/filter/testing/UnitTestContourFilter.cxx @@ -90,7 +90,7 @@ public: vtkm::cont::CoordinateSystem coords = result.GetCoordinateSystem(); vtkm::cont::UnknownCellSet dcells = result.GetCellSet(); using CellSetType = vtkm::cont::CellSetSingleType<>; - const CellSetType& cells = dcells.Cast(); + const CellSetType& cells = dcells.AsCellSet(); //verify that the number of points is correct (72) //verify that the number of cells is correct (160) @@ -115,7 +115,7 @@ public: vtkm::cont::UnknownCellSet dcells = result.GetCellSet(); using CellSetType = vtkm::cont::CellSetSingleType<>; - const CellSetType& cells = dcells.Cast(); + const CellSetType& cells = dcells.AsCellSet(); VTKM_TEST_ASSERT(cells.GetNumberOfCells() == 160, ""); } } @@ -153,7 +153,7 @@ public: vtkm::cont::DataSet dataSet = reader.ReadDataSet(); vtkm::cont::CellSetSingleType<> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::cont::ArrayHandle fieldArray; dataSet.GetPointField("gyroid").GetData().AsArrayHandle(fieldArray); diff --git a/vtkm/filter/testing/UnitTestExternalFacesFilter.cxx b/vtkm/filter/testing/UnitTestExternalFacesFilter.cxx index 7fbebb545..a1fe77088 100644 --- a/vtkm/filter/testing/UnitTestExternalFacesFilter.cxx +++ b/vtkm/filter/testing/UnitTestExternalFacesFilter.cxx @@ -64,7 +64,7 @@ void TestExternalFacesExplicitGrid(const vtkm::cont::DataSet& ds, // verify cellset vtkm::cont::CellSetExplicit<> new_cellSet = - resultds.GetCellSet().Cast>(); + resultds.GetCellSet().AsCellSet>(); const vtkm::Id numOutputExtFaces = new_cellSet.GetNumberOfCells(); VTKM_TEST_ASSERT(numOutputExtFaces == numExpectedExtFaces, "Number of External Faces mismatch"); diff --git a/vtkm/filter/testing/UnitTestGhostCellRemove.cxx b/vtkm/filter/testing/UnitTestGhostCellRemove.cxx index 1c1c3bc81..289fa29f4 100644 --- a/vtkm/filter/testing/UnitTestGhostCellRemove.cxx +++ b/vtkm/filter/testing/UnitTestGhostCellRemove.cxx @@ -193,14 +193,14 @@ static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id n { vtkm::Id2 dims(numI, numJ); MakeExplicitCells( - cellSet.Cast>(), dims, numIndices, shapes, conn); + cellSet.AsCellSet>(), dims, numIndices, shapes, conn); ds = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates"); } else if (cellSet.IsType>()) { vtkm::Id3 dims(numI, numJ, numK); MakeExplicitCells( - cellSet.Cast>(), dims, numIndices, shapes, conn); + cellSet.AsCellSet>(), dims, numIndices, shapes, conn); ds = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates"); } @@ -269,12 +269,12 @@ void TestGhostCellRemove() { if (nz == 0) { - VTKM_TEST_ASSERT(output.GetCellSet().IsSameType(vtkm::cont::CellSetStructured<2>()), + VTKM_TEST_ASSERT(output.GetCellSet().CanConvert>(), "Wrong cell type for explicit conversion"); } else if (nz > 0) { - VTKM_TEST_ASSERT(output.GetCellSet().IsSameType(vtkm::cont::CellSetStructured<3>()), + VTKM_TEST_ASSERT(output.GetCellSet().CanConvert>(), "Wrong cell type for explicit conversion"); } } diff --git a/vtkm/filter/testing/UnitTestImageMedianFilter.cxx b/vtkm/filter/testing/UnitTestImageMedianFilter.cxx index 312c5ace1..eed55f129 100644 --- a/vtkm/filter/testing/UnitTestImageMedianFilter.cxx +++ b/vtkm/filter/testing/UnitTestImageMedianFilter.cxx @@ -31,7 +31,7 @@ void TestImageMedian() vtkm::cont::ArrayHandle resultArrayHandle; result.GetPointField("median").GetData().AsArrayHandle(resultArrayHandle); - auto cells = result.GetCellSet().Cast>(); + auto cells = result.GetCellSet().AsCellSet>(); auto pdims = cells.GetPointDimensions(); //verified by hand diff --git a/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx b/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx index a39130512..84f347667 100644 --- a/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx +++ b/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx @@ -165,8 +165,8 @@ void TestSplitSharpEdgesFilterNoSplit(vtkm::cont::DataSet& simpleCubeWithSN, vtkm::cont::DataSet result = splitSharpEdgesFilter.Execute(simpleCubeWithSN); auto newCoords = result.GetCoordinateSystem().GetDataAsMultiplexer(); - vtkm::cont::CellSetExplicit<>& newCellset = - result.GetCellSet().Cast>(); + vtkm::cont::CellSetExplicit<> newCellset = + result.GetCellSet().AsCellSet>(); auto newCoordsP = newCoords.ReadPortal(); vtkm::cont::ArrayHandle newPointvarField; result.GetField("pointvar").GetData().AsArrayHandle(newPointvarField); diff --git a/vtkm/filter/testing/UnitTestStreamlineFilter.cxx b/vtkm/filter/testing/UnitTestStreamlineFilter.cxx index 0a341a19a..0d4e494b6 100644 --- a/vtkm/filter/testing/UnitTestStreamlineFilter.cxx +++ b/vtkm/filter/testing/UnitTestStreamlineFilter.cxx @@ -244,7 +244,7 @@ void TestAMRStreamline(bool useSL) //The seed that goes through the inner is broken up into two polylines //the begining, and then the end. VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == numSeeds + 1, "Wrong number of cells."); - auto explicitCells = dcells.Cast>(); + auto explicitCells = dcells.AsCellSet>(); for (vtkm::Id j = 0; j < numSeeds; j++) { vtkm::cont::ArrayHandle indices; @@ -277,7 +277,7 @@ void TestAMRStreamline(bool useSL) VTKM_TEST_ASSERT(dcells.IsType>(), "Wrong cell type."); VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == 1, "Wrong number of cells."); - explicitCells = dcells.Cast>(); + explicitCells = dcells.AsCellSet>(); vtkm::cont::ArrayHandle indices; explicitCells.GetIndices(0, indices); @@ -415,7 +415,7 @@ void TestPartitionedDataSet(vtkm::Id num, bool useGhost, FilterType fType) vtkm::cont::CellSetExplicit<> explicitCells; VTKM_TEST_ASSERT(dcells.IsType>(), "Wrong cell type."); - explicitCells = dcells.Cast>(); + explicitCells = dcells.AsCellSet>(); vtkm::FloatDefault xMax = static_cast(bounds[static_cast(i)].X.Max); @@ -566,13 +566,13 @@ void TestStreamlineFile(const std::string& fname, if (useSL) { VTKM_TEST_ASSERT(dcells.IsType>(), "Wrong cell type"); - auto cells = dcells.Cast>(); + auto cells = dcells.AsCellSet>(); ValidateEndPoints(cells, coords, numPoints, endPts); } else { VTKM_TEST_ASSERT(dcells.IsType>(), "Wrong cell type"); - auto cells = dcells.Cast>(); + auto cells = dcells.AsCellSet>(); ValidateEndPoints(cells, coords, numPoints, endPts); } } diff --git a/vtkm/filter/testing/UnitTestStreamlineFilterMPI.cxx b/vtkm/filter/testing/UnitTestStreamlineFilterMPI.cxx index e4519cd93..2eea19b94 100644 --- a/vtkm/filter/testing/UnitTestStreamlineFilterMPI.cxx +++ b/vtkm/filter/testing/UnitTestStreamlineFilterMPI.cxx @@ -185,7 +185,7 @@ void TestAMRStreamline(FilterType fType, bool useThreaded) //The seed that goes through the inner is broken up into two polylines //the begining, and then the end. VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == numSeeds + 1, "Wrong number of cells."); - auto explicitCells = dcells.Cast>(); + auto explicitCells = dcells.AsCellSet>(); for (vtkm::Id j = 0; j < numSeeds; j++) { vtkm::cont::ArrayHandle indices; @@ -222,7 +222,7 @@ void TestAMRStreamline(FilterType fType, bool useThreaded) VTKM_TEST_ASSERT(dcells.IsType>(), "Wrong cell type."); VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == 1, "Wrong number of cells."); - auto explicitCells = dcells.Cast>(); + auto explicitCells = dcells.AsCellSet>(); vtkm::cont::ArrayHandle indices; explicitCells.GetIndices(0, indices); @@ -291,7 +291,7 @@ void ValidateOutput(const vtkm::cont::DataSet& out, { vtkm::cont::CellSetExplicit<> explicitCells; VTKM_TEST_ASSERT(dcells.IsType>(), "Wrong cell type."); - explicitCells = dcells.Cast>(); + explicitCells = dcells.AsCellSet>(); for (vtkm::Id j = 0; j < numSeeds; j++) { vtkm::cont::ArrayHandle indices; diff --git a/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx b/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx index c0cfa7188..2c9c8e69c 100644 --- a/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx +++ b/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx @@ -52,7 +52,7 @@ void TestVertexClustering() { using CellSetType = vtkm::cont::CellSetSingleType<>; CellSetType cellSet; - output.GetCellSet().CopyTo(cellSet); + output.GetCellSet().AsCellSet(cellSet); auto cellArray = cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); std::cerr << "output_pointIds = " << cellArray.GetNumberOfValues() << "\n"; diff --git a/vtkm/io/ImageWriterBase.cxx b/vtkm/io/ImageWriterBase.cxx index 50fd54be3..c9360a0d4 100644 --- a/vtkm/io/ImageWriterBase.cxx +++ b/vtkm/io/ImageWriterBase.cxx @@ -39,7 +39,7 @@ void ImageWriterBase::WriteDataSet(const vtkm::cont::DataSet& dataSet, throw vtkm::cont::ErrorBadType( "Image writers can only write data sets with 2D structured data."); } - CellSetType cellSet = dataSet.GetCellSet().Cast(); + CellSetType cellSet = dataSet.GetCellSet().AsCellSet(); vtkm::Id2 cellDimensions = cellSet.GetCellDimensions(); // Number of points is one more in each dimension than number of cells vtkm::Id width = cellDimensions[0] + 1; diff --git a/vtkm/io/VTKDataSetWriter.cxx b/vtkm/io/VTKDataSetWriter.cxx index 6a10db2f0..359a4527f 100644 --- a/vtkm/io/VTKDataSetWriter.cxx +++ b/vtkm/io/VTKDataSetWriter.cxx @@ -520,32 +520,33 @@ void Write(std::ostream& out, const vtkm::cont::DataSet& dataSet, vtkm::io::File if (cellSet.IsType>()) { WriteDataSetAsUnstructured( - out, dataSet, cellSet.Cast>(), fileType); + out, dataSet, cellSet.AsCellSet>(), fileType); } else if (cellSet.IsType>()) { WriteDataSetAsStructured( - out, dataSet, cellSet.Cast>(), fileType); + out, dataSet, cellSet.AsCellSet>(), fileType); } else if (cellSet.IsType>()) { WriteDataSetAsStructured( - out, dataSet, cellSet.Cast>(), fileType); + out, dataSet, cellSet.AsCellSet>(), fileType); } else if (cellSet.IsType>()) { WriteDataSetAsStructured( - out, dataSet, cellSet.Cast>(), fileType); + out, dataSet, cellSet.AsCellSet>(), fileType); } else if (cellSet.IsType>()) { // these function just like explicit cell sets WriteDataSetAsUnstructured( - out, dataSet, cellSet.Cast>(), fileType); + out, dataSet, cellSet.AsCellSet>(), fileType); } else if (cellSet.IsType()) { - WriteDataSetAsUnstructured(out, dataSet, cellSet.Cast(), fileType); + WriteDataSetAsUnstructured( + out, dataSet, cellSet.AsCellSet(), fileType); } else { diff --git a/vtkm/rendering/Cylinderizer.h b/vtkm/rendering/Cylinderizer.h index 506aa3b71..93ce0c537 100644 --- a/vtkm/rendering/Cylinderizer.h +++ b/vtkm/rendering/Cylinderizer.h @@ -413,10 +413,10 @@ public: vtkm::cont::ArrayHandle& outputIndices, vtkm::Id& output) { - if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (cellset.CanConvert>()) { vtkm::cont::CellSetStructured<3> cellSetStructured3D = - cellset.Cast>(); + cellset.AsCellSet>(); const vtkm::Id numCells = cellSetStructured3D.GetNumberOfCells(); vtkm::cont::ArrayHandleCounting cellIdxs(0, 1, numCells); diff --git a/vtkm/rendering/MapperVolume.cxx b/vtkm/rendering/MapperVolume.cxx index e513bfc04..bd7ea0421 100644 --- a/vtkm/rendering/MapperVolume.cxx +++ b/vtkm/rendering/MapperVolume.cxx @@ -79,7 +79,7 @@ void MapperVolume::RenderCells(const vtkm::cont::UnknownCellSet& cellset, const vtkm::rendering::Camera& camera, const vtkm::Range& scalarRange) { - if (!cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (!cellset.CanConvert>()) { std::stringstream msg; std::string theType = typeid(cellset).name(); @@ -116,7 +116,7 @@ void MapperVolume::RenderCells(const vtkm::cont::UnknownCellSet& cellset, } tracer.SetData( - coords, scalarField, cellset.Cast>(), scalarRange); + coords, scalarField, cellset.AsCellSet>(), scalarRange); tracer.SetColorMap(this->ColorMap); tracer.Render(rays); diff --git a/vtkm/rendering/MapperWireframer.cxx b/vtkm/rendering/MapperWireframer.cxx index fc9cac116..d9b9d5bdd 100644 --- a/vtkm/rendering/MapperWireframer.cxx +++ b/vtkm/rendering/MapperWireframer.cxx @@ -238,8 +238,8 @@ void MapperWireframer::RenderCells(const vtkm::cont::UnknownCellSet& inCellSet, { vtkm::cont::UnknownCellSet cellSet = inCellSet; - bool is1D = cellSet.IsSameType(vtkm::cont::CellSetStructured<1>()); - bool is2D = cellSet.IsSameType(vtkm::cont::CellSetStructured<2>()); + bool is1D = cellSet.CanConvert>(); + bool is2D = cellSet.CanConvert>(); vtkm::cont::CoordinateSystem actualCoords = coords; vtkm::cont::Field actualField = inScalarField; @@ -285,9 +285,9 @@ void MapperWireframer::RenderCells(const vtkm::cont::UnknownCellSet& inCellSet, // Check for a cell set that is already lines // Since there is no need to de external faces or // render the depth of the mesh to hide internal zones - if (cellSet.IsSameType(vtkm::cont::CellSetSingleType<>())) + if (cellSet.CanConvert>()) { - auto singleType = cellSet.Cast>(); + auto singleType = cellSet.AsCellSet>(); isLines = singleType.GetCellShape(0) == vtkm::CELL_SHAPE_LINE; } diff --git a/vtkm/rendering/Quadralizer.h b/vtkm/rendering/Quadralizer.h index a91a2033b..f881ecfb3 100644 --- a/vtkm/rendering/Quadralizer.h +++ b/vtkm/rendering/Quadralizer.h @@ -305,10 +305,10 @@ public: { vtkm::cont::Invoker invoke; - if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (cellset.CanConvert>()) { vtkm::cont::CellSetStructured<3> cellSetStructured3D = - cellset.Cast>(); + cellset.AsCellSet>(); const vtkm::Id numCells = cellSetStructured3D.GetNumberOfCells(); vtkm::cont::ArrayHandleIndex cellIdxs(numCells); @@ -317,10 +317,10 @@ public: output = numCells * QUAD_PER_CSS; } - else if (cellset.IsSameType(vtkm::cont::CellSetStructured<2>())) + else if (cellset.CanConvert>()) { vtkm::cont::CellSetStructured<2> cellSetStructured2D = - cellset.Cast>(); + cellset.AsCellSet>(); const vtkm::Id numCells = cellSetStructured2D.GetNumberOfCells(); vtkm::cont::ArrayHandleIndex cellIdxs(numCells); diff --git a/vtkm/rendering/Triangulator.h b/vtkm/rendering/Triangulator.h index cabfef270..5e2b43e56 100644 --- a/vtkm/rendering/Triangulator.h +++ b/vtkm/rendering/Triangulator.h @@ -646,7 +646,7 @@ public: vtkm::Id& outputTriangles) { bool fastPath = false; - if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (cellset.CanConvert>()) { //vtkm::cont::CellSetStructured<3> cellSetStructured3D = // cellset.Cast>(); @@ -656,7 +656,7 @@ public: //outputTriangles = outputIndices.GetNumberOfValues(); //fastPath = true; vtkm::cont::CellSetStructured<3> cellSetStructured3D = - cellset.Cast>(); + cellset.AsCellSet>(); const vtkm::Id numCells = cellSetStructured3D.GetNumberOfCells(); vtkm::cont::ArrayHandleCounting cellIdxs(0, 1, numCells); @@ -666,10 +666,10 @@ public: outputTriangles = numCells * 12; } - else if (cellset.IsSameType(vtkm::cont::CellSetStructured<2>())) + else if (cellset.CanConvert>()) { vtkm::cont::CellSetStructured<2> cellSetStructured2D = - cellset.Cast>(); + cellset.AsCellSet>(); const vtkm::Id numCells = cellSetStructured2D.GetNumberOfCells(); vtkm::cont::ArrayHandleCounting cellIdxs(0, 1, numCells); diff --git a/vtkm/rendering/raytracing/CylinderExtractor.cxx b/vtkm/rendering/raytracing/CylinderExtractor.cxx index f5166224d..1e56296d9 100644 --- a/vtkm/rendering/raytracing/CylinderExtractor.cxx +++ b/vtkm/rendering/raytracing/CylinderExtractor.cxx @@ -253,9 +253,9 @@ void CylinderExtractor::SetCylinderIdsFromCells(const vtkm::cont::UnknownCellSet // // look for points in the cell set // - if (cells.IsSameType(vtkm::cont::CellSetExplicit<>())) + if (cells.CanConvert>()) { - auto cellsExplicit = cells.Cast>(); + auto cellsExplicit = cells.AsCellSet>(); vtkm::cont::ArrayHandle points; vtkm::worklet::DispatcherMapTopology(detail::CountSegments()) diff --git a/vtkm/rendering/raytracing/MeshConnectivityBuilder.cxx b/vtkm/rendering/raytracing/MeshConnectivityBuilder.cxx index caba1a84b..37a6a5a57 100644 --- a/vtkm/rendering/raytracing/MeshConnectivityBuilder.cxx +++ b/vtkm/rendering/raytracing/MeshConnectivityBuilder.cxx @@ -854,14 +854,15 @@ MeshConnectivityContainer* MeshConnectivityBuilder::BuildConnectivity( }; MeshType type = Unsupported; - if (cellset.IsSameType(vtkm::cont::CellSetExplicit<>())) + if (cellset.CanConvert>()) { type = Unstructured; } - else if (cellset.IsSameType(vtkm::cont::CellSetSingleType<>())) + else if (cellset.CanConvert>()) { - vtkm::cont::CellSetSingleType<> singleType = cellset.Cast>(); + vtkm::cont::CellSetSingleType<> singleType = + cellset.AsCellSet>(); // // Now we need to determine what type of cells this holds // @@ -877,7 +878,7 @@ MeshConnectivityContainer* MeshConnectivityBuilder::BuildConnectivity( if (shapeType == CELL_SHAPE_PYRAMID) type = UnstructuredSingle; } - else if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>())) + else if (cellset.CanConvert>()) { type = Structured; } @@ -897,21 +898,21 @@ MeshConnectivityContainer* MeshConnectivityBuilder::BuildConnectivity( if (type == Unstructured) { - vtkm::cont::CellSetExplicit<> cells = cellset.Cast>(); + vtkm::cont::CellSetExplicit<> cells = cellset.AsCellSet>(); this->BuildConnectivity(cells, coordinates.GetDataAsMultiplexer(), coordBounds); meshConn = new MeshConnectivityContainerUnstructured( cells, coordinates, FaceConnectivity, FaceOffsets, Triangles); } else if (type == UnstructuredSingle) { - vtkm::cont::CellSetSingleType<> cells = cellset.Cast>(); + vtkm::cont::CellSetSingleType<> cells = cellset.AsCellSet>(); this->BuildConnectivity(cells, coordinates.GetDataAsMultiplexer(), coordBounds); meshConn = new MeshConnectivityContainerSingleType(cells, coordinates, FaceConnectivity, Triangles); } else if (type == Structured) { - vtkm::cont::CellSetStructured<3> cells = cellset.Cast>(); + vtkm::cont::CellSetStructured<3> cells = cellset.AsCellSet>(); Triangles = this->ExternalTrianglesStructured(cells); meshConn = new MeshConnectivityContainerStructured(cells, coordinates, Triangles); } diff --git a/vtkm/rendering/raytracing/QuadExtractor.cxx b/vtkm/rendering/raytracing/QuadExtractor.cxx index 708e0f37b..8ec785eab 100644 --- a/vtkm/rendering/raytracing/QuadExtractor.cxx +++ b/vtkm/rendering/raytracing/QuadExtractor.cxx @@ -219,9 +219,9 @@ void QuadExtractor::SetQuadIdsFromCells(const vtkm::cont::UnknownCellSet& cells) // // look for points in the cell set // - if (cells.IsSameType(vtkm::cont::CellSetExplicit<>())) + if (cells.CanConvert>()) { - auto cellsExplicit = cells.Cast>(); + auto cellsExplicit = cells.AsCellSet>(); vtkm::cont::ArrayHandle points; vtkm::worklet::DispatcherMapTopology(detail::CountQuads()) diff --git a/vtkm/rendering/raytracing/SphereExtractor.cxx b/vtkm/rendering/raytracing/SphereExtractor.cxx index 7ec989292..34384004a 100644 --- a/vtkm/rendering/raytracing/SphereExtractor.cxx +++ b/vtkm/rendering/raytracing/SphereExtractor.cxx @@ -223,9 +223,9 @@ void SphereExtractor::SetPointIdsFromCells(const vtkm::cont::UnknownCellSet& cel // // look for points in the cell set // - if (cells.IsSameType(vtkm::cont::CellSetExplicit<>())) + if (cells.CanConvert>()) { - auto cellsExplicit = cells.Cast>(); + auto cellsExplicit = cells.AsCellSet>(); vtkm::cont::ArrayHandle points; vtkm::worklet::DispatcherMapTopology(detail::CountPoints()) @@ -241,9 +241,9 @@ void SphereExtractor::SetPointIdsFromCells(const vtkm::cont::UnknownCellSet& cel vtkm::worklet::DispatcherMapTopology(detail::Pointify()) .Invoke(cellsExplicit, cellOffsets, this->PointIds); } - else if (cells.IsSameType(SingleType())) + else if (cells.CanConvert()) { - SingleType pointCells = cells.Cast(); + SingleType pointCells = cells.AsCellSet(); vtkm::UInt8 shape_id = pointCells.GetCellShape(0); if (shape_id == vtkm::CELL_SHAPE_VERTEX) { diff --git a/vtkm/worklet/StreamLineUniformGrid.h b/vtkm/worklet/StreamLineUniformGrid.h index 51b5ed5fe..c4f304299 100644 --- a/vtkm/worklet/StreamLineUniformGrid.h +++ b/vtkm/worklet/StreamLineUniformGrid.h @@ -328,7 +328,7 @@ public: // Get information from input dataset vtkm::cont::CellSetStructured<3> inCellSet; - InDataSet.GetCellSet().CopyTo(inCellSet); + InDataSet.GetCellSet().AsCellSet(inCellSet); vtkm::Id3 vdims = inCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint()); vtkm::cont::ArrayHandle> fieldArray; diff --git a/vtkm/worklet/StreamSurface.h b/vtkm/worklet/StreamSurface.h index 1cc366b2a..a7fef872f 100644 --- a/vtkm/worklet/StreamSurface.h +++ b/vtkm/worklet/StreamSurface.h @@ -221,8 +221,8 @@ public: using ExplCoordsType = vtkm::cont::ArrayHandle; if (!(coords.GetData().IsType() && - (cellset.IsSameType(vtkm::cont::CellSetExplicit<>()) || - cellset.IsSameType(vtkm::cont::CellSetSingleType<>())))) + (cellset.CanConvert>() || + cellset.CanConvert>()))) { throw vtkm::cont::ErrorBadValue("Stream surface requires polyline data."); } diff --git a/vtkm/worklet/Tube.h b/vtkm/worklet/Tube.h index 7dbc46f67..17052bfde 100644 --- a/vtkm/worklet/Tube.h +++ b/vtkm/worklet/Tube.h @@ -544,8 +544,8 @@ public: { using NormalsType = vtkm::cont::ArrayHandle; - if (!cellset.IsSameType(vtkm::cont::CellSetExplicit<>()) && - !cellset.IsSameType(vtkm::cont::CellSetSingleType<>())) + if (!cellset.CanConvert>() && + !cellset.CanConvert>()) { throw vtkm::cont::ErrorBadValue("Tube filter only supported for polyline data."); } diff --git a/vtkm/worklet/lcs/GridMetaData.h b/vtkm/worklet/lcs/GridMetaData.h index 6a2df176d..9875fbb0d 100644 --- a/vtkm/worklet/lcs/GridMetaData.h +++ b/vtkm/worklet/lcs/GridMetaData.h @@ -26,18 +26,18 @@ public: VTKM_CONT GridMetaData(const vtkm::cont::UnknownCellSet cellSet) { - if (cellSet.IsType()) + if (cellSet.CanConvert()) { this->cellSet2D = true; vtkm::Id2 dims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagPoint()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagPoint()); this->Dims = vtkm::Id3(dims[0], dims[1], 1); } else { this->cellSet2D = false; this->Dims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagPoint()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagPoint()); } this->PlaneSize = Dims[0] * Dims[1]; this->RowSize = Dims[0]; diff --git a/vtkm/worklet/particleadvection/CellInterpolationHelper.h b/vtkm/worklet/particleadvection/CellInterpolationHelper.h index 43a6129f1..52534afbc 100644 --- a/vtkm/worklet/particleadvection/CellInterpolationHelper.h +++ b/vtkm/worklet/particleadvection/CellInterpolationHelper.h @@ -197,29 +197,29 @@ public: VTKM_CONT CellInterpolationHelper(const vtkm::cont::UnknownCellSet& cellSet) { - if (cellSet.IsSameType(Structured2DType())) + if (cellSet.CanConvert()) { this->Is3D = false; vtkm::Id2 cellDims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); vtkm::Id2 pointDims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagPoint()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagPoint()); this->CellDims = vtkm::Id3(cellDims[0], cellDims[1], 0); this->PointDims = vtkm::Id3(pointDims[0], pointDims[1], 1); this->Type = vtkm::exec::CellInterpolationHelper::HelperType::STRUCTURED; } - else if (cellSet.IsSameType(Structured3DType())) + else if (cellSet.CanConvert()) { this->Is3D = true; this->CellDims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); this->PointDims = - cellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagPoint()); + cellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagPoint()); this->Type = vtkm::exec::CellInterpolationHelper::HelperType::STRUCTURED; } - else if (cellSet.IsSameType(SingleExplicitType())) + else if (cellSet.CanConvert()) { - SingleExplicitType CellSet = cellSet.Cast(); + SingleExplicitType CellSet = cellSet.AsCellSet(); const auto cellShapes = CellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); const auto numIndices = @@ -230,9 +230,9 @@ public: vtkm::TopologyElementTagPoint()); this->Type = vtkm::exec::CellInterpolationHelper::HelperType::EXPSINGLE; } - else if (cellSet.IsSameType(ExplicitType())) + else if (cellSet.CanConvert()) { - vtkm::cont::CellSetExplicit<> CellSet = cellSet.Cast>(); + vtkm::cont::CellSetExplicit<> CellSet = cellSet.AsCellSet>(); Shape = CellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); Offset = diff --git a/vtkm/worklet/testing/GenerateTestDataSets.h b/vtkm/worklet/testing/GenerateTestDataSets.h index 3dbec54f9..ffe760ef6 100644 --- a/vtkm/worklet/testing/GenerateTestDataSets.h +++ b/vtkm/worklet/testing/GenerateTestDataSets.h @@ -152,14 +152,14 @@ inline vtkm::cont::DataSet CreateExplicitFromStructuredDataSet(const vtkm::Bound case ExplicitDataSetOption::SINGLE: if (cellSet.IsType()) { - Structured2DType cells2D = cellSet.Cast(); + Structured2DType cells2D = cellSet.AsCellSet(); vtkm::Id2 cellDims = cells2D.GetCellDimensions(); MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn); output = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates"); } else { - Structured3DType cells3D = cellSet.Cast(); + Structured3DType cells3D = cellSet.AsCellSet(); vtkm::Id3 cellDims = cells3D.GetCellDimensions(); MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn); output = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates"); @@ -176,14 +176,14 @@ inline vtkm::cont::DataSet CreateExplicitFromStructuredDataSet(const vtkm::Bound case ExplicitDataSetOption::EXPLICIT: if (cellSet.IsType()) { - Structured2DType cells2D = cellSet.Cast(); + Structured2DType cells2D = cellSet.AsCellSet(); vtkm::Id2 cellDims = cells2D.GetCellDimensions(); MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn); output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates"); } else { - Structured3DType cells3D = cellSet.Cast(); + Structured3DType cells3D = cellSet.AsCellSet(); vtkm::Id3 cellDims = cells3D.GetCellDimensions(); MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn); output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates"); diff --git a/vtkm/worklet/testing/UnitTestCellDeepCopy.cxx b/vtkm/worklet/testing/UnitTestCellDeepCopy.cxx index dee75d1b7..e7287a80f 100644 --- a/vtkm/worklet/testing/UnitTestCellDeepCopy.cxx +++ b/vtkm/worklet/testing/UnitTestCellDeepCopy.cxx @@ -25,7 +25,7 @@ vtkm::cont::CellSetExplicit<> CreateCellSet() vtkm::cont::testing::MakeTestDataSet makeData; vtkm::cont::DataSet data = makeData.Make3DExplicitDataSet0(); vtkm::cont::CellSetExplicit<> cellSet; - data.GetCellSet().CopyTo(cellSet); + data.GetCellSet().AsCellSet(cellSet); return cellSet; } diff --git a/vtkm/worklet/testing/UnitTestCellSetConnectivity.cxx b/vtkm/worklet/testing/UnitTestCellSetConnectivity.cxx index 63be18f06..ba99daddf 100644 --- a/vtkm/worklet/testing/UnitTestCellSetConnectivity.cxx +++ b/vtkm/worklet/testing/UnitTestCellSetConnectivity.cxx @@ -33,7 +33,7 @@ public: filter.SetActiveField("tangle"); vtkm::cont::DataSet outputData = filter.Execute(dataSet); - auto cellSet = outputData.GetCellSet().Cast>(); + auto cellSet = outputData.GetCellSet().AsCellSet>(); vtkm::cont::ArrayHandle componentArray; vtkm::worklet::connectivity::CellSetConnectivity().Run(cellSet, componentArray); @@ -48,7 +48,7 @@ public: { vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5(); - auto cellSet = dataSet.GetCellSet().Cast>(); + auto cellSet = dataSet.GetCellSet().AsCellSet>(); vtkm::cont::ArrayHandle componentArray; vtkm::worklet::connectivity::CellSetConnectivity().Run(cellSet, componentArray); diff --git a/vtkm/worklet/testing/UnitTestContour.cxx b/vtkm/worklet/testing/UnitTestContour.cxx index 5d2906fe6..7e2a3dd92 100644 --- a/vtkm/worklet/testing/UnitTestContour.cxx +++ b/vtkm/worklet/testing/UnitTestContour.cxx @@ -193,7 +193,7 @@ void TestContourUniformGrid() vtkm::cont::DataSet dataSet = genIds.Execute(tangle.Execute()); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::cont::ArrayHandle pointFieldArray; dataSet.GetField("tangle").GetData().AsArrayHandle(pointFieldArray); vtkm::cont::ArrayHandle cellFieldArray; @@ -310,7 +310,7 @@ void TestContourExplicit() vtkm::cont::DataSet dataSet = dataSetGenerator.Make3DRadiantDataSet(Dimension); DataSetGenerator::CellSet cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::cont::Field contourField = dataSet.GetField("distanceToOrigin"); DataSetGenerator::DataArrayHandle contourArray; @@ -377,7 +377,7 @@ void TestContourClipped() vtkm::cont::DataSet clipped = clip.Execute(dataSet); vtkm::cont::CellSetExplicit<> cellSet; - clipped.GetCellSet().CopyTo(cellSet); + clipped.GetCellSet().AsCellSet(cellSet); vtkm::cont::ArrayHandle pointFieldArray; clipped.GetField("tangle").GetData().AsArrayHandle(pointFieldArray); vtkm::cont::ArrayHandle cellFieldArray; diff --git a/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx b/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx index d54c02f91..2e85b5454 100644 --- a/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx +++ b/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx @@ -78,7 +78,7 @@ public: vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1(); vtkm::cont::CellSetStructured<2> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id2 pointDimensions = cellSet.GetPointDimensions(); vtkm::Id nRows = pointDimensions[0]; @@ -124,7 +124,7 @@ public: vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); vtkm::Id nRows = pointDimensions[0]; diff --git a/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx b/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx index 4d134e646..1bd8e064b 100644 --- a/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx +++ b/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx @@ -371,7 +371,7 @@ private: vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); @@ -719,7 +719,7 @@ public: vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1(); vtkm::cont::CellSetStructured<2> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id2 pointDimensions2D = cellSet.GetPointDimensions(); vtkm::Id3 meshSize{ pointDimensions2D[0], pointDimensions2D[1], 1 }; @@ -786,7 +786,7 @@ public: vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); @@ -859,7 +859,7 @@ public: vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1(); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); diff --git a/vtkm/worklet/testing/UnitTestExternalFaces.cxx b/vtkm/worklet/testing/UnitTestExternalFaces.cxx index cb1cabf3b..a2f43fb06 100644 --- a/vtkm/worklet/testing/UnitTestExternalFaces.cxx +++ b/vtkm/worklet/testing/UnitTestExternalFaces.cxx @@ -30,15 +30,16 @@ vtkm::cont::DataSet RunExternalFaces(vtkm::cont::DataSet& inDataSet) vtkm::cont::CellSetExplicit<> outCellSet; //Run the External Faces worklet - if (inCellSet.IsSameType(vtkm::cont::CellSetStructured<3>())) + if (inCellSet.CanConvert>()) { - vtkm::worklet::ExternalFaces().Run(inCellSet.Cast>(), + vtkm::worklet::ExternalFaces().Run(inCellSet.AsCellSet>(), inDataSet.GetCoordinateSystem(), outCellSet); } else { - vtkm::worklet::ExternalFaces().Run(inCellSet.Cast>(), outCellSet); + vtkm::worklet::ExternalFaces().Run(inCellSet.AsCellSet>(), + outCellSet); } vtkm::cont::DataSet outDataSet; @@ -97,7 +98,7 @@ void TestExternalFaces1() //Run the External Faces worklet vtkm::cont::DataSet new_ds = RunExternalFaces(ds); vtkm::cont::CellSetExplicit<> new_cs; - new_ds.GetCellSet().CopyTo(new_cs); + new_ds.GetCellSet().AsCellSet(new_cs); vtkm::Id numExtFaces_out = new_cs.GetNumberOfCells(); @@ -125,7 +126,7 @@ void TestExternalFaces2() vtkm::cont::DataSet outDataSet = RunExternalFaces(inDataSet); vtkm::cont::CellSetExplicit<> outCellSet; - outDataSet.GetCellSet().CopyTo(outCellSet); + outDataSet.GetCellSet().AsCellSet(outCellSet); VTKM_TEST_ASSERT(outCellSet.GetNumberOfCells() == NUM_FACES, "Got wrong number of faces."); @@ -168,7 +169,7 @@ void TestExternalFaces3() //Run the External Faces worklet vtkm::cont::DataSet new_ds = RunExternalFaces(dataSet); vtkm::cont::CellSetExplicit<> new_cs; - new_ds.GetCellSet().CopyTo(new_cs); + new_ds.GetCellSet().AsCellSet(new_cs); vtkm::Id numExtFaces_out = new_cs.GetNumberOfCells(); diff --git a/vtkm/worklet/testing/UnitTestExtractGeometry.cxx b/vtkm/worklet/testing/UnitTestExtractGeometry.cxx index 3e4153497..3a4106364 100644 --- a/vtkm/worklet/testing/UnitTestExtractGeometry.cxx +++ b/vtkm/worklet/testing/UnitTestExtractGeometry.cxx @@ -29,7 +29,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Cells to extract vtkm::cont::ArrayHandle cellIds = vtkm::cont::make_ArrayHandle({ 1, 2 }); @@ -60,7 +60,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Implicit function vtkm::Vec3f minPoint(0.5f, 0.0f, 0.0f); @@ -103,7 +103,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet1(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Cells to extract vtkm::cont::ArrayHandle cellIds = @@ -136,7 +136,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Cells to extract vtkm::cont::ArrayHandle cellIds = @@ -168,7 +168,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Implicit function vtkm::Vec3f minPoint(1.0f, 1.0f, 1.0f); @@ -208,7 +208,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Implicit function vtkm::Vec3f center(2.f, 2.f, 2.f); diff --git a/vtkm/worklet/testing/UnitTestExtractStructured.cxx b/vtkm/worklet/testing/UnitTestExtractStructured.cxx index 351e90075..de000e2a1 100644 --- a/vtkm/worklet/testing/UnitTestExtractStructured.cxx +++ b/vtkm/worklet/testing/UnitTestExtractStructured.cxx @@ -27,7 +27,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); // RangeId3 and subsample vtkm::RangeId3 range(1, 4, 1, 4, 0, 1); @@ -52,7 +52,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::worklet::ExtractStructured worklet; vtkm::worklet::ExtractStructured::UncertainCellSetStructured outCellSet; @@ -118,7 +118,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::worklet::ExtractStructured worklet; vtkm::worklet::ExtractStructured::UncertainCellSetStructured outCellSet; @@ -169,7 +169,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DRectilinearDataSet0(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); // RangeId3 and subsample vtkm::RangeId3 range(0, 2, 0, 2, 0, 1); @@ -195,7 +195,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DRectilinearDataSet0(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); // RangeId3 and subsample vtkm::RangeId3 range(0, 2, 0, 2, 0, 2); @@ -235,13 +235,14 @@ public: VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), no_offset)); vtkm::Id3 cellDims = - outCellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + outCellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); includeOffset = true; cellSet.SetGlobalPointIndexStart(test_offset); outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset); - cellDims = outCellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); - CellSetType cs = outCellSet.Cast(); + cellDims = + outCellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); + CellSetType cs = outCellSet.AsCellSet(); cellDims = cs.GetPointDimensions(); VTKM_TEST_ASSERT(test_equal(cellDims, new_dims)); VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), test_offset)); @@ -264,7 +265,7 @@ public: vtkm::worklet::ExtractStructured worklet; auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset); - CellSetType cs = outCellSet.Cast(); + CellSetType cs = outCellSet.AsCellSet(); vtkm::Id3 cellDims = cs.GetPointDimensions(); VTKM_TEST_ASSERT(test_equal(cellDims, test_dims)); VTKM_TEST_ASSERT(test_equal(cs.GetGlobalPointIndexStart(), test_offset)); @@ -284,7 +285,7 @@ public: vtkm::worklet::ExtractStructured worklet; auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset); - CellSetType cs = outCellSet.Cast(); + CellSetType cs = outCellSet.AsCellSet(); VTKM_TEST_ASSERT(test_equal(cs.GetPointDimensions(), test_dims)); } void TestOffset2D() const @@ -305,13 +306,14 @@ public: auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset); VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), no_offset)); vtkm::Id2 cellDims = - outCellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); + outCellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); // Test with offset now includeOffset = true; cellSet.SetGlobalPointIndexStart(test_offset); outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset); - cellDims = outCellSet.Cast().GetSchedulingRange(vtkm::TopologyElementTagCell()); - CellSetType cs = outCellSet.Cast(); + cellDims = + outCellSet.AsCellSet().GetSchedulingRange(vtkm::TopologyElementTagCell()); + CellSetType cs = outCellSet.AsCellSet(); cellDims = cs.GetPointDimensions(); VTKM_TEST_ASSERT(test_equal(cellDims, new_dims)); VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), test_offset)); diff --git a/vtkm/worklet/testing/UnitTestImageConnectivity.cxx b/vtkm/worklet/testing/UnitTestImageConnectivity.cxx index 3c1376b65..e42cb4b10 100644 --- a/vtkm/worklet/testing/UnitTestImageConnectivity.cxx +++ b/vtkm/worklet/testing/UnitTestImageConnectivity.cxx @@ -45,7 +45,7 @@ public: vtkm::cont::ArrayHandle component; vtkm::worklet::connectivity::ImageConnectivity().Run( - data.GetCellSet().Cast>(), + data.GetCellSet().AsCellSet>(), colorField.GetData().AsArrayHandle>(), component); @@ -79,7 +79,7 @@ public: vtkm::cont::ArrayHandle component; vtkm::worklet::connectivity::ImageConnectivity().Run( - data.GetCellSet().Cast>(), + data.GetCellSet().AsCellSet>(), colorField.GetData().AsArrayHandle>(), component); @@ -118,7 +118,7 @@ public: vtkm::cont::ArrayHandle component; vtkm::worklet::connectivity::ImageConnectivity().Run( - data.GetCellSet().Cast>(), + data.GetCellSet().AsCellSet>(), colorField.GetData().AsArrayHandle>(), component); diff --git a/vtkm/worklet/testing/UnitTestMask.cxx b/vtkm/worklet/testing/UnitTestMask.cxx index f2ee9dca4..e943789b2 100644 --- a/vtkm/worklet/testing/UnitTestMask.cxx +++ b/vtkm/worklet/testing/UnitTestMask.cxx @@ -36,7 +36,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet1(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Output data set permutation vtkm::worklet::Mask maskCells; @@ -62,7 +62,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Output data set with cell set permuted vtkm::worklet::Mask maskCells; @@ -89,7 +89,7 @@ public: // Input data set created vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5(); CellSetType cellSet; - dataset.GetCellSet().CopyTo(cellSet); + dataset.GetCellSet().AsCellSet(cellSet); // Output data set with cell set permuted vtkm::worklet::Mask maskCells; diff --git a/vtkm/worklet/testing/UnitTestOrientNormals.cxx b/vtkm/worklet/testing/UnitTestOrientNormals.cxx index c36a3838f..63cb60727 100644 --- a/vtkm/worklet/testing/UnitTestOrientNormals.cxx +++ b/vtkm/worklet/testing/UnitTestOrientNormals.cxx @@ -137,7 +137,7 @@ struct ValidateNormals const vtkm::cont::Field& pointNormalsField, const vtkm::cont::Field& cellNormalsField) : Coords{ dataset.GetCoordinateSystem() } - , Cells{ dataset.GetCellSet().Cast() } + , Cells{ dataset.GetCellSet().AsCellSet() } , Points{ this->Coords.GetDataAsMultiplexer() } , CheckPoints(checkPoints) , CheckCells(checkCells) diff --git a/vtkm/worklet/testing/UnitTestScatterAndMask.cxx b/vtkm/worklet/testing/UnitTestScatterAndMask.cxx index cc6ddb90a..a06c05d5a 100644 --- a/vtkm/worklet/testing/UnitTestScatterAndMask.cxx +++ b/vtkm/worklet/testing/UnitTestScatterAndMask.cxx @@ -103,7 +103,7 @@ void TestMapWorklet() vtkm::cont::DataSet data = builder.Make3DUniformDataSet1(); vtkm::cont::CellSetStructured<3> cellSet = - data.GetCellSet().Cast>(); + data.GetCellSet().AsCellSet>(); vtkm::Id numPoints = cellSet.GetNumberOfPoints(); vtkm::cont::ArrayHandle inField; diff --git a/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx b/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx index 9770388b5..e7f48f356 100644 --- a/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx +++ b/vtkm/worklet/testing/UnitTestScatterAndMaskWithTopology.cxx @@ -132,7 +132,7 @@ struct DoTestWorklet vtkm::cont::DataSet dataSet3D = testDataSet.Make3DUniformDataSet0(); vtkm::cont::CellSetStructured<3> cellSet = - dataSet3D.GetCellSet().Cast>(); + dataSet3D.GetCellSet().AsCellSet>(); vtkm::cont::Invoker invoker; invoker(WorkletType{}, cellSet, dataSet3D.GetCoordinateSystem()); @@ -153,7 +153,7 @@ struct DoTestWorklet std::vector(static_cast(dataSet3D.GetNumberOfPoints()), 0)); vtkm::cont::CellSetStructured<3> cellSet = - dataSet3D.GetCellSet().Cast>(); + dataSet3D.GetCellSet().AsCellSet>(); vtkm::cont::Invoker invoker; invoker(TestWorkletMapTopoSelect{}, diff --git a/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx b/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx index 3e949db75..3fa2204da 100644 --- a/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx +++ b/vtkm/worklet/testing/UnitTestStreamLineUniformGrid.cxx @@ -144,7 +144,7 @@ void TestStreamLineUniformGrid() // Check output vtkm::cont::CellSetExplicit<> outCellSet; - outDataSet.GetCellSet().CopyTo(outCellSet); + outDataSet.GetCellSet().AsCellSet(outCellSet); auto coordArray = outDataSet.GetCoordinateSystem(0).GetData(); vtkm::Id numberOfCells = outCellSet.GetNumberOfCells(); diff --git a/vtkm/worklet/testing/UnitTestTetrahedralize.cxx b/vtkm/worklet/testing/UnitTestTetrahedralize.cxx index 8d06f4421..c627be239 100644 --- a/vtkm/worklet/testing/UnitTestTetrahedralize.cxx +++ b/vtkm/worklet/testing/UnitTestTetrahedralize.cxx @@ -35,7 +35,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet0(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); // Convert uniform hexahedra to tetrahedra vtkm::worklet::Tetrahedralize tetrahedralize; @@ -63,7 +63,7 @@ public: // Create the input explicit cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DExplicitDataSet5(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::cont::ArrayHandle outCellsPerCell; // Convert explicit cells to tetrahedra diff --git a/vtkm/worklet/testing/UnitTestThreshold.cxx b/vtkm/worklet/testing/UnitTestThreshold.cxx index a3abb9445..e8f3e34f1 100644 --- a/vtkm/worklet/testing/UnitTestThreshold.cxx +++ b/vtkm/worklet/testing/UnitTestThreshold.cxx @@ -92,7 +92,7 @@ public: vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet0(); CellSetType cellset; - dataset.GetCellSet().CopyTo(cellset); + dataset.GetCellSet().AsCellSet(cellset); vtkm::cont::ArrayHandle pointvar; dataset.GetField("pointvar").GetData().AsArrayHandle(pointvar); @@ -152,7 +152,7 @@ public: vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet0(); CellSetType cellset; - dataset.GetCellSet().CopyTo(cellset); + dataset.GetCellSet().AsCellSet(cellset); vtkm::cont::ArrayHandle pointvar; dataset.GetField("pointvar").GetData().AsArrayHandle(pointvar); @@ -217,7 +217,7 @@ public: vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet0(); CellSetType cellset; - dataset.GetCellSet().CopyTo(cellset); + dataset.GetCellSet().AsCellSet(cellset); vtkm::cont::ArrayHandle cellvar; dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); diff --git a/vtkm/worklet/testing/UnitTestTriangleWinding.cxx b/vtkm/worklet/testing/UnitTestTriangleWinding.cxx index bfd9c347b..d331aec23 100644 --- a/vtkm/worklet/testing/UnitTestTriangleWinding.cxx +++ b/vtkm/worklet/testing/UnitTestTriangleWinding.cxx @@ -52,7 +52,7 @@ vtkm::cont::DataSet GenerateDataSet() void Validate(vtkm::cont::DataSet dataSet) { - const auto cellSet = dataSet.GetCellSet().Cast>(); + const auto cellSet = dataSet.GetCellSet().AsCellSet>(); const auto coordsArray = dataSet.GetCoordinateSystem().GetDataAsMultiplexer(); const auto conn = cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}); @@ -109,7 +109,7 @@ void DoTest() VTKM_TEST_ASSERT(threw, "Test dataset is already wound consistently wrt normals."); - auto cellSet = ds.GetCellSet().Cast>(); + auto cellSet = ds.GetCellSet().AsCellSet>(); const auto coords = ds.GetCoordinateSystem().GetData(); const auto cellNormalsVar = ds.GetCellField("normals").GetData(); const auto cellNormals = cellNormalsVar.AsArrayHandle>(); diff --git a/vtkm/worklet/testing/UnitTestTriangulate.cxx b/vtkm/worklet/testing/UnitTestTriangulate.cxx index 89b66b209..822a109ad 100644 --- a/vtkm/worklet/testing/UnitTestTriangulate.cxx +++ b/vtkm/worklet/testing/UnitTestTriangulate.cxx @@ -30,7 +30,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); // Convert uniform quadrilaterals to triangles vtkm::worklet::Triangulate triangulate; @@ -55,7 +55,7 @@ public: // Create the input uniform cell set vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DExplicitDataSet0(); CellSetType cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::cont::ArrayHandle outCellsPerCell; // Convert explicit cells to triangles diff --git a/vtkm/worklet/testing/UnitTestVertexClustering.cxx b/vtkm/worklet/testing/UnitTestVertexClustering.cxx index 6308b33d0..3e7efe77f 100644 --- a/vtkm/worklet/testing/UnitTestVertexClustering.cxx +++ b/vtkm/worklet/testing/UnitTestVertexClustering.cxx @@ -57,7 +57,7 @@ void TestVertexClustering() { using CellSetType = vtkm::cont::CellSetSingleType<>; CellSetType cellSet; - outDataSet.GetCellSet().CopyTo(cellSet); + outDataSet.GetCellSet().AsCellSet(cellSet); auto cellArray = cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()); std::cerr << "output_pointIds = " << cellArray.GetNumberOfValues() << "\n"; @@ -90,7 +90,7 @@ void TestVertexClustering() using CellSetType = vtkm::cont::CellSetSingleType<>; CellSetType cellSet; - outDataSet.GetCellSet().CopyTo(cellSet); + outDataSet.GetCellSet().AsCellSet(cellSet); VTKM_TEST_ASSERT( cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint()) .GetNumberOfValues() == output_pointIds, diff --git a/vtkm/worklet/testing/UnitTestWholeCellSetIn.cxx b/vtkm/worklet/testing/UnitTestWholeCellSetIn.cxx index e8ef4c927..0eec6df8b 100644 --- a/vtkm/worklet/testing/UnitTestWholeCellSetIn.cxx +++ b/vtkm/worklet/testing/UnitTestWholeCellSetIn.cxx @@ -187,7 +187,7 @@ void TryExplicitGrid() std::cout << "Testing explicit grid." << std::endl; vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5(); vtkm::cont::CellSetExplicit<> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::UInt8 expectedCellShapes[] = { vtkm::CELL_SHAPE_HEXAHEDRON, vtkm::CELL_SHAPE_PYRAMID, @@ -223,7 +223,7 @@ void TryCellSetPermutation() std::cout << "Testing permutation grid." << std::endl; vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5(); vtkm::cont::CellSetExplicit<> originalCellSet; - dataSet.GetCellSet().CopyTo(originalCellSet); + dataSet.GetCellSet().AsCellSet(originalCellSet); vtkm::Id permutationArray[] = { 2, 0, 1 }; @@ -255,7 +255,7 @@ void TryStructuredGrid3D() std::cout << "Testing 3D structured grid." << std::endl; vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DUniformDataSet0(); vtkm::cont::CellSetStructured<3> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id expectedCellIndexSum[4] = { 40, 48, 88, 96 }; @@ -285,7 +285,7 @@ void TryStructuredGrid2D() std::cout << "Testing 2D structured grid." << std::endl; vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make2DUniformDataSet0(); vtkm::cont::CellSetStructured<2> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id expectedCellIndexSum[2] = { 8, 12 }; @@ -314,7 +314,7 @@ void TryStructuredGrid1D() std::cout << "Testing 1D structured grid." << std::endl; vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make1DUniformDataSet0(); vtkm::cont::CellSetStructured<1> cellSet; - dataSet.GetCellSet().CopyTo(cellSet); + dataSet.GetCellSet().AsCellSet(cellSet); vtkm::Id expectedCellIndexSum[5] = { 1, 3, 5, 7, 9 }; diff --git a/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx b/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx index 1fbf9eaed..c30cf2e80 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx @@ -82,7 +82,7 @@ static void TestMaxPointOrCell() std::cout << "Testing MaxPointOfCell worklet" << std::endl; vtkm::cont::testing::MakeTestDataSet testDataSet; vtkm::cont::DataSet dataSet = testDataSet.Make3DExplicitDataSet0(); - auto cellset = dataSet.GetCellSet().Cast>(); + auto cellset = dataSet.GetCellSet().AsCellSet>(); vtkm::cont::ArrayHandle result;