From 8b133288cecb04cd50a29fdf276680c405b8abe4 Mon Sep 17 00:00:00 2001 From: Kenneth Moreland Date: Mon, 25 Jan 2021 10:36:56 -0700 Subject: [PATCH] Fix deprecation warnings There was an error that caused deprecation warnings in VTK-m to be suppressed, which meant that many uses of deprecated features went unnoticed. This fixes those deprecation warnings. The majority of the warnings were caused by the use of the deprecated `Cast`, `CopyTo`, and `ResetTypes` methods of `UnknownArrayHandle` (or `VariantArrayHandle`). Both `Cast` and `CopyTo` have been subsumed by `AsArrayHandle` (to make the functionality more clear). `ResetTypes` now requires a second template argument to define the storage types to try. Also fixed some issues with `SerializableField` being deprecated. This class is no longer necessary because `Field` can now be directly serialized. --- examples/contour_tree/ContourTreeMesh2D.cxx | 2 +- examples/contour_tree/ContourTreeMesh3D.cxx | 2 +- .../contour_tree_augmented/ContourTreeApp.cxx | 7 ++- examples/ising/Ising.cxx | 2 +- .../PolyLineArchimedeanHelix.cxx | 9 ++-- .../redistribute_points/RedistributePoints.h | 2 +- vtkm/cont/CellLocatorRectilinearGrid.cxx | 4 +- vtkm/cont/CellLocatorUniformGrid.cxx | 2 +- vtkm/cont/CoordinateSystem.cxx | 2 +- vtkm/cont/DataSet.h | 6 +-- vtkm/cont/testing/Testing.h | 15 ++---- .../TestingCellLocatorRectilinearGrid.h | 2 +- .../cont/testing/TestingCellLocatorTwoLevel.h | 2 +- .../testing/UnitTestPartitionedDataSet.cxx | 4 +- .../testing/UnitTestSerializationDataSet.cxx | 2 +- vtkm/filter/ContourTreeUniformAugmented.hxx | 4 +- vtkm/filter/ContourTreeUniformDistributed.hxx | 8 +++- vtkm/filter/FilterTraits.h | 8 ++++ vtkm/filter/Histogram.hxx | 3 +- vtkm/filter/ImageDifference.hxx | 3 +- vtkm/filter/PolicyBase.h | 34 ++++++++----- .../particleadvection/DataSetIntegrator.h | 5 +- .../testing/UnitTestCellAverageFilter.cxx | 8 ++-- .../testing/UnitTestCellMeasuresFilter.cxx | 4 +- .../UnitTestCellSetConnectivityFilter.cxx | 6 +-- vtkm/filter/testing/UnitTestCleanGrid.cxx | 4 +- .../testing/UnitTestClipWithFieldFilter.cxx | 2 +- vtkm/filter/testing/UnitTestContourFilter.cxx | 4 +- .../testing/UnitTestContourFilterNormals.cxx | 4 +- .../UnitTestContourTreeUniformFilter.cxx | 4 +- .../testing/UnitTestCrossProductFilter.cxx | 2 +- .../testing/UnitTestDotProductFilter.cxx | 2 +- vtkm/filter/testing/UnitTestEntropyFilter.cxx | 2 +- .../testing/UnitTestExtractGeometryFilter.cxx | 8 ++-- .../testing/UnitTestExtractPointsFilter.cxx | 4 +- .../UnitTestExtractStructuredFilter.cxx | 48 +++++++++---------- vtkm/filter/testing/UnitTestFieldToColors.cxx | 4 +- .../testing/UnitTestGhostCellClassify.cxx | 2 +- .../testing/UnitTestGradientExplicit.cxx | 4 +- .../testing/UnitTestGradientUniform.cxx | 4 +- .../testing/UnitTestHistogramFilter.cxx | 2 +- .../UnitTestImageConnectivityFilter.cxx | 2 +- .../testing/UnitTestImageDifferenceFilter.cxx | 4 +- .../testing/UnitTestImageMedianFilter.cxx | 2 +- .../UnitTestLagrangianStructuresFilter.cxx | 4 +- .../testing/UnitTestMapFieldMergeAverage.cxx | 2 +- .../testing/UnitTestMapFieldPermutation.cxx | 2 +- vtkm/filter/testing/UnitTestMaskFilter.cxx | 6 +-- .../testing/UnitTestMeshQualityFilter.cxx | 2 +- .../testing/UnitTestNDEntropyFilter.cxx | 2 +- .../testing/UnitTestNDHistogramFilter.cxx | 8 ++-- .../UnitTestPartitionedDataSetFilters.cxx | 4 +- ...tTestPartitionedDataSetHistogramFilter.cxx | 2 +- .../testing/UnitTestPointAverageFilter.cxx | 8 ++-- .../testing/UnitTestPointElevationFilter.cxx | 4 +- .../filter/testing/UnitTestPointTransform.cxx | 2 +- .../testing/UnitTestSplitSharpEdgesFilter.cxx | 4 +- .../testing/UnitTestSurfaceNormalsFilter.cxx | 4 +- .../testing/UnitTestTetrahedralizeFilter.cxx | 4 +- .../testing/UnitTestThresholdFilter.cxx | 8 ++-- .../testing/UnitTestThresholdPointsFilter.cxx | 6 +-- .../testing/UnitTestTriangulateFilter.cxx | 4 +- vtkm/filter/testing/UnitTestTubeFilter.cxx | 8 ++-- .../testing/UnitTestVectorMagnitudeFilter.cxx | 2 +- .../UnitTestVertexClusteringFilter.cxx | 5 +- .../testing/UnitTestWarpScalarFilter.cxx | 4 +- .../testing/UnitTestWarpVectorFilter.cxx | 2 +- vtkm/filter/testing/UnitTestZFP.cxx | 18 +++---- vtkm/io/ImageWriterBase.cxx | 2 +- vtkm/io/VTKDataSetWriter.cxx | 6 +-- vtkm/io/testing/UnitTestHDF5Image.cxx | 5 +- vtkm/io/testing/UnitTestImageWriter.cxx | 5 +- vtkm/io/testing/UnitTestVTKDataSetWriter.cxx | 6 +-- vtkm/source/testing/UnitTestTangleSource.cxx | 4 +- vtkm/source/testing/UnitTestWaveletSource.cxx | 2 +- vtkm/worklet/ExternalFaces.h | 4 +- vtkm/worklet/NDimsHistogram.h | 4 +- vtkm/worklet/PointMerge.h | 2 +- vtkm/worklet/StreamLineUniformGrid.h | 2 +- vtkm/worklet/StreamSurface.h | 2 +- .../contourtree_distributed/TreeCompiler.h | 15 ++++-- .../particleadvection/GridEvaluators.h | 2 +- vtkm/worklet/testing/UnitTestCellGradient.cxx | 6 +-- vtkm/worklet/testing/UnitTestClipping.cxx | 22 +++++---- vtkm/worklet/testing/UnitTestContour.cxx | 14 +++--- .../testing/UnitTestContourTreeUniform.cxx | 4 +- .../UnitTestContourTreeUniformAugmented.cxx | 8 ++-- vtkm/worklet/testing/UnitTestCosmoTools.cxx | 26 +++++----- .../testing/UnitTestExtractGeometry.cxx | 12 ++--- .../testing/UnitTestFieldHistogram.cxx | 8 ++-- .../testing/UnitTestFieldStatistics.cxx | 10 ++-- vtkm/worklet/testing/UnitTestMask.cxx | 6 +-- .../worklet/testing/UnitTestOrientNormals.cxx | 8 ++-- .../testing/UnitTestParticleAdvection.cxx | 5 +- .../worklet/testing/UnitTestPointGradient.cxx | 8 ++-- vtkm/worklet/testing/UnitTestProbe.cxx | 24 +++++----- .../testing/UnitTestSplitSharpEdges.cxx | 4 +- vtkm/worklet/testing/UnitTestThreshold.cxx | 10 ++-- .../testing/UnitTestThresholdPoints.cxx | 14 ++++-- .../testing/UnitTestTriangleWinding.cxx | 4 +- vtkm/worklet/testing/UnitTestTube.cxx | 11 +++-- .../testing/UnitTestVertexClustering.cxx | 6 +-- vtkm/worklet/testing/UnitTestWarpScalar.cxx | 6 ++- .../UnitTestWorkletMapPointNeighborhood.cxx | 18 +++---- .../UnitTestWorkletMapTopologyExplicit.cxx | 8 +++- .../UnitTestWorkletMapTopologyUniform.cxx | 8 +++- .../worklet/testing/UnitTestZFPCompressor.cxx | 12 ++--- 107 files changed, 373 insertions(+), 319 deletions(-) diff --git a/examples/contour_tree/ContourTreeMesh2D.cxx b/examples/contour_tree/ContourTreeMesh2D.cxx index 8962f9b4f..09af0ced8 100644 --- a/examples/contour_tree/ContourTreeMesh2D.cxx +++ b/examples/contour_tree/ContourTreeMesh2D.cxx @@ -112,7 +112,7 @@ int main(int argc, char* argv[]) vtkm::cont::Field resultField = output.GetField("saddlePeak"); ; vtkm::cont::ArrayHandle> saddlePeak; - resultField.GetData().CopyTo(saddlePeak); + resultField.GetData().AsArrayHandle(saddlePeak); return 0; } diff --git a/examples/contour_tree/ContourTreeMesh3D.cxx b/examples/contour_tree/ContourTreeMesh3D.cxx index e0be92fe6..9d4e4478c 100644 --- a/examples/contour_tree/ContourTreeMesh3D.cxx +++ b/examples/contour_tree/ContourTreeMesh3D.cxx @@ -113,7 +113,7 @@ int main(int argc, char* argv[]) vtkm::cont::Field resultField = output.GetField("saddlePeak"); vtkm::cont::ArrayHandle> saddlePeak; - resultField.GetData().CopyTo(saddlePeak); + resultField.GetData().AsArrayHandle(saddlePeak); return 0; } diff --git a/examples/contour_tree_augmented/ContourTreeApp.cxx b/examples/contour_tree_augmented/ContourTreeApp.cxx index d7085fb72..fcd71961c 100644 --- a/examples/contour_tree_augmented/ContourTreeApp.cxx +++ b/examples/contour_tree_augmented/ContourTreeApp.cxx @@ -762,14 +762,13 @@ int main(int argc, char* argv[]) if (numLevels > 0) // if compute isovalues { // Get the data values for computing the explicit branch decomposition -// TODO Can we cast the handle we get from GetData() instead of doing a CopyTo? #ifdef WITH_MPI vtkm::cont::ArrayHandle dataField; - result.GetPartitions()[0].GetField(0).GetData().CopyTo(dataField); + result.GetPartitions()[0].GetField(0).GetData().AsArrayHandle(dataField); bool dataFieldIsSorted = true; #else vtkm::cont::ArrayHandle dataField; - useDataSet.GetField(0).GetData().CopyTo(dataField); + useDataSet.GetField(0).GetData().AsArrayHandle(dataField); bool dataFieldIsSorted = false; #endif @@ -844,7 +843,7 @@ int main(int argc, char* argv[]) //vtkm::cont::Field resultField = result.GetField(); //vtkm::cont::ArrayHandle > saddlePeak; - //resultField.GetData().CopyTo(saddlePeak); + //resultField.GetData().AsArrayHandle(saddlePeak); // Dump out contour tree for comparison if (rank == 0 && printContourTree) diff --git a/examples/ising/Ising.cxx b/examples/ising/Ising.cxx index 8c44047ae..0b30110bd 100644 --- a/examples/ising/Ising.cxx +++ b/examples/ising/Ising.cxx @@ -96,7 +96,7 @@ int main(int argc, char** argv) auto dataSet = SpinField({ 5, 5 }); vtkm::cont::ArrayHandle spins; - dataSet.GetCellField("spins").GetData().CopyTo(spins); + dataSet.GetCellField("spins").GetData().AsArrayHandle(spins); vtkm::rendering::Scene scene; vtkm::rendering::Actor actor(dataSet.GetCellSet(), diff --git a/examples/polyline_archimedean_helix/PolyLineArchimedeanHelix.cxx b/examples/polyline_archimedean_helix/PolyLineArchimedeanHelix.cxx index 7cb48375b..96ccd0665 100644 --- a/examples/polyline_archimedean_helix/PolyLineArchimedeanHelix.cxx +++ b/examples/polyline_archimedean_helix/PolyLineArchimedeanHelix.cxx @@ -66,10 +66,11 @@ void TubeThatSpiral(vtkm::FloatDefault radius, vtkm::Id numLineSegments, vtkm::I // This generates a new pointset, and new cell set. vtkm::cont::ArrayHandle tubePoints; vtkm::cont::CellSetSingleType<> tubeCells; - tubeWorklet.Run(ds.GetCoordinateSystem().GetData().Cast>(), - ds.GetCellSet(), - tubePoints, - tubeCells); + tubeWorklet.Run( + ds.GetCoordinateSystem().GetData().AsArrayHandle>(), + ds.GetCellSet(), + tubePoints, + tubeCells); vtkm::cont::DataSet tubeDataset; tubeDataset.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", tubePoints)); diff --git a/examples/redistribute_points/RedistributePoints.h b/examples/redistribute_points/RedistributePoints.h index 70c97756a..1585849f3 100644 --- a/examples/redistribute_points/RedistributePoints.h +++ b/examples/redistribute_points/RedistributePoints.h @@ -100,7 +100,7 @@ class Redistributor vtkm::Id currentIdx) const { vtkm::cont::ArrayHandle farray = - field.GetData().template Cast>(); + field.GetData().template AsArrayHandle>(); vtkm::cont::Algorithm::CopySubRange(data, 0, data.GetNumberOfValues(), farray, currentIdx); } }; diff --git a/vtkm/cont/CellLocatorRectilinearGrid.cxx b/vtkm/cont/CellLocatorRectilinearGrid.cxx index 700f9581f..559df64d2 100644 --- a/vtkm/cont/CellLocatorRectilinearGrid.cxx +++ b/vtkm/cont/CellLocatorRectilinearGrid.cxx @@ -95,7 +95,7 @@ const vtkm::exec::CellLocator* CellLocatorRectilinearGrid::PrepareForExecution( this->PlaneSize, this->RowSize, this->GetCellSet().template Cast(), - this->GetCoordinates().GetData().template Cast()); + this->GetCoordinates().GetData().template AsArrayHandle()); } else { @@ -107,7 +107,7 @@ const vtkm::exec::CellLocator* CellLocatorRectilinearGrid::PrepareForExecution( this->PlaneSize, this->RowSize, this->GetCellSet().template Cast(), - this->GetCoordinates().GetData().template Cast()); + this->GetCoordinates().GetData().template AsArrayHandle()); } if (!success) { diff --git a/vtkm/cont/CellLocatorUniformGrid.cxx b/vtkm/cont/CellLocatorUniformGrid.cxx index c82f6b5b3..84c33d529 100644 --- a/vtkm/cont/CellLocatorUniformGrid.cxx +++ b/vtkm/cont/CellLocatorUniformGrid.cxx @@ -53,7 +53,7 @@ void CellLocatorUniformGrid::Build() throw vtkm::cont::ErrorBadType("Cells are not 2D or 3D structured type."); } - UniformType uniformCoords = coords.GetData().Cast(); + UniformType uniformCoords = coords.GetData().AsArrayHandle(); auto coordsPortal = uniformCoords.ReadPortal(); this->Origin = coordsPortal.GetOrigin(); diff --git a/vtkm/cont/CoordinateSystem.cxx b/vtkm/cont/CoordinateSystem.cxx index 35a7d61d8..d60b9ab44 100644 --- a/vtkm/cont/CoordinateSystem.cxx +++ b/vtkm/cont/CoordinateSystem.cxx @@ -72,7 +72,7 @@ CoordinateSystem::GetData() const VTKM_CONT vtkm::cont::CoordinateSystem::MultiplexerArrayType CoordinateSystem::GetDataAsMultiplexer() const { - return this->GetData().AsMultiplexer(); + return this->GetData().AsArrayHandle(); } VTKM_CONT diff --git a/vtkm/cont/DataSet.h b/vtkm/cont/DataSet.h index 38f0a1957..73ff6cb3e 100644 --- a/vtkm/cont/DataSet.h +++ b/vtkm/cont/DataSet.h @@ -338,7 +338,7 @@ public: vtkmdiy::save(bb, numberOfFields); for (vtkm::IdComponent i = 0; i < numberOfFields; ++i) { - vtkmdiy::save(bb, vtkm::cont::SerializableField(dataset.GetField(i))); + vtkmdiy::save(bb, dataset.GetField(i)); } } @@ -364,9 +364,9 @@ public: vtkmdiy::load(bb, numberOfFields); for (vtkm::IdComponent i = 0; i < numberOfFields; ++i) { - vtkm::cont::SerializableField field; + vtkm::cont::Field field; vtkmdiy::load(bb, field); - dataset.AddField(field.Field); + dataset.AddField(field); } } }; diff --git a/vtkm/cont/testing/Testing.h b/vtkm/cont/testing/Testing.h index db22a32ca..0e01e74ee 100644 --- a/vtkm/cont/testing/Testing.h +++ b/vtkm/cont/testing/Testing.h @@ -468,10 +468,8 @@ inline VTKM_CONT TestEqualResult test_equal_CellSets(const CellSet1& cellset1, return result; } -template inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1, - const vtkm::cont::Field& f2, - FieldTypeList fTtypes = FieldTypeList()) + const vtkm::cont::Field& f2) { TestEqualResult result; @@ -487,8 +485,7 @@ inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1, return result; } - result = - test_equal_ArrayHandles(f1.GetData().ResetTypes(fTtypes), f2.GetData().ResetTypes(fTtypes)); + result = test_equal_ArrayHandles(f1.GetData(), f2.GetData()); if (!result) { result.PushMessage("data doesn't match"); @@ -497,12 +494,10 @@ inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1, return result; } -template +template inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet& ds1, const vtkm::cont::DataSet& ds2, - CellSetTypes ctypes = CellSetTypes(), - FieldTypeList fTtypes = FieldTypeList()) + CellSetTypes ctypes = CellSetTypes()) { TestEqualResult result; if (ds1.GetNumberOfCoordinateSystems() != ds2.GetNumberOfCoordinateSystems()) @@ -537,7 +532,7 @@ inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet& } for (vtkm::IdComponent i = 0; i < ds1.GetNumberOfFields(); ++i) { - result = test_equal_Fields(ds1.GetField(i), ds2.GetField(i), fTtypes); + result = test_equal_Fields(ds1.GetField(i), ds2.GetField(i)); if (!result) { result.PushMessage(std::string("fields don't match at index ") + std::to_string(i)); diff --git a/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h b/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h index 1294985e6..1a4e41af1 100644 --- a/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h +++ b/vtkm/cont/testing/TestingCellLocatorRectilinearGrid.h @@ -185,7 +185,7 @@ public: vtkm::cont::ArrayHandle match; vtkm::cont::Token token; LocatorWorklet worklet( - bounds, dims, coords.GetData().template Cast(), token); + bounds, dims, coords.GetData().template AsArrayHandle(), token); vtkm::worklet::DispatcherMapField> dispatcher(worklet); dispatcher.SetDevice(DeviceAdapter()); diff --git a/vtkm/cont/testing/TestingCellLocatorTwoLevel.h b/vtkm/cont/testing/TestingCellLocatorTwoLevel.h index b8c73b36e..8aa9bdc1a 100644 --- a/vtkm/cont/testing/TestingCellLocatorTwoLevel.h +++ b/vtkm/cont/testing/TestingCellLocatorTwoLevel.h @@ -97,7 +97,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec& dims) std::uniform_real_distribution warpFactor(-0.10f, 0.10f); auto inPointsPortal = uniformDs.GetCoordinateSystem() .GetData() - .template Cast() + .template AsArrayHandle() .ReadPortal(); vtkm::cont::ArrayHandle points; points.Allocate(inPointsPortal.GetNumberOfValues()); diff --git a/vtkm/cont/testing/UnitTestPartitionedDataSet.cxx b/vtkm/cont/testing/UnitTestPartitionedDataSet.cxx index fc0ff56a0..38c7e0cf8 100644 --- a/vtkm/cont/testing/UnitTestPartitionedDataSet.cxx +++ b/vtkm/cont/testing/UnitTestPartitionedDataSet.cxx @@ -124,9 +124,9 @@ void DataSet_Compare(vtkm::cont::DataSet& leftDataSet, vtkm::cont::DataSet& righ for (vtkm::Id j = 0; j < leftDataSet.GetNumberOfFields(); j++) { vtkm::cont::ArrayHandle lDataArray; - leftDataSet.GetField(j).GetData().CopyTo(lDataArray); + leftDataSet.GetField(j).GetData().AsArrayHandle(lDataArray); vtkm::cont::ArrayHandle rDataArray; - rightDataSet.GetField(j).GetData().CopyTo(rDataArray); + rightDataSet.GetField(j).GetData().AsArrayHandle(rDataArray); VTKM_TEST_ASSERT(lDataArray == rDataArray, "field value info incorrect"); } return; diff --git a/vtkm/cont/testing/UnitTestSerializationDataSet.cxx b/vtkm/cont/testing/UnitTestSerializationDataSet.cxx index 80a755b33..4299688d6 100644 --- a/vtkm/cont/testing/UnitTestSerializationDataSet.cxx +++ b/vtkm/cont/testing/UnitTestSerializationDataSet.cxx @@ -26,7 +26,7 @@ using DataSetWrapper = vtkm::cont::SerializableDataSetGetActiveFieldName(), this->GetActiveFieldAssociation()); //const vtkm::cont::ArrayHandle &fieldData = currField.GetData().Cast >(); vtkm::cont::ArrayHandle fieldData; - vtkm::cont::ArrayCopy(currField.GetData().template ResetTypes>(), fieldData); + vtkm::cont::ArrayCopy( + currField.GetData().template ResetTypes, VTKM_DEFAULT_STORAGE_LIST>(), + fieldData); auto currContourTreeMesh = vtkm::worklet::contourtree_distributed::MultiBlockContourTreeHelper:: ComputeLocalContourTreeMesh( this->MultiBlockTreeHelper->MultiBlockSpatialDecomposition.LocalBlockOrigins.ReadPortal() diff --git a/vtkm/filter/ContourTreeUniformDistributed.hxx b/vtkm/filter/ContourTreeUniformDistributed.hxx index 445ee4d5a..7f0e90896 100644 --- a/vtkm/filter/ContourTreeUniformDistributed.hxx +++ b/vtkm/filter/ContourTreeUniformDistributed.hxx @@ -680,7 +680,9 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute( auto currField = currBlock.GetField(this->GetActiveFieldName(), this->GetActiveFieldAssociation()); vtkm::cont::ArrayHandle fieldData; - vtkm::cont::ArrayCopy(currField.GetData().ResetTypes(vtkm::List{}), fieldData); + vtkm::cont::ArrayCopy( + currField.GetData().ResetTypes(vtkm::List{}, VTKM_DEFAULT_STORAGE_LIST{}), + fieldData); // ... compute and store the actual mesh localDataBlocks[bi]->ContourTreeMeshes.emplace_back(this->LocalBoundaryTrees[bi].VertexIndex, @@ -914,7 +916,9 @@ VTKM_CONT void ContourTreeUniformDistributed::DoPostExecute( auto currField = currBlock.GetField(this->GetActiveFieldName(), this->GetActiveFieldAssociation()); vtkm::cont::ArrayHandle fieldData; - vtkm::cont::ArrayCopy(currField.GetData().ResetTypes(vtkm::List{}), fieldData); + vtkm::cont::ArrayCopy( + currField.GetData().ResetTypes(vtkm::List{}, VTKM_DEFAULT_STORAGE_LIST{}), + fieldData); auto localToGlobalIdRelabeler = vtkm::worklet::contourtree_augmented::mesh_dem::IdRelabeler( this->MultiBlockSpatialDecomposition.LocalBlockOrigins.ReadPortal().Get( blockData->BlockIndex), diff --git a/vtkm/filter/FilterTraits.h b/vtkm/filter/FilterTraits.h index 342ed85fe..f79f3d6b4 100644 --- a/vtkm/filter/FilterTraits.h +++ b/vtkm/filter/FilterTraits.h @@ -35,6 +35,14 @@ struct DeduceFilterFieldTypes using PList = typename DerivedPolicy::FieldTypeList; using TypeList = vtkm::ListIntersect; }; + +template +struct DeduceFilterFieldStorage +{ + using PList = typename DerivedPolicy::StorageList; + using StorageList = vtkm::ListAppend; +}; + } } diff --git a/vtkm/filter/Histogram.hxx b/vtkm/filter/Histogram.hxx index eda4dfa54..20bf1f76d 100644 --- a/vtkm/filter/Histogram.hxx +++ b/vtkm/filter/Histogram.hxx @@ -86,7 +86,8 @@ public: void SetLocalHistogram(vtkm::Id index, const vtkm::cont::Field& field) { - this->SetLocalHistogram(index, field.GetData().Cast>()); + this->SetLocalHistogram(index, + field.GetData().AsArrayHandle>()); } vtkm::cont::ArrayHandle ReduceAll() const diff --git a/vtkm/filter/ImageDifference.hxx b/vtkm/filter/ImageDifference.hxx index b8510bd68..74b579d63 100644 --- a/vtkm/filter/ImageDifference.hxx +++ b/vtkm/filter/ImageDifference.hxx @@ -89,8 +89,7 @@ inline VTKM_CONT vtkm::cont::DataSet ImageDifference::DoExecute( { VTKM_LOG_S(vtkm::cont::LogLevel::Info, "Not performing average"); primaryOutput = primary; - secondaryOutput = - secondaryField.GetData().template Cast>(); + secondaryField.GetData().AsArrayHandle(secondaryOutput); } if (this->PixelShiftRadius > 0) diff --git a/vtkm/filter/PolicyBase.h b/vtkm/filter/PolicyBase.h index dfc55df2a..f89f74a3e 100644 --- a/vtkm/filter/PolicyBase.h +++ b/vtkm/filter/PolicyBase.h @@ -201,10 +201,12 @@ using ArrayHandleMultiplexerForStorageList = vtkm::cont::ArrayHandleMultiplexerF /// passed to the `DoMapField` method of filters. /// template -VTKM_CONT vtkm::cont::VariantArrayHandleBase::value, - VTKM_DEFAULT_TYPE_LIST, - typename DerivedPolicy::FieldTypeList>::type> +VTKM_CONT vtkm::cont::UncertainArrayHandle< + typename std::conditional< + std::is_same::value, + VTKM_DEFAULT_TYPE_LIST, + typename DerivedPolicy::FieldTypeList>::type, + typename DerivedPolicy::StorageList> ApplyPolicyFieldNotActive(const vtkm::cont::Field& field, vtkm::filter::PolicyBase) { // Policies are on their way out, but until they are we want to respect them. In the mean @@ -213,7 +215,7 @@ ApplyPolicyFieldNotActive(const vtkm::cont::Field& field, vtkm::filter::PolicyBa std::is_same::value, VTKM_DEFAULT_TYPE_LIST, typename DerivedPolicy::FieldTypeList>::type; - return field.GetData().ResetTypes(TypeList()); + return field.GetData().ResetTypes(TypeList{}, typename DerivedPolicy::StorageList{}); } //----------------------------------------------------------------------------- @@ -235,7 +237,7 @@ ApplyPolicyFieldOfType(const vtkm::cont::Field& field, T, vtkm::ListAppend>; - return field.GetData().AsMultiplexer(); + return field.GetData().AsArrayHandle(); } //----------------------------------------------------------------------------- @@ -255,7 +257,10 @@ ApplyPolicyFieldActive(const vtkm::cont::Field& field, using FilterTypes = typename vtkm::filter::FilterTraits::InputFieldTypeList; using TypeList = typename vtkm::filter::DeduceFilterFieldTypes::TypeList; - return field.GetData().ResetTypes(TypeList()); + using FilterStorage = typename vtkm::filter::FilterTraits::AdditionalFieldStorage; + using StorageList = + typename vtkm::filter::DeduceFilterFieldStorage::StorageList; + return field.GetData().ResetTypes(TypeList{}, StorageList{}); } ////----------------------------------------------------------------------------- @@ -361,19 +366,26 @@ VTKM_CONT vtkm::cont::DynamicCellSetBase< } //----------------------------------------------------------------------------- +VTKM_DEPRECATED_SUPPRESS_BEGIN template -VTKM_CONT vtkm::cont::SerializableField - MakeSerializableField(vtkm::filter::PolicyBase) +VTKM_DEPRECATED(1.6, "MakeSerializableField is no longer needed.") +VTKM_CONT + vtkm::cont::SerializableField MakeSerializableField( + vtkm::filter::PolicyBase) { return {}; } template -VTKM_CONT vtkm::cont::SerializableField -MakeSerializableField(const vtkm::cont::Field& field, vtkm::filter::PolicyBase) +VTKM_DEPRECATED(1.6, "MakeSerializableField is no longer needed.") +VTKM_CONT + vtkm::cont::SerializableField MakeSerializableField( + const vtkm::cont::Field& field, + vtkm::filter::PolicyBase) { return vtkm::cont::SerializableField{ field }; } +VTKM_DEPRECATED_SUPPRESS_END template VTKM_DEPRECATED(1.6, "MakeSerializableDataSet now takes the filter as an argument.") diff --git a/vtkm/filter/particleadvection/DataSetIntegrator.h b/vtkm/filter/particleadvection/DataSetIntegrator.h index ae4aade8f..f54a43c15 100644 --- a/vtkm/filter/particleadvection/DataSetIntegrator.h +++ b/vtkm/filter/particleadvection/DataSetIntegrator.h @@ -44,9 +44,10 @@ public: FieldHandle fieldArray; if (fieldData.IsType()) - fieldArray = fieldData.Cast(); + fieldArray = fieldData.AsArrayHandle(); else - vtkm::cont::ArrayCopy(fieldData.ResetTypes(), fieldArray); + vtkm::cont::ArrayCopy( + fieldData.ResetTypes(), fieldArray); this->Eval = std::shared_ptr(new GridEvalType(ds, fieldArray)); } diff --git a/vtkm/filter/testing/UnitTestCellAverageFilter.cxx b/vtkm/filter/testing/UnitTestCellAverageFilter.cxx index 86490b8bd..6065094c4 100644 --- a/vtkm/filter/testing/UnitTestCellAverageFilter.cxx +++ b/vtkm/filter/testing/UnitTestCellAverageFilter.cxx @@ -30,7 +30,7 @@ void TestCellAverageRegular3D() VTKM_TEST_ASSERT(result.HasCellField("avgvals") == true, "Result field not present."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetCellField("avgvals").GetData().CopyTo(resultArrayHandle); + result.GetCellField("avgvals").GetData().AsArrayHandle(resultArrayHandle); { vtkm::Float32 expected[4] = { 60.1875f, 70.2125f, 120.3375f, 130.3625f }; for (vtkm::Id i = 0; i < 4; ++i) @@ -49,7 +49,7 @@ void TestCellAverageRegular3D() vtkm::cont::ArrayHandle resultPointArray; vtkm::cont::Field resultPointField = result.GetCellField("avgpos"); - resultPointField.GetData().CopyTo(resultPointArray); + resultPointField.GetData().AsArrayHandle(resultPointArray); { vtkm::FloatDefault expected[4][3] = { { 0.5f, 0.5f, 0.5f }, { 1.5f, 0.5f, 0.5f }, { 0.5f, 0.5f, 1.5f }, { 1.5f, 0.5f, 1.5f } @@ -81,7 +81,7 @@ void TestCellAverageRegular2D() vtkm::cont::Field resultField = result.GetCellField("pointvar"); vtkm::cont::ArrayHandle resultArrayHandle; - resultField.GetData().CopyTo(resultArrayHandle); + resultField.GetData().AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[2] = { 30.1f, 40.1f }; for (int i = 0; i < 2; ++i) { @@ -107,7 +107,7 @@ void TestCellAverageExplicit() vtkm::cont::ArrayHandle resultArrayHandle; vtkm::cont::Field resultField = result.GetCellField("pointvar"); - resultField.GetData().CopyTo(resultArrayHandle); + resultField.GetData().AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[2] = { 20.1333f, 35.2f }; for (int i = 0; i < 2; ++i) { diff --git a/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx b/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx index 267d6444b..7cbc90de6 100644 --- a/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx +++ b/vtkm/filter/testing/UnitTestCellMeasuresFilter.cxx @@ -60,7 +60,9 @@ void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset, "Output field could not be found or was improper."); vtkm::cont::CastAndCall( - result.ResetTypes(vtkm::TypeListFieldScalar{}), CheckCellMeasuresFunctor{}, expected); + result.ResetTypes(vtkm::TypeListFieldScalar{}, VTKM_DEFAULT_STORAGE_LIST{}), + CheckCellMeasuresFunctor{}, + expected); } void TestCellMeasures() diff --git a/vtkm/filter/testing/UnitTestCellSetConnectivityFilter.cxx b/vtkm/filter/testing/UnitTestCellSetConnectivityFilter.cxx index b647ac911..a6b6abe15 100644 --- a/vtkm/filter/testing/UnitTestCellSetConnectivityFilter.cxx +++ b/vtkm/filter/testing/UnitTestCellSetConnectivityFilter.cxx @@ -39,7 +39,7 @@ public: vtkm::cont::ArrayHandle componentArray; auto temp = output.GetField("component").GetData(); - temp.CopyTo(componentArray); + temp.AsArrayHandle(componentArray); using Algorithm = vtkm::cont::Algorithm; Algorithm::Sort(componentArray); @@ -57,7 +57,7 @@ public: vtkm::cont::ArrayHandle componentArray; auto temp = output.GetField("component").GetData(); - temp.CopyTo(componentArray); + temp.AsArrayHandle(componentArray); using Algorithm = vtkm::cont::Algorithm; Algorithm::Sort(componentArray); @@ -74,7 +74,7 @@ public: vtkm::cont::ArrayHandle componentArray; auto temp = output.GetField("component").GetData(); - temp.CopyTo(componentArray); + temp.AsArrayHandle(componentArray); using Algorithm = vtkm::cont::Algorithm; Algorithm::Sort(componentArray); diff --git a/vtkm/filter/testing/UnitTestCleanGrid.cxx b/vtkm/filter/testing/UnitTestCleanGrid.cxx index 6c98e7bc8..f6dddae72 100644 --- a/vtkm/filter/testing/UnitTestCleanGrid.cxx +++ b/vtkm/filter/testing/UnitTestCleanGrid.cxx @@ -45,7 +45,7 @@ void TestUniformGrid(vtkm::filter::CleanGrid clean) VTKM_TEST_ASSERT((cellIds == vtkm::Id4(1, 2, 5, 4)), "Bad cell ids: ", cellIds); vtkm::cont::ArrayHandle outPointField; - outData.GetField("pointvar").GetData().CopyTo(outPointField); + outData.GetField("pointvar").GetData().AsArrayHandle(outPointField); VTKM_TEST_ASSERT(outPointField.GetNumberOfValues() == 6, "Wrong point field size: ", outPointField.GetNumberOfValues()); @@ -57,7 +57,7 @@ void TestUniformGrid(vtkm::filter::CleanGrid clean) outPointField.ReadPortal().Get(1)); vtkm::cont::ArrayHandle outCellField; - outData.GetField("cellvar").GetData().CopyTo(outCellField); + outData.GetField("cellvar").GetData().AsArrayHandle(outCellField); VTKM_TEST_ASSERT(outCellField.GetNumberOfValues() == 2, "Wrong cell field size."); VTKM_TEST_ASSERT(test_equal(outCellField.ReadPortal().Get(0), 100.1), "Bad cell field value", diff --git a/vtkm/filter/testing/UnitTestClipWithFieldFilter.cxx b/vtkm/filter/testing/UnitTestClipWithFieldFilter.cxx index d8d8355c1..4de985e71 100644 --- a/vtkm/filter/testing/UnitTestClipWithFieldFilter.cxx +++ b/vtkm/filter/testing/UnitTestClipWithFieldFilter.cxx @@ -68,7 +68,7 @@ void TestClipExplicit() auto temp = outputData.GetField("scalars").GetData(); vtkm::cont::ArrayHandle resultArrayHandle; - temp.CopyTo(resultArrayHandle); + temp.AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[7] = { 1, 2, 1, 0, 0.5, 0.5, 0.5 }; for (int i = 0; i < 7; ++i) diff --git a/vtkm/filter/testing/UnitTestContourFilter.cxx b/vtkm/filter/testing/UnitTestContourFilter.cxx index 6a085fb59..28da182d0 100644 --- a/vtkm/filter/testing/UnitTestContourFilter.cxx +++ b/vtkm/filter/testing/UnitTestContourFilter.cxx @@ -61,7 +61,7 @@ public: //verify the cellvar result vtkm::cont::ArrayHandle cellFieldArrayOut; - result.GetField("cellvar").GetData().CopyTo(cellFieldArrayOut); + result.GetField("cellvar").GetData().AsArrayHandle(cellFieldArrayOut); vtkm::cont::Algorithm::Sort(cellFieldArrayOut); { @@ -151,7 +151,7 @@ public: dataSet.GetCellSet().CopyTo(cellSet); vtkm::cont::ArrayHandle fieldArray; - dataSet.GetPointField("gyroid").GetData().CopyTo(fieldArray); + dataSet.GetPointField("gyroid").GetData().AsArrayHandle(fieldArray); vtkm::worklet::Contour isosurfaceFilter; isosurfaceFilter.SetMergeDuplicatePoints(false); diff --git a/vtkm/filter/testing/UnitTestContourFilterNormals.cxx b/vtkm/filter/testing/UnitTestContourFilterNormals.cxx index b5993bf47..a6a45c1db 100644 --- a/vtkm/filter/testing/UnitTestContourFilterNormals.cxx +++ b/vtkm/filter/testing/UnitTestContourFilterNormals.cxx @@ -111,7 +111,7 @@ void TestNormals(const vtkm::cont::DataSet& dataset, bool structured) mc.SetActiveField("pointvar"); auto result = mc.Execute(dataset); - result.GetField("normals").GetData().CopyTo(normals); + result.GetField("normals").GetData().AsArrayHandle(normals); VTKM_TEST_ASSERT(normals.GetNumberOfValues() == numVerts, "Wrong number of values in normals field"); @@ -150,7 +150,7 @@ void TestNormals(const vtkm::cont::DataSet& dataset, bool structured) } result = mc.Execute(dataset); - result.GetField("normals").GetData().CopyTo(normals); + result.GetField("normals").GetData().AsArrayHandle(normals); VTKM_TEST_ASSERT(normals.GetNumberOfValues() == numVerts, "Wrong number of values in normals field"); diff --git a/vtkm/filter/testing/UnitTestContourTreeUniformFilter.cxx b/vtkm/filter/testing/UnitTestContourTreeUniformFilter.cxx index 11c5ee392..58e166cf6 100644 --- a/vtkm/filter/testing/UnitTestContourTreeUniformFilter.cxx +++ b/vtkm/filter/testing/UnitTestContourTreeUniformFilter.cxx @@ -87,7 +87,7 @@ public: vtkm::cont::Field Result = result.GetField("saddlePeak"); vtkm::cont::ArrayHandle> saddlePeak; - Result.GetData().CopyTo(saddlePeak); + Result.GetData().AsArrayHandle(saddlePeak); VTKM_TEST_ASSERT(test_equal(saddlePeak.GetNumberOfValues(), 7), "Wrong result for ContourTree filter"); @@ -126,7 +126,7 @@ public: vtkm::cont::Field Result = result.GetField("saddlePeak"); vtkm::cont::ArrayHandle> saddlePeak; - Result.GetData().CopyTo(saddlePeak); + Result.GetData().AsArrayHandle(saddlePeak); VTKM_TEST_ASSERT(test_equal(saddlePeak.GetNumberOfValues(), 9), "Wrong result for ContourTree filter"); diff --git a/vtkm/filter/testing/UnitTestCrossProductFilter.cxx b/vtkm/filter/testing/UnitTestCrossProductFilter.cxx index 8dbf4c0ae..6c7cef858 100644 --- a/vtkm/filter/testing/UnitTestCrossProductFilter.cxx +++ b/vtkm/filter/testing/UnitTestCrossProductFilter.cxx @@ -79,7 +79,7 @@ void CheckResult(const vtkm::cont::ArrayHandle& field1, VTKM_TEST_ASSERT(result.HasPointField("crossproduct"), "Output field is missing."); vtkm::cont::ArrayHandle outputArray; - result.GetPointField("crossproduct").GetData().CopyTo(outputArray); + result.GetPointField("crossproduct").GetData().AsArrayHandle(outputArray); auto v1Portal = field1.ReadPortal(); auto v2Portal = field2.ReadPortal(); diff --git a/vtkm/filter/testing/UnitTestDotProductFilter.cxx b/vtkm/filter/testing/UnitTestDotProductFilter.cxx index ef311223a..f94434928 100644 --- a/vtkm/filter/testing/UnitTestDotProductFilter.cxx +++ b/vtkm/filter/testing/UnitTestDotProductFilter.cxx @@ -79,7 +79,7 @@ void CheckResult(const vtkm::cont::ArrayHandle& field1, VTKM_TEST_ASSERT(result.HasPointField("dotproduct"), "Output field is missing."); vtkm::cont::ArrayHandle outputArray; - result.GetPointField("dotproduct").GetData().CopyTo(outputArray); + result.GetPointField("dotproduct").GetData().AsArrayHandle(outputArray); auto v1Portal = field1.ReadPortal(); auto v2Portal = field2.ReadPortal(); diff --git a/vtkm/filter/testing/UnitTestEntropyFilter.cxx b/vtkm/filter/testing/UnitTestEntropyFilter.cxx index 4a3b8ec6e..f54663819 100644 --- a/vtkm/filter/testing/UnitTestEntropyFilter.cxx +++ b/vtkm/filter/testing/UnitTestEntropyFilter.cxx @@ -33,7 +33,7 @@ void TestEntropy() ///// get entropy from resultEntropy ///// vtkm::cont::ArrayHandle entropy; - resultEntropy.GetField("entropy").GetData().CopyTo(entropy); + resultEntropy.GetField("entropy").GetData().AsArrayHandle(entropy); vtkm::cont::ArrayHandle::ReadPortalType portal = entropy.ReadPortal(); vtkm::Float64 entropyFromFilter = portal.Get(0); diff --git a/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx b/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx index c4689e31b..f0901faf2 100644 --- a/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx +++ b/vtkm/filter/testing/UnitTestExtractGeometryFilter.cxx @@ -42,7 +42,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8), "Wrong result for ExtractGeometry"); vtkm::cont::ArrayHandle outCellData; - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 21.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(7) == 42.f, "Wrong cell field data"); @@ -69,7 +69,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 56), "Wrong result for ExtractGeometry"); vtkm::cont::ArrayHandle outCellData; - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 0.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(55) == 63.f, "Wrong cell field data"); @@ -96,7 +96,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 64), "Wrong result for ExtractGeometry"); vtkm::cont::ArrayHandle outCellData; - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 0.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(63) == 63.f, "Wrong cell field data"); @@ -122,7 +122,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 56), "Wrong result for ExtractGeometry"); vtkm::cont::ArrayHandle outCellData; - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(0) == 0.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outCellData.ReadPortal().Get(55) == 63.f, "Wrong cell field data"); diff --git a/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx b/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx index ac082cd94..1db88dc8a 100644 --- a/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx +++ b/vtkm/filter/testing/UnitTestExtractPointsFilter.cxx @@ -41,7 +41,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 27), "Wrong result for ExtractPoints"); vtkm::cont::ArrayHandle outPointData; - output.GetField("pointvar").GetData().CopyTo(outPointData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -71,7 +71,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 98), "Wrong result for ExtractPoints"); vtkm::cont::ArrayHandle outPointData; - output.GetField("pointvar").GetData().CopyTo(outPointData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), diff --git a/vtkm/filter/testing/UnitTestExtractStructuredFilter.cxx b/vtkm/filter/testing/UnitTestExtractStructuredFilter.cxx index d5f15693b..aeb37dc37 100644 --- a/vtkm/filter/testing/UnitTestExtractStructuredFilter.cxx +++ b/vtkm/filter/testing/UnitTestExtractStructuredFilter.cxx @@ -41,9 +41,9 @@ public: "Wrong result for ExtractStructured worklet"); vtkm::cont::ArrayHandle outPointData; - output.GetField("pointvar").GetData().CopyTo(outPointData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); vtkm::cont::ArrayHandle outCellData; - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -78,8 +78,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -116,8 +116,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -153,8 +153,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -190,8 +190,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -228,8 +228,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -266,8 +266,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -304,8 +304,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -342,8 +342,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -379,8 +379,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -418,8 +418,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), @@ -455,8 +455,8 @@ public: vtkm::cont::ArrayHandle outPointData; vtkm::cont::ArrayHandle outCellData; - output.GetField("pointvar").GetData().CopyTo(outPointData); - output.GetField("cellvar").GetData().CopyTo(outCellData); + output.GetField("pointvar").GetData().AsArrayHandle(outPointData); + output.GetField("cellvar").GetData().AsArrayHandle(outCellData); VTKM_TEST_ASSERT( test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()), diff --git a/vtkm/filter/testing/UnitTestFieldToColors.cxx b/vtkm/filter/testing/UnitTestFieldToColors.cxx index a82ea83d9..8bcec5df8 100644 --- a/vtkm/filter/testing/UnitTestFieldToColors.cxx +++ b/vtkm/filter/testing/UnitTestFieldToColors.cxx @@ -40,7 +40,7 @@ void TestFieldToColors() VTKM_TEST_ASSERT(rgbaResult.HasPointField("colors"), "Field missing."); vtkm::cont::Field Result = rgbaResult.GetPointField("colors"); vtkm::cont::ArrayHandle resultRGBAHandle; - Result.GetData().CopyTo(resultRGBAHandle); + Result.GetData().AsArrayHandle(resultRGBAHandle); //values confirmed with ParaView 5.4 const vtkm::Vec4ui_8 correct_diverging_rgba_values[nvals] = { @@ -61,7 +61,7 @@ void TestFieldToColors() VTKM_TEST_ASSERT(rgbResult.HasPointField("colors"), "Field missing."); Result = rgbResult.GetPointField("colors"); vtkm::cont::ArrayHandle resultRGBHandle; - Result.GetData().CopyTo(resultRGBHandle); + Result.GetData().AsArrayHandle(resultRGBHandle); //values confirmed with ParaView 5.4 const vtkm::Vec3ui_8 correct_diverging_rgb_values[nvals] = { { 0, 0, 255 }, { 59, 76, 192 }, diff --git a/vtkm/filter/testing/UnitTestGhostCellClassify.cxx b/vtkm/filter/testing/UnitTestGhostCellClassify.cxx index 0b1f35de4..491574591 100644 --- a/vtkm/filter/testing/UnitTestGhostCellClassify.cxx +++ b/vtkm/filter/testing/UnitTestGhostCellClassify.cxx @@ -114,7 +114,7 @@ void TestStructured() //Check the number of normal cells. vtkm::cont::ArrayHandle ghostArray; - fieldArray.CopyTo(ghostArray); + fieldArray.AsArrayHandle(ghostArray); vtkm::Id numNormalCells = 0; auto portal = ghostArray.ReadPortal(); diff --git a/vtkm/filter/testing/UnitTestGradientExplicit.cxx b/vtkm/filter/testing/UnitTestGradientExplicit.cxx index 88899631d..4d9b251fc 100644 --- a/vtkm/filter/testing/UnitTestGradientExplicit.cxx +++ b/vtkm/filter/testing/UnitTestGradientExplicit.cxx @@ -32,7 +32,7 @@ void TestCellGradientExplicit() VTKM_TEST_ASSERT(result.HasCellField("gradient"), "Result field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetCellField("gradient").GetData().CopyTo(resultArrayHandle); + result.GetCellField("gradient").GetData().AsArrayHandle(resultArrayHandle); vtkm::Vec3f_32 expected[2] = { { 10.f, 10.1f, 0.0f }, { 10.f, 10.1f, -0.0f } }; for (int i = 0; i < 2; ++i) { @@ -58,7 +58,7 @@ void TestPointGradientExplicit() VTKM_TEST_ASSERT(result.HasPointField("gradient"), "Result field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("gradient").GetData().CopyTo(resultArrayHandle); + result.GetPointField("gradient").GetData().AsArrayHandle(resultArrayHandle); vtkm::Vec3f_32 expected[2] = { { 10.f, 10.1f, 0.0f }, { 10.f, 10.1f, 0.0f } }; for (int i = 0; i < 2; ++i) diff --git a/vtkm/filter/testing/UnitTestGradientUniform.cxx b/vtkm/filter/testing/UnitTestGradientUniform.cxx index 5ad028bd6..77e31274e 100644 --- a/vtkm/filter/testing/UnitTestGradientUniform.cxx +++ b/vtkm/filter/testing/UnitTestGradientUniform.cxx @@ -81,7 +81,7 @@ void TestCellGradientUniform3DWithVectorField() "vec gradients should generate qcriterion"); vtkm::cont::ArrayHandle> resultArrayHandle; - result.GetCellField("vec_gradient").GetData().CopyTo(resultArrayHandle); + result.GetCellField("vec_gradient").GetData().AsArrayHandle(resultArrayHandle); vtkm::Vec expected[4] = { { { 10.025, 10.025, 10.025 }, { 30.075, 30.075, 30.075 }, { 60.125, 60.125, 60.125 } }, { { 10.025, 10.025, 10.025 }, { 30.075, 30.075, 30.075 }, { 60.125, 60.125, 60.125 } }, @@ -133,7 +133,7 @@ void TestPointGradientUniform3DWithVectorField() VTKM_TEST_ASSERT(result.HasPointField("vec_gradient"), "Result field missing."); vtkm::cont::ArrayHandle> resultArrayHandle; - result.GetPointField("vec_gradient").GetData().CopyTo(resultArrayHandle); + result.GetPointField("vec_gradient").GetData().AsArrayHandle(resultArrayHandle); vtkm::Vec expected[4] = { { { 10.0, 10.0, 10.0 }, { 30.0, 30.0, 30.0 }, { 60.1, 60.1, 60.1 } }, { { 10.0, 10.0, 10.0 }, { 30.1, 30.1, 30.1 }, { 60.1, 60.1, 60.1 } }, diff --git a/vtkm/filter/testing/UnitTestHistogramFilter.cxx b/vtkm/filter/testing/UnitTestHistogramFilter.cxx index 286dc039c..5074a9554 100644 --- a/vtkm/filter/testing/UnitTestHistogramFilter.cxx +++ b/vtkm/filter/testing/UnitTestHistogramFilter.cxx @@ -262,7 +262,7 @@ void VerifyHistogram(const vtkm::cont::DataSet& result, VTKM_TEST_ASSERT(result.HasField("histogram"), "Output field missing"); vtkm::cont::ArrayHandle bins; - result.GetField("histogram").GetData().CopyTo(bins); + result.GetField("histogram").GetData().AsArrayHandle(bins); vtkm::cont::ArrayHandle::ReadPortalType binPortal = bins.ReadPortal(); diff --git a/vtkm/filter/testing/UnitTestImageConnectivityFilter.cxx b/vtkm/filter/testing/UnitTestImageConnectivityFilter.cxx index 740861907..a2113b579 100644 --- a/vtkm/filter/testing/UnitTestImageConnectivityFilter.cxx +++ b/vtkm/filter/testing/UnitTestImageConnectivityFilter.cxx @@ -46,7 +46,7 @@ void TestImageConnectivity() auto temp = outputData.GetField("component").GetData(); vtkm::cont::ArrayHandle resultArrayHandle; - temp.CopyTo(resultArrayHandle); + temp.AsArrayHandle(resultArrayHandle); std::vector componentExpected = { 0, 1, 1, 1, 0, 1, 1, 2, 0, 0, 0, 1, 0, 1, 1, 2, 0, 1, 1, 0, 0, 1, 1, 2, 0, 1, 0, 0, 0, 1, 1, 2, diff --git a/vtkm/filter/testing/UnitTestImageDifferenceFilter.cxx b/vtkm/filter/testing/UnitTestImageDifferenceFilter.cxx index c19a6f93b..f5b4d25af 100644 --- a/vtkm/filter/testing/UnitTestImageDifferenceFilter.cxx +++ b/vtkm/filter/testing/UnitTestImageDifferenceFilter.cxx @@ -45,8 +45,8 @@ void CheckResult(const std::vector& expectedDiff, vtkm::cont::ArrayHandle outputArray; vtkm::cont::ArrayHandle thresholdArray; - output.GetPointField("image-diff").GetData().CopyTo(outputArray); - output.GetPointField("threshold-output").GetData().CopyTo(thresholdArray); + output.GetPointField("image-diff").GetData().AsArrayHandle(outputArray); + output.GetPointField("threshold-output").GetData().AsArrayHandle(thresholdArray); VTKM_TEST_ASSERT(outputArray.GetNumberOfValues() == static_cast(expectedDiff.size()), "Field sizes wrong"); diff --git a/vtkm/filter/testing/UnitTestImageMedianFilter.cxx b/vtkm/filter/testing/UnitTestImageMedianFilter.cxx index e3ea1e22d..ac41e9a80 100644 --- a/vtkm/filter/testing/UnitTestImageMedianFilter.cxx +++ b/vtkm/filter/testing/UnitTestImageMedianFilter.cxx @@ -29,7 +29,7 @@ void TestImageMedian() VTKM_TEST_ASSERT(result.HasPointField("median"), "Field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("median").GetData().CopyTo(resultArrayHandle); + result.GetPointField("median").GetData().AsArrayHandle(resultArrayHandle); auto cells = result.GetCellSet().Cast>(); auto pdims = cells.GetPointDimensions(); diff --git a/vtkm/filter/testing/UnitTestLagrangianStructuresFilter.cxx b/vtkm/filter/testing/UnitTestLagrangianStructuresFilter.cxx index 264f08f53..316161e77 100644 --- a/vtkm/filter/testing/UnitTestLagrangianStructuresFilter.cxx +++ b/vtkm/filter/testing/UnitTestLagrangianStructuresFilter.cxx @@ -343,7 +343,7 @@ void Test2DLCS() vtkm::cont::DataSet outputData = lagrangianStructures.Execute(inputData); vtkm::cont::ArrayHandle FTLEField; - outputData.GetField("FTLE").GetData().CopyTo(FTLEField); + outputData.GetField("FTLE").GetData().AsArrayHandle(FTLEField); auxiliary::ValidateLCSFilterResult(FTLEField, visitHandle, diffHandle); } @@ -387,7 +387,7 @@ void Test3DLCS() vtkm::cont::DataSet outputData = lagrangianStructures.Execute(input); vtkm::cont::ArrayHandle FTLEField; - outputData.GetField("FTLE").GetData().CopyTo(FTLEField); + outputData.GetField("FTLE").GetData().AsArrayHandle(FTLEField); auxiliary::ValidateLCSFilterResult(FTLEField, visitHandle, diffHandle); } } diff --git a/vtkm/filter/testing/UnitTestMapFieldMergeAverage.cxx b/vtkm/filter/testing/UnitTestMapFieldMergeAverage.cxx index eac7f8ba2..c82c23aaf 100644 --- a/vtkm/filter/testing/UnitTestMapFieldMergeAverage.cxx +++ b/vtkm/filter/testing/UnitTestMapFieldMergeAverage.cxx @@ -94,7 +94,7 @@ void TryArray(const vtkm::cont::ArrayHandle& inputArray) VTKM_TEST_ASSERT(outputField.GetName() == "my-array"); vtkm::cont::ArrayHandle outputArray; - outputField.GetData().CopyTo(outputArray); + outputField.GetData().AsArrayHandle(outputArray); std::cout << "Actual output" << std::endl; vtkm::cont::printSummary_ArrayHandle(outputArray, std::cout); diff --git a/vtkm/filter/testing/UnitTestMapFieldPermutation.cxx b/vtkm/filter/testing/UnitTestMapFieldPermutation.cxx index c71e78de0..837f9203e 100644 --- a/vtkm/filter/testing/UnitTestMapFieldPermutation.cxx +++ b/vtkm/filter/testing/UnitTestMapFieldPermutation.cxx @@ -57,7 +57,7 @@ void TryArray(const vtkm::cont::ArrayHandle& inputArray) VTKM_TEST_ASSERT(outputField.GetName() == "my-array"); vtkm::cont::ArrayHandle outputArray; - outputField.GetData().CopyTo(outputArray); + outputField.GetData().AsArrayHandle(outputArray); std::cout << "Actual output" << std::endl; vtkm::cont::printSummary_ArrayHandle(outputArray, std::cout); diff --git a/vtkm/filter/testing/UnitTestMaskFilter.cxx b/vtkm/filter/testing/UnitTestMaskFilter.cxx index 178c090e8..ac05c2850 100644 --- a/vtkm/filter/testing/UnitTestMaskFilter.cxx +++ b/vtkm/filter/testing/UnitTestMaskFilter.cxx @@ -37,7 +37,7 @@ public: vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 8 && cellFieldArray.ReadPortal().Get(7) == 14.f, @@ -58,7 +58,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 7), "Wrong result for Mask"); vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 7 && cellFieldArray.ReadPortal().Get(2) == 18.f, @@ -79,7 +79,7 @@ public: VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 2), "Wrong result for Mask"); vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 2 && cellFieldArray.ReadPortal().Get(1) == 120.2f, diff --git a/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx b/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx index 0dacdc00a..f3448077d 100644 --- a/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx +++ b/vtkm/filter/testing/UnitTestMeshQualityFilter.cxx @@ -123,7 +123,7 @@ bool TestMeshQualityFilter(const vtkm::cont::DataSet& input, //Test the computed metric values (for all cells) and expected metric //values for equality. vtkm::cont::ArrayHandle values; - output.GetField(outputname).GetData().CopyTo(values); + output.GetField(outputname).GetData().AsArrayHandle(values); auto portal1 = values.ReadPortal(); if (portal1.GetNumberOfValues() != (vtkm::Id)expectedVals.size()) { diff --git a/vtkm/filter/testing/UnitTestNDEntropyFilter.cxx b/vtkm/filter/testing/UnitTestNDEntropyFilter.cxx index cf7784580..0fe67abe0 100644 --- a/vtkm/filter/testing/UnitTestNDEntropyFilter.cxx +++ b/vtkm/filter/testing/UnitTestNDEntropyFilter.cxx @@ -189,7 +189,7 @@ void RunTest() vtkm::cont::DataSet outputData = ndEntropyFilter.Execute(ds); vtkm::cont::ArrayHandle entropyHandle; - outputData.GetField("Entropy").GetData().CopyTo(entropyHandle); + outputData.GetField("Entropy").GetData().AsArrayHandle(entropyHandle); vtkm::Float64 e = entropyHandle.WritePortal().Get(0); VTKM_TEST_ASSERT(fabs(e - 7.457857) < 0.001, diff --git a/vtkm/filter/testing/UnitTestNDHistogramFilter.cxx b/vtkm/filter/testing/UnitTestNDHistogramFilter.cxx index 971e8cbb4..e368377a3 100644 --- a/vtkm/filter/testing/UnitTestNDHistogramFilter.cxx +++ b/vtkm/filter/testing/UnitTestNDHistogramFilter.cxx @@ -95,13 +95,13 @@ void RunTest() VTKM_TEST_ASSERT(nonSparseBins == gtNonSparseBins, "Incorrect ND-histogram Filter results"); vtkm::cont::ArrayHandle binId0; - outputData.GetField("fieldA").GetData().CopyTo(binId0); + outputData.GetField("fieldA").GetData().AsArrayHandle(binId0); vtkm::cont::ArrayHandle binId1; - outputData.GetField("fieldB").GetData().CopyTo(binId1); + outputData.GetField("fieldB").GetData().AsArrayHandle(binId1); vtkm::cont::ArrayHandle binId2; - outputData.GetField("fieldC").GetData().CopyTo(binId2); + outputData.GetField("fieldC").GetData().AsArrayHandle(binId2); vtkm::cont::ArrayHandle freqs; - outputData.GetField("Frequency").GetData().CopyTo(freqs); + outputData.GetField("Frequency").GetData().AsArrayHandle(freqs); for (int i = 0; i < nonSparseBins; i++) { vtkm::Id idx0 = binId0.WritePortal().Get(i); diff --git a/vtkm/filter/testing/UnitTestPartitionedDataSetFilters.cxx b/vtkm/filter/testing/UnitTestPartitionedDataSetFilters.cxx index 398a36b51..b908790f1 100644 --- a/vtkm/filter/testing/UnitTestPartitionedDataSetFilters.cxx +++ b/vtkm/filter/testing/UnitTestPartitionedDataSetFilters.cxx @@ -89,9 +89,9 @@ void Result_Verify(const vtkm::cont::PartitionedDataSet& result, "result vectors' size incorrect"); vtkm::cont::ArrayHandle partitionArray; - result.GetPartition(j).GetField(outputFieldName).GetData().CopyTo(partitionArray); + result.GetPartition(j).GetField(outputFieldName).GetData().AsArrayHandle(partitionArray); vtkm::cont::ArrayHandle sDataSetArray; - partitionResult.GetField(outputFieldName).GetData().CopyTo(sDataSetArray); + partitionResult.GetField(outputFieldName).GetData().AsArrayHandle(sDataSetArray); const vtkm::Id numValues = result.GetPartition(j).GetField(outputFieldName).GetNumberOfValues(); for (vtkm::Id i = 0; i < numValues; i++) diff --git a/vtkm/filter/testing/UnitTestPartitionedDataSetHistogramFilter.cxx b/vtkm/filter/testing/UnitTestPartitionedDataSetHistogramFilter.cxx index 19fc1bfb4..4423e3281 100644 --- a/vtkm/filter/testing/UnitTestPartitionedDataSetHistogramFilter.cxx +++ b/vtkm/filter/testing/UnitTestPartitionedDataSetHistogramFilter.cxx @@ -110,7 +110,7 @@ static void TestPartitionedDataSetHistogram() auto bins = result.GetPartition(0) .GetField("histogram") .GetData() - .Cast>(); + .AsArrayHandle>(); VTKM_TEST_ASSERT(bins.GetNumberOfValues() == 10, "Expecting 10 bins."); auto binsPortal = bins.ReadPortal(); auto count = std::accumulate(vtkm::cont::ArrayPortalToIteratorBegin(binsPortal), diff --git a/vtkm/filter/testing/UnitTestPointAverageFilter.cxx b/vtkm/filter/testing/UnitTestPointAverageFilter.cxx index f63517624..7f024fa3d 100644 --- a/vtkm/filter/testing/UnitTestPointAverageFilter.cxx +++ b/vtkm/filter/testing/UnitTestPointAverageFilter.cxx @@ -29,7 +29,7 @@ void TestPointAverageUniform3D() VTKM_TEST_ASSERT(result.HasPointField("avgvals"), "Field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("avgvals").GetData().CopyTo(resultArrayHandle); + result.GetPointField("avgvals").GetData().AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[18] = { 100.1f, 100.15f, 100.2f, 100.1f, 100.15f, 100.2f, 100.2f, 100.25f, 100.3f, 100.2f, 100.25f, 100.3f, 100.3f, 100.35f, 100.4f, 100.3f, 100.35f, 100.4f }; @@ -55,7 +55,7 @@ void TestPointAverageRegular3D() VTKM_TEST_ASSERT(result.HasPointField("cellvar"), "Field missing."); vtkm::cont::Field Result = result.GetPointField("cellvar"); vtkm::cont::ArrayHandle resultArrayHandle; - Result.GetData().CopyTo(resultArrayHandle); + Result.GetData().AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[18] = { 0.f, 0.5f, 1.f, 0.f, 0.5f, 1.f, 1.f, 1.5f, 2.f, 1.f, 1.5f, 2.f, 2.f, 2.5f, 3.f, 2.f, 2.5f, 3.f }; @@ -80,7 +80,7 @@ void TestPointAverageExplicit1() // If no name is given, should have the same name as the input. VTKM_TEST_ASSERT(result.HasPointField("cellvar"), "Field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("cellvar").GetData().CopyTo(resultArrayHandle); + result.GetPointField("cellvar").GetData().AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[5] = { 100.1f, 100.15f, 100.15f, 100.2f, 100.2f }; for (int i = 0; i < 5; ++i) { @@ -103,7 +103,7 @@ void TestPointAverageExplicit2() // If no name is given, should have the same name as the input. VTKM_TEST_ASSERT(result.HasPointField("cellvar"), "Field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("cellvar").GetData().CopyTo(resultArrayHandle); + result.GetPointField("cellvar").GetData().AsArrayHandle(resultArrayHandle); vtkm::Float32 expected[11] = { 100.1f, 105.05f, 105.05f, 100.1f, 115.3f, 115.2f, 115.2f, 115.3f, 115.1f, 130.5f, 125.35f }; for (int i = 0; i < 11; ++i) diff --git a/vtkm/filter/testing/UnitTestPointElevationFilter.cxx b/vtkm/filter/testing/UnitTestPointElevationFilter.cxx index 2f4fa1c6d..1c98e6cd5 100644 --- a/vtkm/filter/testing/UnitTestPointElevationFilter.cxx +++ b/vtkm/filter/testing/UnitTestPointElevationFilter.cxx @@ -75,7 +75,7 @@ void TestPointElevationNoPolicy() VTKM_TEST_ASSERT(result.HasPointField("height"), "Output field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("height").GetData().CopyTo(resultArrayHandle); + result.GetPointField("height").GetData().AsArrayHandle(resultArrayHandle); auto coordinates = inputData.GetCoordinateSystem().GetDataAsMultiplexer(); auto coordsPortal = coordinates.ReadPortal(); auto resultPortal = resultArrayHandle.ReadPortal(); @@ -106,7 +106,7 @@ void TestPointElevationWithPolicy() VTKM_TEST_ASSERT(result.HasPointField("elevation"), "Output field has wrong association"); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("elevation").GetData().CopyTo(resultArrayHandle); + result.GetPointField("elevation").GetData().AsArrayHandle(resultArrayHandle); auto coordinates = inputData.GetCoordinateSystem().GetDataAsMultiplexer(); auto coordsPortal = coordinates.ReadPortal(); auto resultPortal = resultArrayHandle.ReadPortal(); diff --git a/vtkm/filter/testing/UnitTestPointTransform.cxx b/vtkm/filter/testing/UnitTestPointTransform.cxx index 768468688..727dd7d8b 100644 --- a/vtkm/filter/testing/UnitTestPointTransform.cxx +++ b/vtkm/filter/testing/UnitTestPointTransform.cxx @@ -72,7 +72,7 @@ void ValidatePointTransform(const vtkm::cont::CoordinateSystem& coords, vtkm::cont::ArrayHandle resultArrayHandle; result.GetField(fieldName, vtkm::cont::Field::Association::POINTS) .GetData() - .CopyTo(resultArrayHandle); + .AsArrayHandle(resultArrayHandle); auto outPointsArrayHandle = result.GetCoordinateSystem().GetDataAsMultiplexer(); diff --git a/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx b/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx index 30b216276..0ccc9b469 100644 --- a/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx +++ b/vtkm/filter/testing/UnitTestSplitSharpEdgesFilter.cxx @@ -134,7 +134,7 @@ void TestSplitSharpEdgesFilterSplitEveryEdge(vtkm::cont::DataSet& simpleCubeWith auto newCoords = result.GetCoordinateSystem().GetDataAsMultiplexer(); auto newCoordsP = newCoords.ReadPortal(); vtkm::cont::ArrayHandle newPointvarField; - result.GetField("pointvar").GetData().CopyTo(newPointvarField); + result.GetField("pointvar").GetData().AsArrayHandle(newPointvarField); for (vtkm::IdComponent i = 0; i < newCoords.GetNumberOfValues(); i++) { @@ -169,7 +169,7 @@ void TestSplitSharpEdgesFilterNoSplit(vtkm::cont::DataSet& simpleCubeWithSN, result.GetCellSet().Cast>(); auto newCoordsP = newCoords.ReadPortal(); vtkm::cont::ArrayHandle newPointvarField; - result.GetField("pointvar").GetData().CopyTo(newPointvarField); + result.GetField("pointvar").GetData().AsArrayHandle(newPointvarField); for (vtkm::IdComponent i = 0; i < newCoords.GetNumberOfValues(); i++) { diff --git a/vtkm/filter/testing/UnitTestSurfaceNormalsFilter.cxx b/vtkm/filter/testing/UnitTestSurfaceNormalsFilter.cxx index 308e5d2d4..ef6c65209 100644 --- a/vtkm/filter/testing/UnitTestSurfaceNormalsFilter.cxx +++ b/vtkm/filter/testing/UnitTestSurfaceNormalsFilter.cxx @@ -18,7 +18,7 @@ namespace void VerifyCellNormalValues(const vtkm::cont::DataSet& ds) { vtkm::cont::ArrayHandle normals; - ds.GetCellField("Normals").GetData().CopyTo(normals); + ds.GetCellField("Normals").GetData().AsArrayHandle(normals); vtkm::Vec3f expected[8] = { { -0.707f, -0.500f, 0.500f }, { -0.707f, -0.500f, 0.500f }, { 0.707f, 0.500f, -0.500f }, { 0.000f, -0.707f, -0.707f }, @@ -37,7 +37,7 @@ void VerifyCellNormalValues(const vtkm::cont::DataSet& ds) void VerifyPointNormalValues(const vtkm::cont::DataSet& ds) { vtkm::cont::ArrayHandle normals; - ds.GetPointField("Normals").GetData().CopyTo(normals); + ds.GetPointField("Normals").GetData().AsArrayHandle(normals); vtkm::Vec3f expected[8] = { { -0.8165f, -0.4082f, -0.4082f }, { -0.2357f, -0.9714f, 0.0286f }, { 0.0000f, -0.1691f, 0.9856f }, { -0.8660f, 0.0846f, 0.4928f }, diff --git a/vtkm/filter/testing/UnitTestTetrahedralizeFilter.cxx b/vtkm/filter/testing/UnitTestTetrahedralizeFilter.cxx index cfd48b65f..93b35d9f3 100644 --- a/vtkm/filter/testing/UnitTestTetrahedralizeFilter.cxx +++ b/vtkm/filter/testing/UnitTestTetrahedralizeFilter.cxx @@ -35,7 +35,7 @@ public: "Wrong number of points for Tetrahedralize"); vtkm::cont::ArrayHandle outData = - output.GetField("cellvar").GetData().Cast>(); + output.GetField("cellvar").GetData().AsArrayHandle>(); VTKM_TEST_ASSERT(outData.ReadPortal().Get(5) == 100.2f, "Wrong cell field data"); VTKM_TEST_ASSERT(outData.ReadPortal().Get(6) == 100.2f, "Wrong cell field data"); @@ -58,7 +58,7 @@ public: "Wrong number of points for Tetrahedralize"); vtkm::cont::ArrayHandle outData = - output.GetField("cellvar").GetData().Cast>(); + output.GetField("cellvar").GetData().AsArrayHandle>(); VTKM_TEST_ASSERT(outData.ReadPortal().Get(5) == 110.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outData.ReadPortal().Get(6) == 110.f, "Wrong cell field data"); diff --git a/vtkm/filter/testing/UnitTestThresholdFilter.cxx b/vtkm/filter/testing/UnitTestThresholdFilter.cxx index 40144d952..17111ae8f 100644 --- a/vtkm/filter/testing/UnitTestThresholdFilter.cxx +++ b/vtkm/filter/testing/UnitTestThresholdFilter.cxx @@ -39,7 +39,7 @@ public: "Wrong number of fields in the output dataset"); vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 1 && cellFieldArray.ReadPortal().Get(0) == 200.1f, @@ -68,7 +68,7 @@ public: "Wrong number of fields in the output dataset"); vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 2 && cellFieldArray.ReadPortal().Get(0) == 100.1f && @@ -98,7 +98,7 @@ public: "Wrong number of fields in the output dataset"); vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 2 && cellFieldArray.ReadPortal().Get(0) == 100.1f && @@ -128,7 +128,7 @@ public: "Wrong number of fields in the output dataset"); vtkm::cont::ArrayHandle cellFieldArray; - output.GetField("cellvar").GetData().CopyTo(cellFieldArray); + output.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 0, "field should be empty"); diff --git a/vtkm/filter/testing/UnitTestThresholdPointsFilter.cxx b/vtkm/filter/testing/UnitTestThresholdPointsFilter.cxx index 2eefcd12c..602c3c56e 100644 --- a/vtkm/filter/testing/UnitTestThresholdPointsFilter.cxx +++ b/vtkm/filter/testing/UnitTestThresholdPointsFilter.cxx @@ -38,7 +38,7 @@ public: vtkm::cont::Field pointField = output.GetField("pointvar"); vtkm::cont::ArrayHandle pointFieldArray; - pointField.GetData().CopyTo(pointFieldArray); + pointField.GetData().AsArrayHandle(pointFieldArray); VTKM_TEST_ASSERT(pointFieldArray.ReadPortal().Get(12) == 50.0f, "Wrong point field data"); } @@ -60,7 +60,7 @@ public: vtkm::cont::Field pointField = output.GetField("pointvar"); vtkm::cont::ArrayHandle pointFieldArray; - pointField.GetData().CopyTo(pointFieldArray); + pointField.GetData().AsArrayHandle(pointFieldArray); VTKM_TEST_ASSERT(pointFieldArray.ReadPortal().Get(0) == 99.0f, "Wrong point field data"); } @@ -82,7 +82,7 @@ public: vtkm::cont::Field pointField = output.GetField("pointvar"); vtkm::cont::ArrayHandle pointFieldArray; - pointField.GetData().CopyTo(pointFieldArray); + pointField.GetData().AsArrayHandle(pointFieldArray); VTKM_TEST_ASSERT(pointFieldArray.ReadPortal().Get(4) == 10.f, "Wrong point field data"); } diff --git a/vtkm/filter/testing/UnitTestTriangulateFilter.cxx b/vtkm/filter/testing/UnitTestTriangulateFilter.cxx index 04a637182..95ca3df64 100644 --- a/vtkm/filter/testing/UnitTestTriangulateFilter.cxx +++ b/vtkm/filter/testing/UnitTestTriangulateFilter.cxx @@ -33,7 +33,7 @@ public: "Wrong number of points for Triangulate"); vtkm::cont::ArrayHandle outData = - output.GetField("cellvar").GetData().Cast>(); + output.GetField("cellvar").GetData().AsArrayHandle>(); VTKM_TEST_ASSERT(outData.ReadPortal().Get(2) == 1.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outData.ReadPortal().Get(3) == 1.f, "Wrong cell field data"); @@ -53,7 +53,7 @@ public: "Wrong number of points for Triangulate"); vtkm::cont::ArrayHandle outData = - output.GetField("cellvar").GetData().Cast>(); + output.GetField("cellvar").GetData().AsArrayHandle>(); VTKM_TEST_ASSERT(outData.ReadPortal().Get(1) == 1.f, "Wrong cell field data"); VTKM_TEST_ASSERT(outData.ReadPortal().Get(2) == 1.f, "Wrong cell field data"); diff --git a/vtkm/filter/testing/UnitTestTubeFilter.cxx b/vtkm/filter/testing/UnitTestTubeFilter.cxx index 42e05ab34..0274817ce 100644 --- a/vtkm/filter/testing/UnitTestTubeFilter.cxx +++ b/vtkm/filter/testing/UnitTestTubeFilter.cxx @@ -82,8 +82,8 @@ void TestTubeFilters() VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == 36, "Wrong number of cells"); //Validate the point field - auto ptArr = - output.GetField("pointVar").GetData().Cast>(); + vtkm::cont::ArrayHandle ptArr; + output.GetField("pointVar").GetData().AsArrayHandle(ptArr); VTKM_TEST_ASSERT(ptArr.GetNumberOfValues() == 22, "Wrong number of values in point field"); std::vector ptVals = { 0, 0, 0, 0, 1, 1, 1, 2, 2, 2, 2, @@ -95,8 +95,8 @@ void TestTubeFilters() //Validate the cell field - auto cellArr = - output.GetField("cellVar").GetData().Cast>(); + vtkm::cont::ArrayHandle cellArr; + output.GetField("cellVar").GetData().AsArrayHandle(cellArr); VTKM_TEST_ASSERT(cellArr.GetNumberOfValues() == 36, "Wrong number of values in cell field"); std::vector cellVals = { 100, 100, 100, 100, 100, 100, 101, 101, 101, 101, 101, 101, 100, 100, 100, 101, 101, 101, diff --git a/vtkm/filter/testing/UnitTestVectorMagnitudeFilter.cxx b/vtkm/filter/testing/UnitTestVectorMagnitudeFilter.cxx index 42d5f511b..bef5f0e56 100644 --- a/vtkm/filter/testing/UnitTestVectorMagnitudeFilter.cxx +++ b/vtkm/filter/testing/UnitTestVectorMagnitudeFilter.cxx @@ -45,7 +45,7 @@ void TestVectorMagnitude() VTKM_TEST_ASSERT(result.HasPointField("magnitude"), "Output field missing."); vtkm::cont::ArrayHandle resultArrayHandle; - result.GetPointField("magnitude").GetData().CopyTo(resultArrayHandle); + result.GetPointField("magnitude").GetData().AsArrayHandle(resultArrayHandle); for (vtkm::Id i = 0; i < resultArrayHandle.GetNumberOfValues(); ++i) { VTKM_TEST_ASSERT( diff --git a/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx b/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx index f487045f8..c0cfa7188 100644 --- a/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx +++ b/vtkm/filter/testing/UnitTestVertexClusteringFilter.cxx @@ -33,8 +33,9 @@ void TestVertexClustering() "Number of output coordinate systems mismatch"); using FieldArrayType = vtkm::cont::ArrayHandle; - FieldArrayType pointvar = output.GetPointField("pointvar").GetData().Cast(); - FieldArrayType cellvar = output.GetCellField("cellvar").GetData().Cast(); + FieldArrayType pointvar = + output.GetPointField("pointvar").GetData().AsArrayHandle(); + FieldArrayType cellvar = output.GetCellField("cellvar").GetData().AsArrayHandle(); // test const vtkm::Id output_points = 7; diff --git a/vtkm/filter/testing/UnitTestWarpScalarFilter.cxx b/vtkm/filter/testing/UnitTestWarpScalarFilter.cxx index 58642548a..09e1fd69a 100644 --- a/vtkm/filter/testing/UnitTestWarpScalarFilter.cxx +++ b/vtkm/filter/testing/UnitTestWarpScalarFilter.cxx @@ -59,11 +59,11 @@ void CheckResult(const vtkm::filter::WarpScalar& filter, const vtkm::cont::DataS VTKM_TEST_ASSERT(result.HasPointField("warpscalar"), "Output filed warpscalar is missing"); using vecType = vtkm::Vec3f; vtkm::cont::ArrayHandle outputArray; - result.GetPointField("warpscalar").GetData().CopyTo(outputArray); + result.GetPointField("warpscalar").GetData().AsArrayHandle(outputArray); auto outPortal = outputArray.ReadPortal(); vtkm::cont::ArrayHandle sfArray; - result.GetPointField("scalarfactor").GetData().CopyTo(sfArray); + result.GetPointField("scalarfactor").GetData().AsArrayHandle(sfArray); auto sfPortal = sfArray.ReadPortal(); for (vtkm::Id j = 0; j < dim; ++j) diff --git a/vtkm/filter/testing/UnitTestWarpVectorFilter.cxx b/vtkm/filter/testing/UnitTestWarpVectorFilter.cxx index 6a5be8c87..1e3a1ded3 100644 --- a/vtkm/filter/testing/UnitTestWarpVectorFilter.cxx +++ b/vtkm/filter/testing/UnitTestWarpVectorFilter.cxx @@ -56,7 +56,7 @@ void CheckResult(const vtkm::filter::WarpVector& filter, const vtkm::cont::DataS VTKM_TEST_ASSERT(result.HasPointField("warpvector"), "Output filed WarpVector is missing"); using vecType = vtkm::Vec3f; vtkm::cont::ArrayHandle outputArray; - result.GetPointField("warpvector").GetData().CopyTo(outputArray); + result.GetPointField("warpvector").GetData().AsArrayHandle(outputArray); auto outPortal = outputArray.ReadPortal(); for (vtkm::Id j = 0; j < dim; ++j) diff --git a/vtkm/filter/testing/UnitTestZFP.cxx b/vtkm/filter/testing/UnitTestZFP.cxx index e3fb210c2..f994ee694 100644 --- a/vtkm/filter/testing/UnitTestZFP.cxx +++ b/vtkm/filter/testing/UnitTestZFP.cxx @@ -30,8 +30,8 @@ void TestZFP1DFilter(vtkm::Float64 rate) vtkm::cont::testing::MakeTestDataSet testDataSet; vtkm::cont::DataSet dataset = testDataSet.Make1DUniformDataSet2(); auto dynField = dataset.GetField("pointvar").GetData(); - vtkm::cont::ArrayHandle field = - dynField.Cast>(); + vtkm::cont::ArrayHandle field; + dynField.AsArrayHandle(field); auto oport = field.ReadPortal(); vtkm::filter::ZFPCompressor1D compressor; @@ -46,7 +46,7 @@ void TestZFP1DFilter(vtkm::Float64 rate) auto decompress = decompressor.Execute(compressed); dynField = decompress.GetField("decompressed").GetData(); - field = dynField.Cast>(); + dynField.AsArrayHandle(field); auto port = field.ReadPortal(); for (int i = 0; i < field.GetNumberOfValues(); i++) @@ -61,8 +61,8 @@ void TestZFP2DFilter(vtkm::Float64 rate) vtkm::cont::DataSet dataset = testDataSet.Make2DUniformDataSet2(); auto dynField = dataset.GetField("pointvar").GetData(); - vtkm::cont::ArrayHandle field = - dynField.Cast>(); + vtkm::cont::ArrayHandle field; + dynField.AsArrayHandle(field); auto oport = field.ReadPortal(); @@ -80,7 +80,7 @@ void TestZFP2DFilter(vtkm::Float64 rate) auto decompress = decompressor.Execute(compressed); dynField = decompress.GetField("decompressed").GetData(); - field = dynField.Cast>(); + dynField.AsArrayHandle(field); auto port = field.ReadPortal(); for (int i = 0; i < dynField.GetNumberOfValues(); i++) @@ -95,8 +95,8 @@ void TestZFP3DFilter(vtkm::Float64 rate) vtkm::cont::testing::MakeTestDataSet testDataSet; vtkm::cont::DataSet dataset = testDataSet.Make3DUniformDataSet3(dims); auto dynField = dataset.GetField("pointvar").GetData(); - vtkm::cont::ArrayHandle field = - dynField.Cast>(); + vtkm::cont::ArrayHandle field; + dynField.AsArrayHandle(field); auto oport = field.ReadPortal(); @@ -112,7 +112,7 @@ void TestZFP3DFilter(vtkm::Float64 rate) auto decompress = decompressor.Execute(compressed); dynField = decompress.GetField("decompressed").GetData(); - field = dynField.Cast>(); + dynField.AsArrayHandle(field); auto port = field.ReadPortal(); for (int i = 0; i < dynField.GetNumberOfValues(); i++) diff --git a/vtkm/io/ImageWriterBase.cxx b/vtkm/io/ImageWriterBase.cxx index 0466c0e12..0bb4871a1 100644 --- a/vtkm/io/ImageWriterBase.cxx +++ b/vtkm/io/ImageWriterBase.cxx @@ -75,7 +75,7 @@ void ImageWriterBase::WriteDataSet(const vtkm::cont::DataSet& dataSet, } } - this->Write(width, height, colorField.GetData().Cast()); + this->Write(width, height, colorField.GetData().AsArrayHandle()); } } } // namespace vtkm::io diff --git a/vtkm/io/VTKDataSetWriter.cxx b/vtkm/io/VTKDataSetWriter.cxx index 6af59a9d4..3375957d9 100644 --- a/vtkm/io/VTKDataSetWriter.cxx +++ b/vtkm/io/VTKDataSetWriter.cxx @@ -337,17 +337,17 @@ void WriteDataSetAsStructured(std::ostream& out, { // uniform is written as "structured points" WriteDataSetAsStructuredPoints( - out, coordSystem.Cast(), cellSet); + out, coordSystem.AsArrayHandle(), cellSet); } else if (coordSystem.IsType>()) { WriteDataSetAsRectilinearGrid( - out, coordSystem.Cast>(), cellSet); + out, coordSystem.AsArrayHandle>(), cellSet); } else if (coordSystem.IsType>()) { WriteDataSetAsRectilinearGrid( - out, coordSystem.Cast>(), cellSet); + out, coordSystem.AsArrayHandle>(), cellSet); } else { diff --git a/vtkm/io/testing/UnitTestHDF5Image.cxx b/vtkm/io/testing/UnitTestHDF5Image.cxx index 45aa449bd..e4d47be61 100644 --- a/vtkm/io/testing/UnitTestHDF5Image.cxx +++ b/vtkm/io/testing/UnitTestHDF5Image.cxx @@ -32,8 +32,9 @@ void TestFilledImage(vtkm::cont::DataSet& dataSet, "wrong image dimensions"); VTKM_TEST_ASSERT(pointField.GetData().template IsType>(), "wrong ArrayHandle type"); - auto pixelPortal = - pointField.GetData().template Cast>().ReadPortal(); + vtkm::cont::ArrayHandle pixelArray; + pointField.GetData().AsArrayHandle(pixelArray); + auto pixelPortal = pixelArray.ReadPortal(); auto colorPortal = canvas.GetColorBuffer().ReadPortal(); diff --git a/vtkm/io/testing/UnitTestImageWriter.cxx b/vtkm/io/testing/UnitTestImageWriter.cxx index 41ccbca08..69c32fd19 100644 --- a/vtkm/io/testing/UnitTestImageWriter.cxx +++ b/vtkm/io/testing/UnitTestImageWriter.cxx @@ -36,8 +36,9 @@ void TestFilledImage(vtkm::cont::DataSet& dataSet, "wrong image dimensions"); VTKM_TEST_ASSERT(pointField.GetData().template IsType>(), "wrong ArrayHandle type"); - auto pixelPortal = - pointField.GetData().template Cast>().ReadPortal(); + auto pixelPortal = pointField.GetData() + .template AsArrayHandle>() + .ReadPortal(); auto colorPortal = canvas.GetColorBuffer().ReadPortal(); diff --git a/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx b/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx index b52837769..445264f92 100644 --- a/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx +++ b/vtkm/io/testing/UnitTestVTKDataSetWriter.cxx @@ -30,7 +30,7 @@ struct CheckSameField const vtkm::cont::Field& fileField) const { vtkm::cont::ArrayHandle fileArray; - fileField.GetData().CopyTo(fileArray); + fileField.GetData().AsArrayHandle(fileArray); VTKM_TEST_ASSERT(test_equal_portals(originalArray.ReadPortal(), fileArray.ReadPortal())); } }; @@ -67,7 +67,7 @@ struct CheckSameCoordinateSystem { VTKM_TEST_ASSERT(fileCoords.GetData().IsType()); vtkm::cont::ArrayHandleUniformPointCoordinates fileArray = - fileCoords.GetData().Cast(); + fileCoords.GetData().AsArrayHandle(); auto originalPortal = originalArray.ReadPortal(); auto filePortal = fileArray.ReadPortal(); VTKM_TEST_ASSERT(test_equal(originalPortal.GetOrigin(), filePortal.GetOrigin())); @@ -87,7 +87,7 @@ struct CheckSameCoordinateSystem { VTKM_TEST_ASSERT(fileCoords.GetData().IsType>()); ArrayHandleRectilinearCoords fileArray = - fileCoords.GetData().Cast>(); + fileCoords.GetData().AsArrayHandle>(); auto originalPortal = originalArray.ReadPortal(); auto filePortal = fileArray.ReadPortal(); VTKM_TEST_ASSERT( diff --git a/vtkm/source/testing/UnitTestTangleSource.cxx b/vtkm/source/testing/UnitTestTangleSource.cxx index 3ee8ba76a..ea1d6f660 100644 --- a/vtkm/source/testing/UnitTestTangleSource.cxx +++ b/vtkm/source/testing/UnitTestTangleSource.cxx @@ -44,7 +44,7 @@ void TangleSourceTest() auto field = ds.GetCellField("cellvar"); auto dynData = field.GetData(); VTKM_TEST_ASSERT(dynData.IsType(), "Invalid scalar handle type."); - ScalarHandleType handle = dynData.Cast(); + ScalarHandleType handle = dynData.AsArrayHandle(); auto data = handle.ReadPortal(); VTKM_TEST_ASSERT(test_equal(data.GetNumberOfValues(), 8000), "Incorrect number of elements."); @@ -62,7 +62,7 @@ void TangleSourceTest() auto field = ds.GetPointField("nodevar"); auto dynData = field.GetData(); VTKM_TEST_ASSERT(dynData.IsType(), "Invalid scalar handle type."); - ScalarHandleType handle = dynData.Cast(); + ScalarHandleType handle = dynData.AsArrayHandle(); auto data = handle.ReadPortal(); VTKM_TEST_ASSERT(test_equal(data.GetNumberOfValues(), 9261), "Incorrect number of scalars."); diff --git a/vtkm/source/testing/UnitTestWaveletSource.cxx b/vtkm/source/testing/UnitTestWaveletSource.cxx index 2b5ae4f2e..bb4826a91 100644 --- a/vtkm/source/testing/UnitTestWaveletSource.cxx +++ b/vtkm/source/testing/UnitTestWaveletSource.cxx @@ -44,7 +44,7 @@ void WaveletSourceTest() auto field = ds.GetPointField("scalars"); auto dynData = field.GetData(); VTKM_TEST_ASSERT(dynData.IsType(), "Invalid scalar handle type."); - ScalarHandleType handle = dynData.Cast(); + ScalarHandleType handle = dynData.AsArrayHandle(); auto data = handle.ReadPortal(); VTKM_TEST_ASSERT(test_equal(data.GetNumberOfValues(), 9261), "Incorrect number of scalars."); diff --git a/vtkm/worklet/ExternalFaces.h b/vtkm/worklet/ExternalFaces.h index d6e4de895..38f9b2f7d 100644 --- a/vtkm/worklet/ExternalFaces.h +++ b/vtkm/worklet/ExternalFaces.h @@ -712,7 +712,7 @@ public: auto coordData = coord.GetData(); if (coordData.IsType()) { - const auto vertices = coordData.Cast(); + const auto vertices = coordData.AsArrayHandle(); const auto vertsSize = vertices.GetNumberOfValues(); const auto tmp = vtkm::cont::ArrayGetValues({ 0, vertsSize - 1 }, vertices); MinPoint = tmp[0]; @@ -720,7 +720,7 @@ public: } else { - auto vertices = coordData.Cast(); + auto vertices = coordData.AsArrayHandle(); auto Coordinates = vertices.ReadPortal(); MinPoint = Coordinates.GetOrigin(); diff --git a/vtkm/worklet/NDimsHistogram.h b/vtkm/worklet/NDimsHistogram.h index edaa541b7..1714d5f04 100644 --- a/vtkm/worklet/NDimsHistogram.h +++ b/vtkm/worklet/NDimsHistogram.h @@ -58,8 +58,8 @@ public: } else { - CastAndCall( - fieldArray.ResetTypes(vtkm::TypeListScalarAll()), + vtkm::cont::CastAndCall( + fieldArray.ResetTypes(vtkm::TypeListScalarAll{}, VTKM_DEFAULT_STORAGE_LIST{}), vtkm::worklet::histogram::ComputeBins(Bin1DIndex, numberOfBins, rangeOfValues, binDelta)); } } diff --git a/vtkm/worklet/PointMerge.h b/vtkm/worklet/PointMerge.h index 3f1ba7a8c..04c653fad 100644 --- a/vtkm/worklet/PointMerge.h +++ b/vtkm/worklet/PointMerge.h @@ -430,7 +430,7 @@ public: vtkm::cont::ArrayHandle concretePoints; if (points.template IsType()) { - concretePoints = points.template Cast(); + points.AsArrayHandle(concretePoints); } else { diff --git a/vtkm/worklet/StreamLineUniformGrid.h b/vtkm/worklet/StreamLineUniformGrid.h index 96916099d..a78caea16 100644 --- a/vtkm/worklet/StreamLineUniformGrid.h +++ b/vtkm/worklet/StreamLineUniformGrid.h @@ -331,7 +331,7 @@ public: vtkm::Id3 vdims = inCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint()); vtkm::cont::ArrayHandle> fieldArray; - InDataSet.GetField("vecData").GetData().CopyTo(fieldArray); + InDataSet.GetField("vecData").GetData().AsArrayHandle(fieldArray); // Generate random seeds for starting streamlines vtkm::cont::ArrayHandle> seedPosArray; diff --git a/vtkm/worklet/StreamSurface.h b/vtkm/worklet/StreamSurface.h index 2c1ea27ef..996c7973b 100644 --- a/vtkm/worklet/StreamSurface.h +++ b/vtkm/worklet/StreamSurface.h @@ -257,7 +257,7 @@ public: vtkm::cont::Algorithm::ScanExclusive(triangleConnCount, triangleConnOffset); //Surface points are same as input points. - newPoints = coords.GetData().Cast(); + newPoints = coords.GetData().AsArrayHandle(); //Create surface triangles vtkm::Id numConnIds = vtkm::cont::Algorithm::Reduce(triangleConnCount, vtkm::Id(0)); diff --git a/vtkm/worklet/contourtree_distributed/TreeCompiler.h b/vtkm/worklet/contourtree_distributed/TreeCompiler.h index 792415001..9ea9b840c 100644 --- a/vtkm/worklet/contourtree_distributed/TreeCompiler.h +++ b/vtkm/worklet/contourtree_distributed/TreeCompiler.h @@ -232,27 +232,32 @@ inline void TreeCompiler::AddHierarchicalTree(const vtkm::cont::DataSet& addedTr std::vector regularNodeGlobalIds(regularNodeGlobalIds_array.GetNumberOfValues()); auto regularNodeGlobalIds_handle = vtkm::cont::make_ArrayHandle(regularNodeGlobalIds, vtkm::CopyFlag::Off); - vtkm::cont::ArrayCopy(regularNodeGlobalIds_array.ResetTypes(vtkm::List{}), - regularNodeGlobalIds_handle); + vtkm::cont::ArrayCopy( + regularNodeGlobalIds_array.ResetTypes(), + regularNodeGlobalIds_handle); regularNodeGlobalIds_handle .SyncControlArray(); //Forces values to get updated if copy happened on GPU auto superarcs_array = addedTree.GetField("Superarcs").GetData(); std::vector added_tree_superarcs(superarcs_array.GetNumberOfValues()); auto superarcs_handle = vtkm::cont::make_ArrayHandle(added_tree_superarcs, vtkm::CopyFlag::Off); - vtkm::cont::ArrayCopy(superarcs_array.ResetTypes(vtkm::List{}), superarcs_handle); + vtkm::cont::ArrayCopy(superarcs_array.ResetTypes(), + superarcs_handle); superarcs_handle.SyncControlArray(); //Forces values to get updated if copy happened on GPU auto supernodes_array = addedTree.GetField("Supernodes").GetData(); std::vector added_tree_supernodes(supernodes_array.GetNumberOfValues()); auto supernodes_handle = vtkm::cont::make_ArrayHandle(added_tree_supernodes, vtkm::CopyFlag::Off); - vtkm::cont::ArrayCopy(supernodes_array.ResetTypes(vtkm::List{}), supernodes_handle); + vtkm::cont::ArrayCopy(supernodes_array.ResetTypes(), + supernodes_handle); supernodes_handle.SyncControlArray(); //Forces values to get updated if copy happened on GPU auto superparents_array = addedTree.GetField("Superparents").GetData(); std::vector superparents(superparents_array.GetNumberOfValues()); auto superparents_handle = vtkm::cont::make_ArrayHandle(superparents, vtkm::CopyFlag::Off); - vtkm::cont::ArrayCopy(superparents_array.ResetTypes(vtkm::List{}), superparents_handle); + vtkm::cont::ArrayCopy( + superparents_array.ResetTypes(), + superparents_handle); superparents_handle.SyncControlArray(); //Forces values to get updated if copy happened on GPU // loop through all of the supernodes in the hierarchical tree diff --git a/vtkm/worklet/particleadvection/GridEvaluators.h b/vtkm/worklet/particleadvection/GridEvaluators.h index 9f67c4821..c21f43fa7 100644 --- a/vtkm/worklet/particleadvection/GridEvaluators.h +++ b/vtkm/worklet/particleadvection/GridEvaluators.h @@ -181,7 +181,7 @@ public: { auto arr = dataSet.GetCellField("vtkmGhostCells").GetData(); if (arr.IsType()) - this->GhostCellArray = arr.Cast(); + this->GhostCellArray = arr.AsArrayHandle(); else throw vtkm::cont::ErrorInternal("vtkmGhostCells not of type vtkm::UInt8"); } diff --git a/vtkm/worklet/testing/UnitTestCellGradient.cxx b/vtkm/worklet/testing/UnitTestCellGradient.cxx index cc783b1a3..4cd0d50d0 100644 --- a/vtkm/worklet/testing/UnitTestCellGradient.cxx +++ b/vtkm/worklet/testing/UnitTestCellGradient.cxx @@ -26,7 +26,7 @@ void TestCellGradientUniform2D() vtkm::cont::ArrayHandle input; vtkm::cont::ArrayHandle result; - dataSet.GetField("pointvar").GetData().CopyTo(input); + dataSet.GetField("pointvar").GetData().AsArrayHandle(input); vtkm::worklet::CellGradient gradient; result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), input); @@ -49,7 +49,7 @@ void TestCellGradientUniform3D() vtkm::cont::ArrayHandle input; vtkm::cont::ArrayHandle result; - dataSet.GetField("pointvar").GetData().CopyTo(input); + dataSet.GetField("pointvar").GetData().AsArrayHandle(input); vtkm::worklet::CellGradient gradient; result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), input); @@ -218,7 +218,7 @@ void TestCellGradientExplicit() vtkm::cont::ArrayHandle input; vtkm::cont::ArrayHandle result; - dataSet.GetField("pointvar").GetData().CopyTo(input); + dataSet.GetField("pointvar").GetData().AsArrayHandle(input); vtkm::worklet::CellGradient gradient; result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), input); diff --git a/vtkm/worklet/testing/UnitTestClipping.cxx b/vtkm/worklet/testing/UnitTestClipping.cxx index f133f9c1e..de288e9b4 100644 --- a/vtkm/worklet/testing/UnitTestClipping.cxx +++ b/vtkm/worklet/testing/UnitTestClipping.cxx @@ -116,7 +116,8 @@ void TestClippingExplicit() bool invertClip = false; vtkm::cont::CellSetExplicit<> outputCellSet = clip.Run(ds.GetCellSet(), - ds.GetField("scalars").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + ds.GetField("scalars").GetData().ResetTypes(vtkm::TypeListFieldScalar{}, + VTKM_DEFAULT_STORAGE_LIST{}), clipValue, invertClip); @@ -124,11 +125,11 @@ void TestClippingExplicit() vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn); vtkm::cont::ArrayHandle scalarsIn; - ds.GetField("scalars").GetData().CopyTo(scalarsIn); + ds.GetField("scalars").GetData().AsArrayHandle(scalarsIn); vtkm::cont::ArrayHandle scalars = clip.ProcessPointField(scalarsIn); vtkm::cont::ArrayHandle cellvarIn; - ds.GetField("cellvar").GetData().CopyTo(cellvarIn); + ds.GetField("cellvar").GetData().AsArrayHandle(cellvarIn); vtkm::cont::ArrayHandle cellvar = clip.ProcessCellField(cellvarIn); vtkm::Id connectivitySize = 8; @@ -172,7 +173,8 @@ void TestClippingStructured() vtkm::worklet::Clip clip; vtkm::cont::CellSetExplicit<> outputCellSet = clip.Run(ds.GetCellSet(), - ds.GetField("scalars").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + ds.GetField("scalars").GetData().ResetTypes(vtkm::TypeListFieldScalar{}, + VTKM_DEFAULT_STORAGE_LIST{}), clipValue, invertClip); @@ -180,11 +182,11 @@ void TestClippingStructured() CoordsOutType coords = clip.ProcessPointField(coordsIn); vtkm::cont::ArrayHandle scalarsIn; - ds.GetField("scalars").GetData().CopyTo(scalarsIn); + ds.GetField("scalars").GetData().AsArrayHandle(scalarsIn); vtkm::cont::ArrayHandle scalars = clip.ProcessPointField(scalarsIn); vtkm::cont::ArrayHandle cellvarIn; - ds.GetField("cellvar").GetData().CopyTo(cellvarIn); + ds.GetField("cellvar").GetData().AsArrayHandle(cellvarIn); vtkm::cont::ArrayHandle cellvar = clip.ProcessCellField(cellvarIn); @@ -242,11 +244,11 @@ void TestClippingWithImplicitFunction() vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn); vtkm::cont::ArrayHandle scalarsIn; - ds.GetField("scalars").GetData().CopyTo(scalarsIn); + ds.GetField("scalars").GetData().AsArrayHandle(scalarsIn); vtkm::cont::ArrayHandle scalars = clip.ProcessPointField(scalarsIn); vtkm::cont::ArrayHandle cellvarIn; - ds.GetField("cellvar").GetData().CopyTo(cellvarIn); + ds.GetField("cellvar").GetData().AsArrayHandle(cellvarIn); vtkm::cont::ArrayHandle cellvar = clip.ProcessCellField(cellvarIn); vtkm::Id connectivitySize = 28; @@ -301,11 +303,11 @@ void TestClippingWithImplicitFunctionInverted() vtkm::cont::ArrayHandle coords = clip.ProcessPointField(coordsIn); vtkm::cont::ArrayHandle scalarsIn; - ds.GetField("scalars").GetData().CopyTo(scalarsIn); + ds.GetField("scalars").GetData().AsArrayHandle(scalarsIn); vtkm::cont::ArrayHandle scalars = clip.ProcessPointField(scalarsIn); vtkm::cont::ArrayHandle cellvarIn; - ds.GetField("cellvar").GetData().CopyTo(cellvarIn); + ds.GetField("cellvar").GetData().AsArrayHandle(cellvarIn); vtkm::cont::ArrayHandle cellvar = clip.ProcessCellField(cellvarIn); vtkm::Id connectivitySize = 12; diff --git a/vtkm/worklet/testing/UnitTestContour.cxx b/vtkm/worklet/testing/UnitTestContour.cxx index 3d8667a3d..e6dc2f374 100644 --- a/vtkm/worklet/testing/UnitTestContour.cxx +++ b/vtkm/worklet/testing/UnitTestContour.cxx @@ -192,9 +192,9 @@ void TestContourUniformGrid() vtkm::cont::CellSetStructured<3> cellSet; dataSet.GetCellSet().CopyTo(cellSet); vtkm::cont::ArrayHandle pointFieldArray; - dataSet.GetField("nodevar").GetData().CopyTo(pointFieldArray); + dataSet.GetField("nodevar").GetData().AsArrayHandle(pointFieldArray); vtkm::cont::ArrayHandle cellFieldArray; - dataSet.GetField("cellvar").GetData().CopyTo(cellFieldArray); + dataSet.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); vtkm::worklet::Contour contour; contour.SetMergeDuplicatePoints(false); @@ -311,7 +311,7 @@ void TestContourExplicit() vtkm::cont::Field contourField = dataSet.GetField("distanceToOrigin"); DataSetGenerator::DataArrayHandle contourArray; - contourField.GetData().CopyTo(contourArray); + contourField.GetData().AsArrayHandle(contourArray); Vec3Handle vertices; Vec3Handle normals; @@ -326,12 +326,12 @@ void TestContourExplicit() vtkm::cont::Field projectedField = dataSet.GetField("distanceToOther"); DataSetGenerator::DataArrayHandle projectedArray; - projectedField.GetData().CopyTo(projectedArray); + projectedField.GetData().AsArrayHandle(projectedArray); scalars = Contour.ProcessPointField(projectedArray); vtkm::cont::ArrayHandle cellFieldArray; - dataSet.GetField("cellvar").GetData().CopyTo(cellFieldArray); + dataSet.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); vtkm::cont::ArrayHandle cellFieldArrayOut; cellFieldArrayOut = Contour.ProcessCellField(cellFieldArray); @@ -372,9 +372,9 @@ void TestContourClipped() vtkm::cont::CellSetExplicit<> cellSet; clipped.GetCellSet().CopyTo(cellSet); vtkm::cont::ArrayHandle pointFieldArray; - clipped.GetField("nodevar").GetData().CopyTo(pointFieldArray); + clipped.GetField("nodevar").GetData().AsArrayHandle(pointFieldArray); vtkm::cont::ArrayHandle cellFieldArray; - clipped.GetField("cellvar").GetData().CopyTo(cellFieldArray); + clipped.GetField("cellvar").GetData().AsArrayHandle(cellFieldArray); std::vector contourValue{ 0.5f }; vtkm::cont::ArrayHandle verticesArray; diff --git a/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx b/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx index 34ba377e3..d54c02f91 100644 --- a/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx +++ b/vtkm/worklet/testing/UnitTestContourTreeUniform.cxx @@ -85,7 +85,7 @@ public: vtkm::Id nCols = pointDimensions[1]; vtkm::cont::ArrayHandle fieldArray; - dataSet.GetField("pointvar").GetData().CopyTo(fieldArray); + dataSet.GetField("pointvar").GetData().AsArrayHandle(fieldArray); // Output saddle peak pairs array vtkm::cont::ArrayHandle> saddlePeak; @@ -132,7 +132,7 @@ public: vtkm::Id nSlices = pointDimensions[2]; vtkm::cont::ArrayHandle fieldArray; - dataSet.GetField("pointvar").GetData().CopyTo(fieldArray); + dataSet.GetField("pointvar").GetData().AsArrayHandle(fieldArray); // Output saddle peak pairs array vtkm::cont::ArrayHandle> saddlePeak; diff --git a/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx b/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx index 044defa02..4d134e646 100644 --- a/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx +++ b/vtkm/worklet/testing/UnitTestContourTreeUniformAugmented.cxx @@ -376,7 +376,7 @@ private: vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); vtkm::cont::ArrayHandle field; - dataSet.GetField("pointvar").GetData().CopyTo(field); + dataSet.GetField("pointvar").GetData().AsArrayHandle(field); // Run the specific test CallTestContourTreeAugmentedSteps( @@ -725,7 +725,7 @@ public: vtkm::Id3 meshSize{ pointDimensions2D[0], pointDimensions2D[1], 1 }; vtkm::cont::ArrayHandle field; - dataSet.GetField("pointvar").GetData().CopyTo(field); + dataSet.GetField("pointvar").GetData().AsArrayHandle(field); // Create the worklet and run it vtkm::worklet::ContourTreeAugmented contourTreeWorklet; @@ -791,7 +791,7 @@ public: vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); vtkm::cont::ArrayHandle field; - dataSet.GetField("pointvar").GetData().CopyTo(field); + dataSet.GetField("pointvar").GetData().AsArrayHandle(field); // Create the worklet and run it vtkm::worklet::ContourTreeAugmented contourTreeWorklet; @@ -864,7 +864,7 @@ public: vtkm::Id3 pointDimensions = cellSet.GetPointDimensions(); vtkm::cont::ArrayHandle field; - dataSet.GetField("pointvar").GetData().CopyTo(field); + dataSet.GetField("pointvar").GetData().AsArrayHandle(field); // Create the worklet and run it vtkm::worklet::ContourTreeAugmented contourTreeWorklet; diff --git a/vtkm/worklet/testing/UnitTestCosmoTools.cxx b/vtkm/worklet/testing/UnitTestCosmoTools.cxx index d80ed8764..5bce65b50 100644 --- a/vtkm/worklet/testing/UnitTestCosmoTools.cxx +++ b/vtkm/worklet/testing/UnitTestCosmoTools.cxx @@ -195,11 +195,11 @@ void TestCosmo_2DHaloFind() vtkm::cont::ArrayHandle haloIdArray; vtkm::cont::ArrayHandle mbpArray; - dataSet.GetField("xLocation").GetData().CopyTo(xLocArray); - dataSet.GetField("yLocation").GetData().CopyTo(yLocArray); - dataSet.GetField("zLocation").GetData().CopyTo(zLocArray); - dataSet.GetField("haloId").GetData().CopyTo(haloIdArray); - dataSet.GetField("mbp").GetData().CopyTo(mbpArray); + dataSet.GetField("xLocation").GetData().AsArrayHandle(xLocArray); + dataSet.GetField("yLocation").GetData().AsArrayHandle(yLocArray); + dataSet.GetField("zLocation").GetData().AsArrayHandle(zLocArray); + dataSet.GetField("haloId").GetData().AsArrayHandle(haloIdArray); + dataSet.GetField("mbp").GetData().AsArrayHandle(mbpArray); // Output haloId, MBP, potential per particle vtkm::cont::ArrayHandle resultHaloId; @@ -247,11 +247,11 @@ void TestCosmo_3DHaloFind() vtkm::cont::ArrayHandle haloIdArray; vtkm::cont::ArrayHandle mbpArray; - dataSet.GetField("xLocation").GetData().CopyTo(xLocArray); - dataSet.GetField("yLocation").GetData().CopyTo(yLocArray); - dataSet.GetField("zLocation").GetData().CopyTo(zLocArray); - dataSet.GetField("haloId").GetData().CopyTo(haloIdArray); - dataSet.GetField("mbp").GetData().CopyTo(mbpArray); + dataSet.GetField("xLocation").GetData().AsArrayHandle(xLocArray); + dataSet.GetField("yLocation").GetData().AsArrayHandle(yLocArray); + dataSet.GetField("zLocation").GetData().AsArrayHandle(zLocArray); + dataSet.GetField("haloId").GetData().AsArrayHandle(haloIdArray); + dataSet.GetField("mbp").GetData().AsArrayHandle(mbpArray); // Output haloId, MBP, potential per particle vtkm::cont::ArrayHandle resultHaloId; @@ -297,9 +297,9 @@ void TestCosmo_3DCenterFind() vtkm::cont::ArrayHandle yLocArray; vtkm::cont::ArrayHandle zLocArray; vtkm::cont::ArrayHandle haloIdArray; - dataSet.GetField("xLocation").GetData().CopyTo(xLocArray); - dataSet.GetField("yLocation").GetData().CopyTo(yLocArray); - dataSet.GetField("zLocation").GetData().CopyTo(zLocArray); + dataSet.GetField("xLocation").GetData().AsArrayHandle(xLocArray); + dataSet.GetField("yLocation").GetData().AsArrayHandle(yLocArray); + dataSet.GetField("zLocation").GetData().AsArrayHandle(zLocArray); // Output haloId MBP particleId pairs array vtkm::Pair nxnResult; diff --git a/vtkm/worklet/testing/UnitTestExtractGeometry.cxx b/vtkm/worklet/testing/UnitTestExtractGeometry.cxx index de28d3226..daef863dd 100644 --- a/vtkm/worklet/testing/UnitTestExtractGeometry.cxx +++ b/vtkm/worklet/testing/UnitTestExtractGeometry.cxx @@ -40,7 +40,7 @@ public: OutCellSetType outCellSet = extractGeometry.Run(cellSet, cellIds); auto cellvar = - dataset.GetField("cellvar").GetData().Cast>(); + dataset.GetField("cellvar").GetData().AsArrayHandle>(); auto cellFieldArray = extractGeometry.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), nCells), @@ -81,7 +81,7 @@ public: extractOnlyBoundaryCells); auto cellvar = - dataset.GetField("cellvar").GetData().Cast>(); + dataset.GetField("cellvar").GetData().AsArrayHandle>(); auto cellFieldArray = extractGeometry.ProcessCellField(cellvar); @@ -115,7 +115,7 @@ public: OutCellSetType outCellSet = extractGeometry.Run(cellSet, cellIds); auto cellvar = - dataset.GetField("cellvar").GetData().Cast>(); + dataset.GetField("cellvar").GetData().AsArrayHandle>(); auto cellFieldArray = extractGeometry.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), nCells), @@ -148,7 +148,7 @@ public: OutCellSetType outCellSet = extractGeometry.Run(cellSet, cellIds); auto cellvar = - dataset.GetField("cellvar").GetData().Cast>(); + dataset.GetField("cellvar").GetData().AsArrayHandle>(); auto cellFieldArray = extractGeometry.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), nCells), @@ -189,7 +189,7 @@ public: extractOnlyBoundaryCells); auto cellvar = - dataset.GetField("cellvar").GetData().Cast>(); + dataset.GetField("cellvar").GetData().AsArrayHandle>(); auto cellFieldArray = extractGeometry.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 8), "Wrong result for ExtractCells"); @@ -229,7 +229,7 @@ public: extractOnlyBoundaryCells); auto cellvar = - dataset.GetField("cellvar").GetData().Cast>(); + dataset.GetField("cellvar").GetData().AsArrayHandle>(); auto cellFieldArray = extractGeometry.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 8), "Wrong result for ExtractCells"); diff --git a/vtkm/worklet/testing/UnitTestFieldHistogram.cxx b/vtkm/worklet/testing/UnitTestFieldHistogram.cxx index 8441755b3..734cea8dc 100644 --- a/vtkm/worklet/testing/UnitTestFieldHistogram.cxx +++ b/vtkm/worklet/testing/UnitTestFieldHistogram.cxx @@ -290,13 +290,13 @@ void TestFieldHistogram() // Get point data vtkm::cont::ArrayHandle p_poisson; - ds.GetField("p_poisson").GetData().CopyTo(p_poisson); + ds.GetField("p_poisson").GetData().AsArrayHandle(p_poisson); vtkm::cont::ArrayHandle p_normal; - ds.GetField("p_normal").GetData().CopyTo(p_normal); + ds.GetField("p_normal").GetData().AsArrayHandle(p_normal); vtkm::cont::ArrayHandle p_chiSquare; - ds.GetField("p_chiSquare").GetData().CopyTo(p_chiSquare); + ds.GetField("p_chiSquare").GetData().AsArrayHandle(p_chiSquare); vtkm::cont::ArrayHandle p_uniform; - ds.GetField("p_uniform").GetData().CopyTo(p_uniform); + ds.GetField("p_uniform").GetData().AsArrayHandle(p_uniform); vtkm::worklet::FieldHistogram histogram; // Run data diff --git a/vtkm/worklet/testing/UnitTestFieldStatistics.cxx b/vtkm/worklet/testing/UnitTestFieldStatistics.cxx index a0afba9a6..8a3c11f46 100644 --- a/vtkm/worklet/testing/UnitTestFieldStatistics.cxx +++ b/vtkm/worklet/testing/UnitTestFieldStatistics.cxx @@ -319,7 +319,7 @@ void TestFieldSimple() // Cell data vtkm::cont::ArrayHandle data; - ds.GetField("data").GetData().CopyTo(data); + ds.GetField("data").GetData().AsArrayHandle(data); // Run vtkm::worklet::FieldStatistics().Run(data, statinfo); @@ -350,13 +350,13 @@ void TestFieldStandardDistributions() // Point data vtkm::cont::ArrayHandle p_poisson; - ds.GetField("p_poisson").GetData().CopyTo(p_poisson); + ds.GetField("p_poisson").GetData().AsArrayHandle(p_poisson); vtkm::cont::ArrayHandle p_normal; - ds.GetField("p_normal").GetData().CopyTo(p_normal); + ds.GetField("p_normal").GetData().AsArrayHandle(p_normal); vtkm::cont::ArrayHandle p_chiSquare; - ds.GetField("p_chiSquare").GetData().CopyTo(p_chiSquare); + ds.GetField("p_chiSquare").GetData().AsArrayHandle(p_chiSquare); vtkm::cont::ArrayHandle p_uniform; - ds.GetField("p_uniform").GetData().CopyTo(p_uniform); + ds.GetField("p_uniform").GetData().AsArrayHandle(p_uniform); // Run Poisson data vtkm::worklet::FieldStatistics().Run(p_poisson, statinfo); diff --git a/vtkm/worklet/testing/UnitTestMask.cxx b/vtkm/worklet/testing/UnitTestMask.cxx index 67df9ed1c..f2ee9dca4 100644 --- a/vtkm/worklet/testing/UnitTestMask.cxx +++ b/vtkm/worklet/testing/UnitTestMask.cxx @@ -43,7 +43,7 @@ public: OutCellSetType outCellSet = maskCells.Run(cellSet, 2); vtkm::cont::ArrayHandle cellvar; - dataset.GetField("cellvar").GetData().CopyTo(cellvar); + dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); vtkm::cont::ArrayHandle cellFieldArray = maskCells.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 8), "Wrong result for Mask"); @@ -69,7 +69,7 @@ public: OutCellSetType outCellSet = maskCells.Run(cellSet, 9); vtkm::cont::ArrayHandle cellvar; - dataset.GetField("cellvar").GetData().CopyTo(cellvar); + dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); vtkm::cont::ArrayHandle cellFieldArray = maskCells.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 7), "Wrong result for ExtractCells"); @@ -96,7 +96,7 @@ public: OutCellSetType outCellSet = maskCells.Run(cellSet, 2); vtkm::cont::ArrayHandle cellvar; - dataset.GetField("cellvar").GetData().CopyTo(cellvar); + dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); vtkm::cont::ArrayHandle cellFieldArray = maskCells.ProcessCellField(cellvar); VTKM_TEST_ASSERT(test_equal(outCellSet.GetNumberOfCells(), 2), "Wrong result for ExtractCells"); diff --git a/vtkm/worklet/testing/UnitTestOrientNormals.cxx b/vtkm/worklet/testing/UnitTestOrientNormals.cxx index 8a1e84939..a8679add5 100644 --- a/vtkm/worklet/testing/UnitTestOrientNormals.cxx +++ b/vtkm/worklet/testing/UnitTestOrientNormals.cxx @@ -352,8 +352,8 @@ void TestOrientNormals(bool testPoints, bool testCells) const auto pointNormalField = dataset.GetPointField("normals"); const auto cellNormalField = dataset.GetCellField("normals"); - auto pointNormals = pointNormalField.GetData().Cast(); - auto cellNormals = cellNormalField.GetData().Cast(); + auto pointNormals = pointNormalField.GetData().AsArrayHandle(); + auto cellNormals = cellNormalField.GetData().AsArrayHandle(); vtkm::worklet::OrientNormals::RunPointAndCellNormals(cells, coords, pointNormals, cellNormals); } @@ -361,7 +361,7 @@ void TestOrientNormals(bool testPoints, bool testCells) { std::cerr << "Testing point normals...\n"; const auto pointNormalField = dataset.GetPointField("normals"); - auto pointNormals = pointNormalField.GetData().Cast(); + auto pointNormals = pointNormalField.GetData().AsArrayHandle(); vtkm::worklet::OrientNormals::RunPointNormals(cells, coords, pointNormals); } @@ -369,7 +369,7 @@ void TestOrientNormals(bool testPoints, bool testCells) { std::cerr << "Testing cell normals...\n"; const auto cellNormalField = dataset.GetCellField("normals"); - auto cellNormals = cellNormalField.GetData().Cast(); + auto cellNormals = cellNormalField.GetData().AsArrayHandle(); vtkm::worklet::OrientNormals::RunCellNormals(cells, coords, cellNormals); } diff --git a/vtkm/worklet/testing/UnitTestParticleAdvection.cxx b/vtkm/worklet/testing/UnitTestParticleAdvection.cxx index 21330876e..2a911ef9b 100644 --- a/vtkm/worklet/testing/UnitTestParticleAdvection.cxx +++ b/vtkm/worklet/testing/UnitTestParticleAdvection.cxx @@ -836,9 +836,10 @@ void TestParticleAdvectionFile(const std::string& fname, // If types match, do a simple cast. // If not, need to copy it into the appropriate type. if (fieldData.IsType()) - fieldArray = fieldData.Cast(); + fieldArray = fieldData.AsArrayHandle(); else - vtkm::cont::ArrayCopy(fieldData.ResetTypes(), fieldArray); + vtkm::cont::ArrayCopy( + fieldData.ResetTypes(), fieldArray); FieldType velocities(fieldArray); GridEvalType eval(ds.GetCoordinateSystem(), ds.GetCellSet(), velocities); diff --git a/vtkm/worklet/testing/UnitTestPointGradient.cxx b/vtkm/worklet/testing/UnitTestPointGradient.cxx index bca10554f..f02b77ab9 100644 --- a/vtkm/worklet/testing/UnitTestPointGradient.cxx +++ b/vtkm/worklet/testing/UnitTestPointGradient.cxx @@ -25,7 +25,7 @@ void TestPointGradientUniform2D() vtkm::cont::DataSet dataSet = testDataSet.Make2DUniformDataSet0(); vtkm::cont::ArrayHandle fieldArray; - dataSet.GetField("pointvar").GetData().CopyTo(fieldArray); + dataSet.GetField("pointvar").GetData().AsArrayHandle(fieldArray); vtkm::worklet::PointGradient gradient; auto result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), fieldArray); @@ -51,7 +51,7 @@ void TestPointGradientUniform3D() vtkm::cont::DataSet dataSet = testDataSet.Make3DUniformDataSet0(); vtkm::cont::ArrayHandle fieldArray; - dataSet.GetField("pointvar").GetData().CopyTo(fieldArray); + dataSet.GetField("pointvar").GetData().AsArrayHandle(fieldArray); vtkm::worklet::PointGradient gradient; auto result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), fieldArray); @@ -202,7 +202,7 @@ void TestPointGradientExplicit3D() vtkm::cont::DataSet dataSet = testDataSet.Make3DExplicitDataSet5(); vtkm::cont::ArrayHandle fieldArray; - dataSet.GetField("pointvar").GetData().CopyTo(fieldArray); + dataSet.GetField("pointvar").GetData().AsArrayHandle(fieldArray); vtkm::worklet::PointGradient gradient; auto result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), fieldArray); @@ -235,7 +235,7 @@ void TestPointGradientExplicit2D() vtkm::cont::DataSet dataSet = testDataSet.Make2DExplicitDataSet0(); vtkm::cont::ArrayHandle fieldArray; - dataSet.GetField("pointvar").GetData().CopyTo(fieldArray); + dataSet.GetField("pointvar").GetData().AsArrayHandle(fieldArray); vtkm::worklet::PointGradient gradient; auto result = gradient.Run(dataSet.GetCellSet(), dataSet.GetCoordinateSystem(), fieldArray); diff --git a/vtkm/worklet/testing/UnitTestProbe.cxx b/vtkm/worklet/testing/UnitTestProbe.cxx index b6006a5f1..928ede5c7 100644 --- a/vtkm/worklet/testing/UnitTestProbe.cxx +++ b/vtkm/worklet/testing/UnitTestProbe.cxx @@ -133,10 +133,10 @@ private: vtkm::worklet::Probe probe; probe.Run(input.GetCellSet(), input.GetCoordinateSystem(), geometry.GetCoordinateSystem()); - auto pf = - probe.ProcessPointField(input.GetField("pointdata").GetData().Cast(), 0.0f); - auto cf = - probe.ProcessCellField(input.GetField("celldata").GetData().Cast(), 0.0f); + auto pf = probe.ProcessPointField( + input.GetField("pointdata").GetData().AsArrayHandle(), 0.0f); + auto cf = probe.ProcessCellField( + input.GetField("celldata").GetData().AsArrayHandle(), 0.0f); auto hp = probe.GetHiddenPointsField(); auto hc = probe.GetHiddenCellsField(geometry.GetCellSet()); @@ -156,10 +156,10 @@ private: vtkm::worklet::Probe probe; probe.Run(input.GetCellSet(), input.GetCoordinateSystem(), geometry.GetCoordinateSystem()); - auto pf = - probe.ProcessPointField(input.GetField("pointdata").GetData().Cast(), 0.0f); - auto cf = - probe.ProcessCellField(input.GetField("celldata").GetData().Cast(), 0.0f); + auto pf = probe.ProcessPointField( + input.GetField("pointdata").GetData().AsArrayHandle(), 0.0f); + auto cf = probe.ProcessCellField( + input.GetField("celldata").GetData().AsArrayHandle(), 0.0f); auto hp = probe.GetHiddenPointsField(); auto hc = probe.GetHiddenCellsField(geometry.GetCellSet()); @@ -180,10 +180,10 @@ private: vtkm::worklet::Probe probe; probe.Run(input.GetCellSet(), input.GetCoordinateSystem(), geometry.GetCoordinateSystem()); - auto pf = - probe.ProcessPointField(input.GetField("pointdata").GetData().Cast(), 0.0f); - auto cf = - probe.ProcessCellField(input.GetField("celldata").GetData().Cast(), 0.0f); + auto pf = probe.ProcessPointField( + input.GetField("pointdata").GetData().AsArrayHandle(), 0.0f); + auto cf = probe.ProcessCellField( + input.GetField("celldata").GetData().AsArrayHandle(), 0.0f); auto hp = probe.GetHiddenPointsField(); auto hc = probe.GetHiddenCellsField(geometry.GetCellSet()); diff --git a/vtkm/worklet/testing/UnitTestSplitSharpEdges.cxx b/vtkm/worklet/testing/UnitTestSplitSharpEdges.cxx index 7ff5a6ea8..cba6bd820 100644 --- a/vtkm/worklet/testing/UnitTestSplitSharpEdges.cxx +++ b/vtkm/worklet/testing/UnitTestSplitSharpEdges.cxx @@ -126,7 +126,7 @@ void TestSplitSharpEdgesSplitEveryEdge(vtkm::cont::DataSet& simpleCube, newCellset); vtkm::cont::ArrayHandle pointvar; - simpleCube.GetPointField("pointvar").GetData().CopyTo(pointvar); + simpleCube.GetPointField("pointvar").GetData().AsArrayHandle(pointvar); vtkm::cont::ArrayHandle newPointFields = splitSharpEdges.ProcessPointField(pointvar); VTKM_TEST_ASSERT(newCoords.GetNumberOfValues() == 24, @@ -171,7 +171,7 @@ void TestSplitSharpEdgesNoSplit(vtkm::cont::DataSet& simpleCube, newCellset); vtkm::cont::ArrayHandle pointvar; - simpleCube.GetPointField("pointvar").GetData().CopyTo(pointvar); + simpleCube.GetPointField("pointvar").GetData().AsArrayHandle(pointvar); vtkm::cont::ArrayHandle newPointFields = splitSharpEdges.ProcessPointField(pointvar); VTKM_TEST_ASSERT(newCoords.GetNumberOfValues() == 8, diff --git a/vtkm/worklet/testing/UnitTestThreshold.cxx b/vtkm/worklet/testing/UnitTestThreshold.cxx index 331db6be5..4077f912a 100644 --- a/vtkm/worklet/testing/UnitTestThreshold.cxx +++ b/vtkm/worklet/testing/UnitTestThreshold.cxx @@ -59,7 +59,7 @@ public: dataset.GetCellSet().CopyTo(cellset); vtkm::cont::ArrayHandle pointvar; - dataset.GetField("pointvar").GetData().CopyTo(pointvar); + dataset.GetField("pointvar").GetData().AsArrayHandle(pointvar); vtkm::worklet::Threshold threshold; OutCellSetType outCellSet = @@ -68,7 +68,7 @@ public: VTKM_TEST_ASSERT(outCellSet.GetNumberOfCells() == 1, "Wrong number of cells"); vtkm::cont::ArrayHandle cellvar; - dataset.GetField("cellvar").GetData().CopyTo(cellvar); + dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); vtkm::cont::ArrayHandle cellFieldArray = threshold.ProcessCellField(cellvar); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 1 && @@ -89,7 +89,7 @@ public: dataset.GetCellSet().CopyTo(cellset); vtkm::cont::ArrayHandle pointvar; - dataset.GetField("pointvar").GetData().CopyTo(pointvar); + dataset.GetField("pointvar").GetData().AsArrayHandle(pointvar); vtkm::worklet::Threshold threshold; OutCellSetType outCellSet = @@ -98,7 +98,7 @@ public: VTKM_TEST_ASSERT(outCellSet.GetNumberOfCells() == 2, "Wrong number of cells"); vtkm::cont::ArrayHandle cellvar; - dataset.GetField("cellvar").GetData().CopyTo(cellvar); + dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); vtkm::cont::ArrayHandle cellFieldArray = threshold.ProcessCellField(cellvar); VTKM_TEST_ASSERT(cellFieldArray.GetNumberOfValues() == 2 && @@ -120,7 +120,7 @@ public: dataset.GetCellSet().CopyTo(cellset); vtkm::cont::ArrayHandle cellvar; - dataset.GetField("cellvar").GetData().CopyTo(cellvar); + dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar); vtkm::worklet::Threshold threshold; OutCellSetType outCellSet = diff --git a/vtkm/worklet/testing/UnitTestThresholdPoints.cxx b/vtkm/worklet/testing/UnitTestThresholdPoints.cxx index d9c5a8dba..ff80b85fe 100644 --- a/vtkm/worklet/testing/UnitTestThresholdPoints.cxx +++ b/vtkm/worklet/testing/UnitTestThresholdPoints.cxx @@ -109,7 +109,9 @@ public: OutCellSetType outCellSet; outCellSet = threshold.Run(dataset.GetCellSet(), - dataset.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + dataset.GetField("pointvar") + .GetData() + .ResetTypes(vtkm::TypeListFieldScalar{}, VTKM_DEFAULT_STORAGE_LIST{}), ValuesBetween(40.0f, 71.0f)); outDataSet.SetCellSet(outCellSet); @@ -118,7 +120,7 @@ public: vtkm::cont::Field pointField = outDataSet.GetField("pointvar"); vtkm::cont::ArrayHandle pointFieldArray; - pointField.GetData().CopyTo(pointFieldArray); + pointField.GetData().AsArrayHandle(pointFieldArray); VTKM_TEST_ASSERT(pointFieldArray.ReadPortal().Get(12) == 50.0f, "Wrong point field data"); } @@ -140,7 +142,9 @@ public: OutCellSetType outCellSet; outCellSet = threshold.Run(dataset.GetCellSet(), - dataset.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + dataset.GetField("pointvar") + .GetData() + .ResetTypes(vtkm::TypeListFieldScalar{}, VTKM_DEFAULT_STORAGE_LIST{}), ValuesAbove(1.0f)); outDataSet.SetCellSet(outCellSet); @@ -165,7 +169,9 @@ public: OutCellSetType outCellSet; outCellSet = threshold.Run(dataset.GetCellSet(), - dataset.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + dataset.GetField("pointvar") + .GetData() + .ResetTypes(vtkm::TypeListFieldScalar{}, VTKM_DEFAULT_STORAGE_LIST{}), ValuesBelow(50.0f)); outDataSet.SetCellSet(outCellSet); diff --git a/vtkm/worklet/testing/UnitTestTriangleWinding.cxx b/vtkm/worklet/testing/UnitTestTriangleWinding.cxx index 905284822..bfd9c347b 100644 --- a/vtkm/worklet/testing/UnitTestTriangleWinding.cxx +++ b/vtkm/worklet/testing/UnitTestTriangleWinding.cxx @@ -60,7 +60,7 @@ void Validate(vtkm::cont::DataSet dataSet) cellSet.GetOffsetsArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{}); const auto cellArray = vtkm::cont::make_ArrayHandleGroupVecVariable(conn, offsets); const auto cellNormalsVar = dataSet.GetCellField("normals").GetData(); - const auto cellNormalsArray = cellNormalsVar.Cast>(); + const auto cellNormalsArray = cellNormalsVar.AsArrayHandle>(); const auto cellPortal = cellArray.ReadPortal(); const auto cellNormals = cellNormalsArray.ReadPortal(); @@ -112,7 +112,7 @@ void DoTest() auto cellSet = ds.GetCellSet().Cast>(); const auto coords = ds.GetCoordinateSystem().GetData(); const auto cellNormalsVar = ds.GetCellField("normals").GetData(); - const auto cellNormals = cellNormalsVar.Cast>(); + const auto cellNormals = cellNormalsVar.AsArrayHandle>(); auto newCells = vtkm::worklet::TriangleWinding::Run(cellSet, coords, cellNormals); diff --git a/vtkm/worklet/testing/UnitTestTube.cxx b/vtkm/worklet/testing/UnitTestTube.cxx index 11c2ef1c3..c5787115a 100644 --- a/vtkm/worklet/testing/UnitTestTube.cxx +++ b/vtkm/worklet/testing/UnitTestTube.cxx @@ -119,10 +119,11 @@ void TestTube(bool capEnds, vtkm::FloatDefault radius, vtkm::Id numSides, vtkm:: vtkm::worklet::Tube tubeWorklet(capEnds, numSides, radius); vtkm::cont::ArrayHandle newPoints; vtkm::cont::CellSetSingleType<> newCells; - tubeWorklet.Run(ds.GetCoordinateSystem(0).GetData().Cast>(), - ds.GetCellSet(), - newPoints, - newCells); + tubeWorklet.Run( + ds.GetCoordinateSystem(0).GetData().AsArrayHandle>(), + ds.GetCellSet(), + newPoints, + newCells); VTKM_TEST_ASSERT(newPoints.GetNumberOfValues() == reqNumPts, "Wrong number of points in Tube worklet"); @@ -178,7 +179,7 @@ void TestLinearPolylines() vtkm::cont::ArrayHandle newPoints; vtkm::cont::CellSetSingleType<> newCells; tubeWorklet.Run( - ds.GetCoordinateSystem(0).GetData().Cast>(), + ds.GetCoordinateSystem(0).GetData().AsArrayHandle>(), ds.GetCellSet(), newPoints, newCells); diff --git a/vtkm/worklet/testing/UnitTestVertexClustering.cxx b/vtkm/worklet/testing/UnitTestVertexClustering.cxx index 140f43c60..6308b33d0 100644 --- a/vtkm/worklet/testing/UnitTestVertexClustering.cxx +++ b/vtkm/worklet/testing/UnitTestVertexClustering.cxx @@ -34,9 +34,9 @@ void TestVertexClustering() using FieldArrayType = vtkm::cont::ArrayHandle; FieldArrayType pointvar = clustering.ProcessPointField( - dataSet.GetPointField("pointvar").GetData().Cast()); - FieldArrayType cellvar = - clustering.ProcessCellField(dataSet.GetCellField("cellvar").GetData().Cast()); + dataSet.GetPointField("pointvar").GetData().AsArrayHandle()); + FieldArrayType cellvar = clustering.ProcessCellField( + dataSet.GetCellField("cellvar").GetData().AsArrayHandle()); // test const vtkm::Id output_pointIds = 18; diff --git a/vtkm/worklet/testing/UnitTestWarpScalar.cxx b/vtkm/worklet/testing/UnitTestWarpScalar.cxx index e6f4260b2..7d61c4d12 100644 --- a/vtkm/worklet/testing/UnitTestWarpScalar.cxx +++ b/vtkm/worklet/testing/UnitTestWarpScalar.cxx @@ -66,8 +66,10 @@ void TestWarpScalar() vtkm::cont::make_ArrayHandleConstant(normal, nov); vtkm::cont::ArrayHandle scaleFactorArray; - auto scaleFactor = ds.GetField("scalefactor").GetData().ResetTypes(vtkm::TypeListFieldScalar()); - scaleFactor.CopyTo(scaleFactorArray); + auto scaleFactor = ds.GetField("scalefactor") + .GetData() + .ResetTypes(); + scaleFactor.AsArrayHandle(scaleFactorArray); vtkm::worklet::WarpScalar warpWorklet; warpWorklet.Run( diff --git a/vtkm/worklet/testing/UnitTestWorkletMapPointNeighborhood.cxx b/vtkm/worklet/testing/UnitTestWorkletMapPointNeighborhood.cxx index 8223d9c14..b74aa9f84 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapPointNeighborhood.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapPointNeighborhood.cxx @@ -209,10 +209,11 @@ static void TestMaxNeighborValue() vtkm::cont::ArrayHandle output; vtkm::cont::DataSet dataSet3D = testDataSet.Make3DUniformDataSet0(); - dispatcher.Invoke( - dataSet3D.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), - dataSet3D.GetCellSet(), - output); + dispatcher.Invoke(dataSet3D.GetField("pointvar") + .GetData() + .ResetTypes(), + dataSet3D.GetCellSet(), + output); vtkm::Float32 expected3D[18] = { 110.3f, 120.3f, 120.3f, 110.3f, 120.3f, 120.3f, 170.5f, 180.5f, 180.5f, 170.5f, 180.5f, 180.5f, @@ -224,10 +225,11 @@ static void TestMaxNeighborValue() } vtkm::cont::DataSet dataSet2D = testDataSet.Make2DUniformDataSet1(); - dispatcher.Invoke( - dataSet2D.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), - dataSet2D.GetCellSet(), - output); + dispatcher.Invoke(dataSet2D.GetField("pointvar") + .GetData() + .ResetTypes(), + dataSet2D.GetCellSet(), + output); vtkm::Float32 expected2D[25] = { 100.0f, 100.0f, 78.0f, 49.0f, 33.0f, 100.0f, 100.0f, 78.0f, 50.0f, 48.0f, 94.0f, 94.0f, 91.0f, 91.0f, diff --git a/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx b/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx index 0f90ee68b..1fbf9eaed 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapTopologyExplicit.cxx @@ -87,8 +87,12 @@ static void TestMaxPointOrCell() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology<::test_explicit::MaxPointOrCellValue> dispatcher; - dispatcher.Invoke(dataSet.GetField("cellvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), - dataSet.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + dispatcher.Invoke(dataSet.GetField("cellvar") + .GetData() + .ResetTypes(), + dataSet.GetField("pointvar") + .GetData() + .ResetTypes(), &cellset, result); diff --git a/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx b/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx index 337ecf93a..1eed15fa0 100644 --- a/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx +++ b/vtkm/worklet/testing/UnitTestWorkletMapTopologyUniform.cxx @@ -110,8 +110,12 @@ static void TestMaxPointOrCell() vtkm::cont::ArrayHandle result; vtkm::worklet::DispatcherMapTopology<::test_uniform::MaxPointOrCellValue> dispatcher; - dispatcher.Invoke(dataSet.GetField("cellvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), - dataSet.GetField("pointvar").GetData().ResetTypes(vtkm::TypeListFieldScalar()), + dispatcher.Invoke(dataSet.GetField("cellvar") + .GetData() + .ResetTypes(), + dataSet.GetField("pointvar") + .GetData() + .ResetTypes(), // 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 diff --git a/vtkm/worklet/testing/UnitTestZFPCompressor.cxx b/vtkm/worklet/testing/UnitTestZFPCompressor.cxx index 6f3376a7d..16418b7d8 100644 --- a/vtkm/worklet/testing/UnitTestZFPCompressor.cxx +++ b/vtkm/worklet/testing/UnitTestZFPCompressor.cxx @@ -56,10 +56,10 @@ void Test1D(int rate) if (vtkm::cont::IsType(dynField)) { vtkm::cont::ArrayHandle handle; - const vtkm::Id size = dynField.Cast().GetNumberOfValues(); + const vtkm::Id size = dynField.AsArrayHandle().GetNumberOfValues(); handle.Allocate(size); - auto fPortal = dynField.Cast().ReadPortal(); + auto fPortal = dynField.AsArrayHandle().ReadPortal(); auto hPortal = handle.WritePortal(); for (vtkm::Id i = 0; i < size; ++i) { @@ -91,10 +91,10 @@ void Test2D(int rate) if (vtkm::cont::IsType(dynField)) { vtkm::cont::ArrayHandle handle; - const vtkm::Id size = dynField.Cast().GetNumberOfValues(); + const vtkm::Id size = dynField.AsArrayHandle().GetNumberOfValues(); handle.Allocate(size); - auto fPortal = dynField.Cast().ReadPortal(); + auto fPortal = dynField.AsArrayHandle().ReadPortal(); auto hPortal = handle.WritePortal(); for (vtkm::Id i = 0; i < size; ++i) { @@ -129,10 +129,10 @@ void Test3D(int rate) if (vtkm::cont::IsType(dynField)) { vtkm::cont::ArrayHandle handle; - const vtkm::Id size = dynField.Cast().GetNumberOfValues(); + const vtkm::Id size = dynField.AsArrayHandle().GetNumberOfValues(); handle.Allocate(size); - auto fPortal = dynField.Cast().ReadPortal(); + auto fPortal = dynField.AsArrayHandle().ReadPortal(); auto hPortal = handle.WritePortal(); for (vtkm::Id i = 0; i < size; ++i) {