Deprecate old methods from DynamicCellSet

The `DynamicCellSet` (and the related `DynamicCellSetBase`) are
deprecated and replaced with `UnknownCellSet` (and `UncertainCellSet`).
Thus, `UnknownCellSet` has some methods inherited from `DynamicCellSet`
but replaced with other functionality. These methods are now marked as
deprecated and their use is removed.
This commit is contained in:
Kenneth Moreland 2022-01-04 16:42:55 -07:00
parent 0b84787f78
commit 4650a1da96
82 changed files with 253 additions and 229 deletions

@ -545,7 +545,7 @@ void BenchReverseConnectivityGen(::benchmark::State& state)
for (auto _ : state)
{
(void)_;
cellset.CastAndCall(functor);
vtkm::cont::CastAndCall(cellset, functor);
state.SetIterationTime(functor.Timer.GetElapsedTime());
}
}

@ -646,8 +646,8 @@ int main(int argc, char* argv[])
// in the values vector and copy the dimensions in the dims vector
vtkm::Id3 pointDimensions;
auto cellSet = inDataSet.GetCellSet();
cellSet.CastAndCall(vtkm::worklet::contourtree_augmented::GetPointDimensions(),
pointDimensions);
vtkm::cont::CastAndCall(
cellSet, vtkm::worklet::contourtree_augmented::GetPointDimensions(), pointDimensions);
std::cout << "Point dimensions are " << pointDimensions << std::endl;
dims.resize(3);
dims[0] = pointDimensions[0];

@ -38,6 +38,8 @@ template <typename T, typename S>
class CellSetPermutation;
class CellSetExtrude;
class UnknownCellSet;
/// A Generic interface to CastAndCall. The default implementation simply calls
/// DynamicObject's CastAndCall, but specializations of this function exist for
/// other classes (e.g. Field, CoordinateSystem, ArrayHandle).
@ -49,16 +51,21 @@ void CastAndCall(const DynamicObject& dynamicObject, Functor&& f, Args&&... args
/// A specialization of CastAndCall for basic CoordinateSystem to make
/// it be treated just like any other dynamic object
// actually implemented in vtkm/cont/CoordinateSystem
// actually implemented in vtkm/cont/CoordinateSystem.h
template <typename Functor, typename... Args>
void CastAndCall(const CoordinateSystem& coords, Functor&& f, Args&&... args);
/// A specialization of CastAndCall for basic Field to make
/// it be treated just like any other dynamic object
// actually implemented in vtkm/cont/Field
// actually implemented in vtkm/cont/Field.h
template <typename Functor, typename... Args>
void CastAndCall(const vtkm::cont::Field& field, Functor&& f, Args&&... args);
/// A specialization of CastAndCall for unknown cell sets.
// actually implemented in vtkm/cont/UnknownCellSet.h
template <typename Functor, typename... Args>
void CastAndCall(const vtkm::cont::UnknownCellSet& cellSet, Functor&& f, Args&&... args);
/// A specialization of CastAndCall for basic ArrayHandle types,
/// Since the type is already known no deduction is needed.
/// This specialization is used to simplify numerous worklet algorithms

@ -15,8 +15,8 @@
#include <vtkm/Deprecated.h>
#include <vtkm/Types.h>
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/cont/DynamicCellSet.h>
#include <vtkm/cont/ExecutionObjectBase.h>
#include <vtkm/cont/UnknownCellSet.h>
#include <vtkm/exec/CellLocator.h>
@ -39,9 +39,9 @@ class VTKM_CONT_EXPORT VTKM_DEPRECATED(1.6,
public:
virtual ~CellLocator();
const vtkm::cont::DynamicCellSet& GetCellSet() const { return this->CellSet; }
const vtkm::cont::UnknownCellSet& GetCellSet() const { return this->CellSet; }
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet)
void SetCellSet(const vtkm::cont::UnknownCellSet& cellSet)
{
this->CellSet = cellSet;
this->SetModified();
@ -84,7 +84,7 @@ protected:
VTKM_CONT virtual void Build() = 0;
private:
vtkm::cont::DynamicCellSet CellSet;
vtkm::cont::UnknownCellSet CellSet;
vtkm::cont::CoordinateSystem Coords;
bool Modified = true;
};

@ -470,7 +470,7 @@ CellLocatorBoundingIntervalHierarchy::PrepareForExecution(vtkm::cont::DeviceAdap
vtkm::cont::Token& token) const
{
ExecObjType execObject;
this->GetCellSet().CastAndCall(MakeExecObject{}, device, token, *this, execObject);
vtkm::cont::CastAndCall(this->GetCellSet(), MakeExecObject{}, device, token, *this, execObject);
return execObject;
}

@ -28,19 +28,19 @@ void CellLocatorRectilinearGrid::Build()
if (!coords.GetData().IsType<RectilinearType>())
throw vtkm::cont::ErrorBadType("Coordinates are not rectilinear type.");
if (cellSet.IsSameType(Structured2DType()))
if (cellSet.CanConvert<Structured2DType>())
{
this->Is3D = false;
vtkm::Vec<vtkm::Id, 2> celldims =
cellSet.Cast<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
cellSet.AsCellSet<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
this->PlaneSize = celldims[0] * celldims[1];
this->RowSize = celldims[0];
}
else if (cellSet.IsSameType(Structured3DType()))
else if (cellSet.CanConvert<Structured3DType>())
{
this->Is3D = true;
vtkm::Vec<vtkm::Id, 3> celldims =
cellSet.Cast<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
cellSet.AsCellSet<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
this->PlaneSize = celldims[0] * celldims[1];
this->RowSize = celldims[0];
}
@ -62,7 +62,7 @@ vtkm::exec::CellLocatorRectilinearGrid CellLocatorRectilinearGrid::PrepareForExe
{
return ExecObjType(this->PlaneSize,
this->RowSize,
this->GetCellSet().template Cast<Structured3DType>(),
this->GetCellSet().AsCellSet<Structured3DType>(),
this->GetCoordinates().GetData().template AsArrayHandle<RectilinearType>(),
device,
token);
@ -71,7 +71,7 @@ vtkm::exec::CellLocatorRectilinearGrid CellLocatorRectilinearGrid::PrepareForExe
{
return ExecObjType(this->PlaneSize,
this->RowSize,
this->GetCellSet().template Cast<Structured2DType>(),
this->GetCellSet().AsCellSet<Structured2DType>(),
this->GetCoordinates().GetData().template AsArrayHandle<RectilinearType>(),
device,
token);

@ -484,7 +484,7 @@ CellLocatorTwoLevel::ExecObjType CellLocatorTwoLevel::PrepareForExecution(
{
this->Update();
ExecObjType execObject;
this->GetCellSet().CastAndCall(MakeExecObject{}, device, token, *this, execObject);
vtkm::cont::CastAndCall(this->GetCellSet(), MakeExecObject{}, device, token, *this, execObject);
return execObject;
}

@ -29,17 +29,17 @@ void CellLocatorUniformGrid::Build()
if (!coords.GetData().IsType<UniformType>())
throw vtkm::cont::ErrorBadType("Coordinates are not uniform type.");
if (cellSet.IsSameType(Structured2DType()))
if (cellSet.CanConvert<Structured2DType>())
{
this->Is3D = false;
Structured2DType structuredCellSet = cellSet.Cast<Structured2DType>();
Structured2DType structuredCellSet = cellSet.AsCellSet<Structured2DType>();
vtkm::Id2 pointDims = structuredCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint());
this->PointDims = vtkm::Id3(pointDims[0], pointDims[1], 1);
}
else if (cellSet.IsSameType(Structured3DType()))
else if (cellSet.CanConvert<Structured3DType>())
{
this->Is3D = true;
Structured3DType structuredCellSet = cellSet.Cast<Structured3DType>();
Structured3DType structuredCellSet = cellSet.AsCellSet<Structured3DType>();
this->PointDims = structuredCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint());
}
else

@ -79,7 +79,8 @@ void TransferCells(const vtkm::cont::UnknownCellSet& cellSetIn,
vtkm::cont::ArrayHandle<vtkm::Id>& connectivity,
vtkm::Id startIndex)
{
cellSetIn.CastAndCall(TransferCellsFunctor{}, shapes, numIndices, connectivity, startIndex);
vtkm::cont::CastAndCall(
cellSetIn, TransferCellsFunctor{}, shapes, numIndices, connectivity, startIndex);
}
struct TransferArrayFunctor

@ -223,16 +223,17 @@ public:
template <typename CellSetList, typename Functor, typename... Args>
VTKM_CONT void CastAndCallForTypes(Functor&& functor, Args&&... args) const;
// Support for (soon to be) deprecated DynamicCellSet
// TODO: Deprecate these methods
// Support for deprecated DynamicCellSet features
template <typename CellSetType>
VTKM_DEPRECATED(1.8, "Use CanConvert<decltype(cellset)>() (or IsType).")
VTKM_CONT bool IsSameType(const CellSetType&) const
{
return this->IsType<CellSetType>();
}
template <typename CellSetType>
VTKM_DEPRECATED(1.8, "Use AsCellSet<CellSetType>().")
VTKM_CONT CellSetType& Cast() const
{
VTKM_IS_CELL_SET(CellSetType);
@ -247,12 +248,16 @@ public:
}
template <typename CellSetType>
VTKM_DEPRECATED(1.8, "Use AsCellSet(cellSet).")
VTKM_CONT void CopyTo(CellSetType& cellSet) const
{
return this->AsCellSet(cellSet);
}
template <typename Functor, typename... Args>
VTKM_DEPRECATED(1.8,
"Use the vtkm::cont::CastAndCall free function4 or use CastAndCallForTypes or "
"use ResetCellList and then CastAndCall.")
VTKM_CONT void CastAndCall(Functor&& f, Args&&... args) const
{
this->CastAndCallForTypes<VTKM_DEFAULT_CELL_SET_LIST>(std::forward<Functor>(f),

@ -154,7 +154,7 @@ public:
vtkm::cont::UnknownCellSet cellSet = dataset.GetCellSet();
vtkm::Bounds bounds = coords.GetBounds();
vtkm::Id3 dims =
cellSet.Cast<StructuredType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
cellSet.AsCellSet<StructuredType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
// Generate some sample points.
using PointType = vtkm::Vec3f;

@ -77,7 +77,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dims)
vtkm::Vec<vtkm::FloatDefault, DIMENSIONS>(1.0f));
auto uniformCs =
uniformDs.GetCellSet().template Cast<vtkm::cont::CellSetStructured<DIMENSIONS>>();
uniformDs.GetCellSet().template AsCellSet<vtkm::cont::CellSetStructured<DIMENSIONS>>();
// triangulate the cellset
vtkm::cont::CellSetSingleType<> cellset;

@ -103,7 +103,7 @@ public:
using StructuredType = vtkm::cont::CellSetStructured<3>;
vtkm::Id3 cellDims =
cellSet.Cast<StructuredType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
cellSet.AsCellSet<StructuredType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
std::cout << "Dimensions of dataset : " << cellDims << std::endl;
vtkm::cont::CellLocatorUniformGrid locator;

@ -90,7 +90,7 @@ private:
// test cell-to-point connectivity
vtkm::cont::CellSetExplicit<> cellset;
ds.GetCellSet().CopyTo(cellset);
ds.GetCellSet().AsCellSet(cellset);
vtkm::Id connectivitySize = 7;
vtkm::Id numPoints = 5;

@ -99,7 +99,7 @@ private:
//verify that we can get a CellSetSingleType from a dataset
vtkm::cont::CellSetSingleType<> cellset;
dataSet.GetCellSet().CopyTo(cellset);
dataSet.GetCellSet().AsCellSet(cellset);
//verify that the point to cell connectivity types are correct
vtkm::cont::ArrayHandleConstant<vtkm::UInt8> shapesPointToCell =

@ -170,19 +170,19 @@ void TestCellSetPermutation()
std::cout << "Testing CellSetStructured<2>\n";
dataset = maker.Make2DUniformDataSet1();
RunTests(dataset.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>());
RunTests(dataset.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<2>>());
std::cout << "Testing CellSetStructured<3>\n";
dataset = maker.Make3DUniformDataSet1();
RunTests(dataset.GetCellSet().Cast<vtkm::cont::CellSetStructured<3>>());
RunTests(dataset.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<3>>());
std::cout << "Testing CellSetExplicit\n";
dataset = maker.Make3DExplicitDataSetPolygonal();
RunTests(dataset.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>());
RunTests(dataset.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>());
std::cout << "Testing CellSetSingleType\n";
dataset = maker.Make3DExplicitDataSetCowNose();
RunTests(dataset.GetCellSet().Cast<vtkm::cont::CellSetSingleType<>>());
RunTests(dataset.GetCellSet().AsCellSet<vtkm::cont::CellSetSingleType<>>());
}
} // anonymous namespace

@ -62,21 +62,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
if (dim == 1)
{
vtkm::cont::CellSetStructured<1> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_LINE, "Wrong element type");
}
else if (dim == 2)
{
vtkm::cont::CellSetStructured<2> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Wrong element type");
}
else if (dim == 3)
{
vtkm::cont::CellSetStructured<3> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type");
}

@ -60,21 +60,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
if (dim == 1)
{
vtkm::cont::CellSetStructured<1> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_LINE, "Wrong element type");
}
else if (dim == 2)
{
vtkm::cont::CellSetStructured<2> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Wrong element type");
}
else if (dim == 3)
{
vtkm::cont::CellSetStructured<3> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type");
}

@ -61,21 +61,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
if (dim == 1)
{
vtkm::cont::CellSetStructured<1> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_LINE, "Wrong element type");
}
else if (dim == 2)
{
vtkm::cont::CellSetStructured<2> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_QUAD, "Wrong element type");
}
else if (dim == 3)
{
vtkm::cont::CellSetStructured<3> cellSet;
ds.GetCellSet().CopyTo(cellSet);
ds.GetCellSet().AsCellSet(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type");
}

@ -93,7 +93,7 @@ void TestDataSet_Explicit()
//get the cellset single type from the dataset
vtkm::cont::CellSetSingleType<> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
//verify that we can create a subset of a singlset
using SubsetType = vtkm::cont::CellSetPermutation<vtkm::cont::CellSetSingleType<>>;
@ -128,7 +128,7 @@ void TestDataSet_Structured2D()
vtkm::cont::make_ArrayHandle<vtkm::Id>({ 1, 1, 1, 1 });
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
//verify that we can create a subset of a 2d UniformDataSet
vtkm::cont::CellSetPermutation<vtkm::cont::CellSetStructured<2>> subset;
@ -161,7 +161,7 @@ void TestDataSet_Structured3D()
vtkm::cont::make_ArrayHandle<vtkm::Id>({ 1, 1, 1, 1 });
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
//verify that we can create a subset of a 2d UniformDataSet
vtkm::cont::CellSetPermutation<vtkm::cont::CellSetStructured<3>> subset;

@ -40,7 +40,7 @@ static void TwoDimRectilinearTest()
vtkm::cont::DataSet dataSet = testDataSet.Make2DRectilinearDataSet0();
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");
VTKM_TEST_ASSERT(dataSet.GetNumberOfCoordinateSystems() == 1,
@ -126,7 +126,7 @@ static void ThreeDimRectilinearTest()
vtkm::cont::DataSet dataSet = testDataSet.Make3DRectilinearDataSet0();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");

@ -41,7 +41,7 @@ static void TwoDimUniformTest()
dataSet.PrintSummary(std::cout);
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");
VTKM_TEST_ASSERT(dataSet.GetNumberOfCoordinateSystems() == 1,
@ -130,7 +130,7 @@ static void ThreeDimUniformTest()
dataSet.PrintSummary(std::cout);
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");

@ -152,7 +152,7 @@ void AmrArrays::ComputeGenerateParentChildInformation()
vtkm::Id ptids[8];
this->AmrDataSet.GetPartition(this->PartitionIds.at(l).at(bParent))
.GetCellSet()
.CopyTo(cellset);
.AsCellSet(cellset);
cellset.GetCellPointIds(0, ptids);
vtkm::Bounds boundsCell = vtkm::Bounds();
for (vtkm::IdComponent pointId = 0; pointId < cellset.GetNumberOfPointsInCell(0); pointId++)
@ -221,7 +221,7 @@ void AmrArrays::ComputeGenerateGhostType()
vtkm::cont::DataSet partition =
this->AmrDataSet.GetPartition(this->PartitionIds.at(l).at(bParent));
vtkm::cont::CellSetStructured<Dim> cellset;
partition.GetCellSet().CopyTo(cellset);
partition.GetCellSet().AsCellSet(cellset);
vtkm::cont::ArrayHandle<vtkm::UInt8> ghostField;
if (!partition.HasField("vtkGhostType", vtkm::cont::Field::Association::CELL_SET))
{

@ -35,7 +35,7 @@ vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::DataSet& inData,
if (inCellSet.IsType<CellSetType>())
{
// Is expected type, do a shallow copy
outputCellSet = inCellSet.Cast<CellSetType>();
outputCellSet = inCellSet.AsCellSet<CellSetType>();
}
else
{ // Clean the grid

@ -90,7 +90,7 @@ vtkm::cont::DataSet ContourTreeMesh2D::DoExecute(
// Collect sizing information from the dataset
const auto& dynamicCellSet = input.GetCellSet();
vtkm::cont::CellSetStructured<2> cellSet;
dynamicCellSet.CopyTo(cellSet);
dynamicCellSet.AsCellSet(cellSet);
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
vtkm::Id nRows = pointDimensions[0];
@ -125,7 +125,7 @@ vtkm::cont::DataSet ContourTreeMesh3D::DoExecute(
// Collect sizing information from the dataset
vtkm::cont::CellSetStructured<3> cellSet;
input.GetCellSet().CopyTo(cellSet);
input.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
vtkm::Id nRows = pointDimensions[0];

@ -28,9 +28,9 @@ vtkm::cont::DataSet ExternalFaces::DoExecute(const vtkm::cont::DataSet& input,
// external faces worklet
vtkm::cont::CellSetExplicit<> outCellSet;
if (cells.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (cells.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
this->Worklet.Run(cells.Cast<vtkm::cont::CellSetStructured<3>>(),
this->Worklet.Run(cells.AsCellSet<vtkm::cont::CellSetStructured<3>>(),
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
outCellSet);
}

@ -108,7 +108,8 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co
if (numCells <= 2)
throw vtkm::cont::ErrorFilterExecution("insufficient number of cells for GhostCellClassify.");
vtkm::cont::CellSetStructured<1> cellset1d = cellset.Cast<vtkm::cont::CellSetStructured<1>>();
vtkm::cont::CellSetStructured<1> cellset1d =
cellset.AsCellSet<vtkm::cont::CellSetStructured<1>>();
//We use the dual of the cellset since we are using the PointNeighborhood worklet
vtkm::cont::CellSetStructured<3> dual;
@ -121,7 +122,8 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co
if (numCells <= 4)
throw vtkm::cont::ErrorFilterExecution("insufficient number of cells for GhostCellClassify.");
vtkm::cont::CellSetStructured<2> cellset2d = cellset.Cast<vtkm::cont::CellSetStructured<2>>();
vtkm::cont::CellSetStructured<2> cellset2d =
cellset.AsCellSet<vtkm::cont::CellSetStructured<2>>();
//We use the dual of the cellset since we are using the PointNeighborhood worklet
vtkm::cont::CellSetStructured<3> dual;
@ -134,7 +136,8 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co
if (numCells <= 8)
throw vtkm::cont::ErrorFilterExecution("insufficient number of cells for GhostCellClassify.");
vtkm::cont::CellSetStructured<3> cellset3d = cellset.Cast<vtkm::cont::CellSetStructured<3>>();
vtkm::cont::CellSetStructured<3> cellset3d =
cellset.AsCellSet<vtkm::cont::CellSetStructured<3>>();
//We use the dual of the cellset since we are using the PointNeighborhood worklet
vtkm::cont::CellSetStructured<3> dual;

@ -250,27 +250,27 @@ bool CanDoStructuredStrip(const vtkm::cont::UnknownCellSet& cells,
bool canDo = false;
vtkm::Id3 cellDims(1, 1, 1);
if (cells.IsSameType(vtkm::cont::CellSetStructured<1>()))
if (cells.CanConvert<vtkm::cont::CellSetStructured<1>>())
{
auto cells1D = cells.Cast<vtkm::cont::CellSetStructured<1>>();
auto cells1D = cells.AsCellSet<vtkm::cont::CellSetStructured<1>>();
vtkm::Id d = cells1D.GetCellDimensions();
cellDims[0] = d;
vtkm::Id sz = d;
canDo = CanStrip<1>(ghostField, invoke, removeAllGhost, removeType, range, cellDims, sz);
}
else if (cells.IsSameType(vtkm::cont::CellSetStructured<2>()))
else if (cells.CanConvert<vtkm::cont::CellSetStructured<2>>())
{
auto cells2D = cells.Cast<vtkm::cont::CellSetStructured<2>>();
auto cells2D = cells.AsCellSet<vtkm::cont::CellSetStructured<2>>();
vtkm::Id2 d = cells2D.GetCellDimensions();
cellDims[0] = d[0];
cellDims[1] = d[1];
vtkm::Id sz = cellDims[0] * cellDims[1];
canDo = CanStrip<2>(ghostField, invoke, removeAllGhost, removeType, range, cellDims, sz);
}
else if (cells.IsSameType(vtkm::cont::CellSetStructured<3>()))
else if (cells.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
auto cells3D = cells.Cast<vtkm::cont::CellSetStructured<3>>();
auto cells3D = cells.AsCellSet<vtkm::cont::CellSetStructured<3>>();
cellDims = cells3D.GetCellDimensions();
vtkm::Id sz = cellDims[0] * cellDims[1] * cellDims[2];
canDo = CanStrip<3>(ghostField, invoke, removeAllGhost, removeType, range, cellDims, sz);
@ -310,9 +310,9 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellRemove::DoExecute(
vtkm::cont::UnknownCellSet cellOut;
//Preserve structured output where possible.
if (cells.IsSameType(vtkm::cont::CellSetStructured<1>()) ||
cells.IsSameType(vtkm::cont::CellSetStructured<2>()) ||
cells.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (cells.CanConvert<vtkm::cont::CellSetStructured<1>>() ||
cells.CanConvert<vtkm::cont::CellSetStructured<2>>() ||
cells.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
vtkm::RangeId3 range;
if (CanDoStructuredStrip(

@ -123,9 +123,10 @@ inline void Lagrangian::UpdateSeedResolution(const vtkm::cont::DataSet input)
{
vtkm::cont::UnknownCellSet cell_set = input.GetCellSet();
if (cell_set.IsSameType(vtkm::cont::CellSetStructured<1>()))
if (cell_set.CanConvert<vtkm::cont::CellSetStructured<1>>())
{
vtkm::cont::CellSetStructured<1> cell_set1 = cell_set.Cast<vtkm::cont::CellSetStructured<1>>();
vtkm::cont::CellSetStructured<1> cell_set1 =
cell_set.AsCellSet<vtkm::cont::CellSetStructured<1>>();
vtkm::Id dims1 = cell_set1.GetPointDimensions();
this->SeedRes[0] = dims1;
if (this->cust_res)
@ -133,9 +134,10 @@ inline void Lagrangian::UpdateSeedResolution(const vtkm::cont::DataSet input)
this->SeedRes[0] = dims1 / this->x_res;
}
}
else if (cell_set.IsSameType(vtkm::cont::CellSetStructured<2>()))
else if (cell_set.CanConvert<vtkm::cont::CellSetStructured<2>>())
{
vtkm::cont::CellSetStructured<2> cell_set2 = cell_set.Cast<vtkm::cont::CellSetStructured<2>>();
vtkm::cont::CellSetStructured<2> cell_set2 =
cell_set.AsCellSet<vtkm::cont::CellSetStructured<2>>();
vtkm::Id2 dims2 = cell_set2.GetPointDimensions();
this->SeedRes[0] = dims2[0];
this->SeedRes[1] = dims2[1];
@ -145,9 +147,10 @@ inline void Lagrangian::UpdateSeedResolution(const vtkm::cont::DataSet input)
this->SeedRes[1] = dims2[1] / this->y_res;
}
}
else if (cell_set.IsSameType(vtkm::cont::CellSetStructured<3>()))
else if (cell_set.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
vtkm::cont::CellSetStructured<3> cell_set3 = cell_set.Cast<vtkm::cont::CellSetStructured<3>>();
vtkm::cont::CellSetStructured<3> cell_set3 =
cell_set.AsCellSet<vtkm::cont::CellSetStructured<3>>();
vtkm::Id3 dims3 = cell_set3.GetPointDimensions();
this->SeedRes[0] = dims3[0];
this->SeedRes[1] = dims3[1];

@ -114,7 +114,7 @@ inline VTKM_CONT vtkm::cont::DataSet ParticleDensityCloudInCell::DoExecute(
coords,
field,
locator,
uniform.GetCellSet().template Cast<vtkm::cont::CellSetStructured<3>>(),
uniform.GetCellSet().template AsCellSet<vtkm::cont::CellSetStructured<3>>(),
density);
if (DivideByVolume)

@ -50,7 +50,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor2D::DoExecute(
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
vtkm::cont::CellSetStructured<2> cellSet;
input.GetCellSet().CopyTo(cellSet);
input.GetCellSet().AsCellSet(cellSet);
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();

@ -50,7 +50,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor3D::DoExecute(
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
vtkm::cont::CellSetStructured<3> cellSet;
input.GetCellSet().CopyTo(cellSet);
input.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();

@ -47,7 +47,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor2D::DoExecute(
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
vtkm::cont::CellSetStructured<2> cellSet;
input.GetCellSet().CopyTo(cellSet);
input.GetCellSet().AsCellSet(cellSet);
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;

@ -46,7 +46,7 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor3D::DoExecute(
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
vtkm::cont::CellSetStructured<3> cellSet;
input.GetCellSet().CopyTo(cellSet);
input.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;

@ -162,8 +162,8 @@ inline vtkm::cont::DataSet CreateSubDataSet(const vtkm::cont::DataSet& ds,
const std::string& fieldName)
{
vtkm::Id3 globalSize;
ds.GetCellSet().CastAndCall(vtkm::worklet::contourtree_augmented::GetPointDimensions(),
globalSize);
vtkm::cont::CastAndCall(
ds.GetCellSet(), vtkm::worklet::contourtree_augmented::GetPointDimensions(), globalSize);
const vtkm::Id nOutValues = blockSize[0] * blockSize[1] * blockSize[2];
const auto inDataArrayHandle = ds.GetPointField(fieldName).GetData();
@ -237,8 +237,8 @@ inline vtkm::cont::PartitionedDataSet RunContourTreeDUniformDistributed(
{
// Get dimensions of data set
vtkm::Id3 globalSize;
ds.GetCellSet().CastAndCall(vtkm::worklet::contourtree_augmented::GetPointDimensions(),
globalSize);
vtkm::cont::CastAndCall(
ds.GetCellSet(), vtkm::worklet::contourtree_augmented::GetPointDimensions(), globalSize);
// Determine split
vtkm::Id3 blocksPerAxis = ComputeNumberOfBlocksPerAxis(globalSize, numberOfBlocks);

@ -32,7 +32,7 @@ void TestUniformGrid(vtkm::filter::CleanGrid clean)
VTKM_TEST_ASSERT(outData.HasField("cellvar"), "Failed to map cell field");
vtkm::cont::CellSetExplicit<> outCellSet;
outData.GetCellSet().CopyTo(outCellSet);
outData.GetCellSet().AsCellSet(outCellSet);
VTKM_TEST_ASSERT(outCellSet.GetNumberOfPoints() == 6,
"Wrong number of points: ",
outCellSet.GetNumberOfPoints());

@ -90,7 +90,7 @@ public:
vtkm::cont::CoordinateSystem coords = result.GetCoordinateSystem();
vtkm::cont::UnknownCellSet dcells = result.GetCellSet();
using CellSetType = vtkm::cont::CellSetSingleType<>;
const CellSetType& cells = dcells.Cast<CellSetType>();
const CellSetType& cells = dcells.AsCellSet<CellSetType>();
//verify that the number of points is correct (72)
//verify that the number of cells is correct (160)
@ -115,7 +115,7 @@ public:
vtkm::cont::UnknownCellSet dcells = result.GetCellSet();
using CellSetType = vtkm::cont::CellSetSingleType<>;
const CellSetType& cells = dcells.Cast<CellSetType>();
const CellSetType& cells = dcells.AsCellSet<CellSetType>();
VTKM_TEST_ASSERT(cells.GetNumberOfCells() == 160, "");
}
}
@ -153,7 +153,7 @@ public:
vtkm::cont::DataSet dataSet = reader.ReadDataSet();
vtkm::cont::CellSetSingleType<> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::cont::ArrayHandle<vtkm::Float32> fieldArray;
dataSet.GetPointField("gyroid").GetData().AsArrayHandle(fieldArray);

@ -64,7 +64,7 @@ void TestExternalFacesExplicitGrid(const vtkm::cont::DataSet& ds,
// verify cellset
vtkm::cont::CellSetExplicit<> new_cellSet =
resultds.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>();
resultds.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>();
const vtkm::Id numOutputExtFaces = new_cellSet.GetNumberOfCells();
VTKM_TEST_ASSERT(numOutputExtFaces == numExpectedExtFaces, "Number of External Faces mismatch");

@ -193,14 +193,14 @@ static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id n
{
vtkm::Id2 dims(numI, numJ);
MakeExplicitCells(
cellSet.Cast<vtkm::cont::CellSetStructured<2>>(), dims, numIndices, shapes, conn);
cellSet.AsCellSet<vtkm::cont::CellSetStructured<2>>(), dims, numIndices, shapes, conn);
ds = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
}
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
{
vtkm::Id3 dims(numI, numJ, numK);
MakeExplicitCells(
cellSet.Cast<vtkm::cont::CellSetStructured<3>>(), dims, numIndices, shapes, conn);
cellSet.AsCellSet<vtkm::cont::CellSetStructured<3>>(), dims, numIndices, shapes, conn);
ds = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
}
@ -269,12 +269,12 @@ void TestGhostCellRemove()
{
if (nz == 0)
{
VTKM_TEST_ASSERT(output.GetCellSet().IsSameType(vtkm::cont::CellSetStructured<2>()),
VTKM_TEST_ASSERT(output.GetCellSet().CanConvert<vtkm::cont::CellSetStructured<2>>(),
"Wrong cell type for explicit conversion");
}
else if (nz > 0)
{
VTKM_TEST_ASSERT(output.GetCellSet().IsSameType(vtkm::cont::CellSetStructured<3>()),
VTKM_TEST_ASSERT(output.GetCellSet().CanConvert<vtkm::cont::CellSetStructured<3>>(),
"Wrong cell type for explicit conversion");
}
}

@ -31,7 +31,7 @@ void TestImageMedian()
vtkm::cont::ArrayHandle<vtkm::Float32> resultArrayHandle;
result.GetPointField("median").GetData().AsArrayHandle(resultArrayHandle);
auto cells = result.GetCellSet().Cast<vtkm::cont::CellSetStructured<3>>();
auto cells = result.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<3>>();
auto pdims = cells.GetPointDimensions();
//verified by hand

@ -165,8 +165,8 @@ void TestSplitSharpEdgesFilterNoSplit(vtkm::cont::DataSet& simpleCubeWithSN,
vtkm::cont::DataSet result = splitSharpEdgesFilter.Execute(simpleCubeWithSN);
auto newCoords = result.GetCoordinateSystem().GetDataAsMultiplexer();
vtkm::cont::CellSetExplicit<>& newCellset =
result.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::CellSetExplicit<> newCellset =
result.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>();
auto newCoordsP = newCoords.ReadPortal();
vtkm::cont::ArrayHandle<vtkm::FloatDefault> newPointvarField;
result.GetField("pointvar").GetData().AsArrayHandle(newPointvarField);

@ -244,7 +244,7 @@ void TestAMRStreamline(bool useSL)
//The seed that goes through the inner is broken up into two polylines
//the begining, and then the end.
VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == numSeeds + 1, "Wrong number of cells.");
auto explicitCells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
auto explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
for (vtkm::Id j = 0; j < numSeeds; j++)
{
vtkm::cont::ArrayHandle<vtkm::Id> indices;
@ -277,7 +277,7 @@ void TestAMRStreamline(bool useSL)
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type.");
VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == 1, "Wrong number of cells.");
explicitCells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Id> indices;
explicitCells.GetIndices(0, indices);
@ -415,7 +415,7 @@ void TestPartitionedDataSet(vtkm::Id num, bool useGhost, FilterType fType)
vtkm::cont::CellSetExplicit<> explicitCells;
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type.");
explicitCells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::FloatDefault xMax =
static_cast<vtkm::FloatDefault>(bounds[static_cast<std::size_t>(i)].X.Max);
@ -566,13 +566,13 @@ void TestStreamlineFile(const std::string& fname,
if (useSL)
{
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type");
auto cells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
auto cells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
ValidateEndPoints(cells, coords, numPoints, endPts);
}
else
{
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetSingleType<>>(), "Wrong cell type");
auto cells = dcells.Cast<vtkm::cont::CellSetSingleType<>>();
auto cells = dcells.AsCellSet<vtkm::cont::CellSetSingleType<>>();
ValidateEndPoints(cells, coords, numPoints, endPts);
}
}

@ -185,7 +185,7 @@ void TestAMRStreamline(FilterType fType, bool useThreaded)
//The seed that goes through the inner is broken up into two polylines
//the begining, and then the end.
VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == numSeeds + 1, "Wrong number of cells.");
auto explicitCells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
auto explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
for (vtkm::Id j = 0; j < numSeeds; j++)
{
vtkm::cont::ArrayHandle<vtkm::Id> indices;
@ -222,7 +222,7 @@ void TestAMRStreamline(FilterType fType, bool useThreaded)
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type.");
VTKM_TEST_ASSERT(dcells.GetNumberOfCells() == 1, "Wrong number of cells.");
auto explicitCells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
auto explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Id> indices;
explicitCells.GetIndices(0, indices);
@ -291,7 +291,7 @@ void ValidateOutput(const vtkm::cont::DataSet& out,
{
vtkm::cont::CellSetExplicit<> explicitCells;
VTKM_TEST_ASSERT(dcells.IsType<vtkm::cont::CellSetExplicit<>>(), "Wrong cell type.");
explicitCells = dcells.Cast<vtkm::cont::CellSetExplicit<>>();
explicitCells = dcells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
for (vtkm::Id j = 0; j < numSeeds; j++)
{
vtkm::cont::ArrayHandle<vtkm::Id> indices;

@ -52,7 +52,7 @@ void TestVertexClustering()
{
using CellSetType = vtkm::cont::CellSetSingleType<>;
CellSetType cellSet;
output.GetCellSet().CopyTo(cellSet);
output.GetCellSet().AsCellSet(cellSet);
auto cellArray =
cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
std::cerr << "output_pointIds = " << cellArray.GetNumberOfValues() << "\n";

@ -39,7 +39,7 @@ void ImageWriterBase::WriteDataSet(const vtkm::cont::DataSet& dataSet,
throw vtkm::cont::ErrorBadType(
"Image writers can only write data sets with 2D structured data.");
}
CellSetType cellSet = dataSet.GetCellSet().Cast<CellSetType>();
CellSetType cellSet = dataSet.GetCellSet().AsCellSet<CellSetType>();
vtkm::Id2 cellDimensions = cellSet.GetCellDimensions();
// Number of points is one more in each dimension than number of cells
vtkm::Id width = cellDimensions[0] + 1;

@ -520,32 +520,33 @@ void Write(std::ostream& out, const vtkm::cont::DataSet& dataSet, vtkm::io::File
if (cellSet.IsType<vtkm::cont::CellSetExplicit<>>())
{
WriteDataSetAsUnstructured(
out, dataSet, cellSet.Cast<vtkm::cont::CellSetExplicit<>>(), fileType);
out, dataSet, cellSet.AsCellSet<vtkm::cont::CellSetExplicit<>>(), fileType);
}
else if (cellSet.IsType<vtkm::cont::CellSetStructured<1>>())
{
WriteDataSetAsStructured(
out, dataSet, cellSet.Cast<vtkm::cont::CellSetStructured<1>>(), fileType);
out, dataSet, cellSet.AsCellSet<vtkm::cont::CellSetStructured<1>>(), fileType);
}
else if (cellSet.IsType<vtkm::cont::CellSetStructured<2>>())
{
WriteDataSetAsStructured(
out, dataSet, cellSet.Cast<vtkm::cont::CellSetStructured<2>>(), fileType);
out, dataSet, cellSet.AsCellSet<vtkm::cont::CellSetStructured<2>>(), fileType);
}
else if (cellSet.IsType<vtkm::cont::CellSetStructured<3>>())
{
WriteDataSetAsStructured(
out, dataSet, cellSet.Cast<vtkm::cont::CellSetStructured<3>>(), fileType);
out, dataSet, cellSet.AsCellSet<vtkm::cont::CellSetStructured<3>>(), fileType);
}
else if (cellSet.IsType<vtkm::cont::CellSetSingleType<>>())
{
// these function just like explicit cell sets
WriteDataSetAsUnstructured(
out, dataSet, cellSet.Cast<vtkm::cont::CellSetSingleType<>>(), fileType);
out, dataSet, cellSet.AsCellSet<vtkm::cont::CellSetSingleType<>>(), fileType);
}
else if (cellSet.IsType<vtkm::cont::CellSetExtrude>())
{
WriteDataSetAsUnstructured(out, dataSet, cellSet.Cast<vtkm::cont::CellSetExtrude>(), fileType);
WriteDataSetAsUnstructured(
out, dataSet, cellSet.AsCellSet<vtkm::cont::CellSetExtrude>(), fileType);
}
else
{

@ -413,10 +413,10 @@ public:
vtkm::cont::ArrayHandle<vtkm::Id3>& outputIndices,
vtkm::Id& output)
{
if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (cellset.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
vtkm::cont::CellSetStructured<3> cellSetStructured3D =
cellset.Cast<vtkm::cont::CellSetStructured<3>>();
cellset.AsCellSet<vtkm::cont::CellSetStructured<3>>();
const vtkm::Id numCells = cellSetStructured3D.GetNumberOfCells();
vtkm::cont::ArrayHandleCounting<vtkm::Id> cellIdxs(0, 1, numCells);

@ -79,7 +79,7 @@ void MapperVolume::RenderCells(const vtkm::cont::UnknownCellSet& cellset,
const vtkm::rendering::Camera& camera,
const vtkm::Range& scalarRange)
{
if (!cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (!cellset.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
std::stringstream msg;
std::string theType = typeid(cellset).name();
@ -116,7 +116,7 @@ void MapperVolume::RenderCells(const vtkm::cont::UnknownCellSet& cellset,
}
tracer.SetData(
coords, scalarField, cellset.Cast<vtkm::cont::CellSetStructured<3>>(), scalarRange);
coords, scalarField, cellset.AsCellSet<vtkm::cont::CellSetStructured<3>>(), scalarRange);
tracer.SetColorMap(this->ColorMap);
tracer.Render(rays);

@ -238,8 +238,8 @@ void MapperWireframer::RenderCells(const vtkm::cont::UnknownCellSet& inCellSet,
{
vtkm::cont::UnknownCellSet cellSet = inCellSet;
bool is1D = cellSet.IsSameType(vtkm::cont::CellSetStructured<1>());
bool is2D = cellSet.IsSameType(vtkm::cont::CellSetStructured<2>());
bool is1D = cellSet.CanConvert<vtkm::cont::CellSetStructured<1>>();
bool is2D = cellSet.CanConvert<vtkm::cont::CellSetStructured<2>>();
vtkm::cont::CoordinateSystem actualCoords = coords;
vtkm::cont::Field actualField = inScalarField;
@ -285,9 +285,9 @@ void MapperWireframer::RenderCells(const vtkm::cont::UnknownCellSet& inCellSet,
// Check for a cell set that is already lines
// Since there is no need to de external faces or
// render the depth of the mesh to hide internal zones
if (cellSet.IsSameType(vtkm::cont::CellSetSingleType<>()))
if (cellSet.CanConvert<vtkm::cont::CellSetSingleType<>>())
{
auto singleType = cellSet.Cast<vtkm::cont::CellSetSingleType<>>();
auto singleType = cellSet.AsCellSet<vtkm::cont::CellSetSingleType<>>();
isLines = singleType.GetCellShape(0) == vtkm::CELL_SHAPE_LINE;
}

@ -305,10 +305,10 @@ public:
{
vtkm::cont::Invoker invoke;
if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (cellset.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
vtkm::cont::CellSetStructured<3> cellSetStructured3D =
cellset.Cast<vtkm::cont::CellSetStructured<3>>();
cellset.AsCellSet<vtkm::cont::CellSetStructured<3>>();
const vtkm::Id numCells = cellSetStructured3D.GetNumberOfCells();
vtkm::cont::ArrayHandleIndex cellIdxs(numCells);
@ -317,10 +317,10 @@ public:
output = numCells * QUAD_PER_CSS;
}
else if (cellset.IsSameType(vtkm::cont::CellSetStructured<2>()))
else if (cellset.CanConvert<vtkm::cont::CellSetStructured<2>>())
{
vtkm::cont::CellSetStructured<2> cellSetStructured2D =
cellset.Cast<vtkm::cont::CellSetStructured<2>>();
cellset.AsCellSet<vtkm::cont::CellSetStructured<2>>();
const vtkm::Id numCells = cellSetStructured2D.GetNumberOfCells();
vtkm::cont::ArrayHandleIndex cellIdxs(numCells);

@ -646,7 +646,7 @@ public:
vtkm::Id& outputTriangles)
{
bool fastPath = false;
if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (cellset.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
//vtkm::cont::CellSetStructured<3> cellSetStructured3D =
// cellset.Cast<vtkm::cont::CellSetStructured<3>>();
@ -656,7 +656,7 @@ public:
//outputTriangles = outputIndices.GetNumberOfValues();
//fastPath = true;
vtkm::cont::CellSetStructured<3> cellSetStructured3D =
cellset.Cast<vtkm::cont::CellSetStructured<3>>();
cellset.AsCellSet<vtkm::cont::CellSetStructured<3>>();
const vtkm::Id numCells = cellSetStructured3D.GetNumberOfCells();
vtkm::cont::ArrayHandleCounting<vtkm::Id> cellIdxs(0, 1, numCells);
@ -666,10 +666,10 @@ public:
outputTriangles = numCells * 12;
}
else if (cellset.IsSameType(vtkm::cont::CellSetStructured<2>()))
else if (cellset.CanConvert<vtkm::cont::CellSetStructured<2>>())
{
vtkm::cont::CellSetStructured<2> cellSetStructured2D =
cellset.Cast<vtkm::cont::CellSetStructured<2>>();
cellset.AsCellSet<vtkm::cont::CellSetStructured<2>>();
const vtkm::Id numCells = cellSetStructured2D.GetNumberOfCells();
vtkm::cont::ArrayHandleCounting<vtkm::Id> cellIdxs(0, 1, numCells);

@ -253,9 +253,9 @@ void CylinderExtractor::SetCylinderIdsFromCells(const vtkm::cont::UnknownCellSet
//
// look for points in the cell set
//
if (cells.IsSameType(vtkm::cont::CellSetExplicit<>()))
if (cells.CanConvert<vtkm::cont::CellSetExplicit<>>())
{
auto cellsExplicit = cells.Cast<vtkm::cont::CellSetExplicit<>>();
auto cellsExplicit = cells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Id> points;
vtkm::worklet::DispatcherMapTopology<detail::CountSegments>(detail::CountSegments())

@ -854,14 +854,15 @@ MeshConnectivityContainer* MeshConnectivityBuilder::BuildConnectivity(
};
MeshType type = Unsupported;
if (cellset.IsSameType(vtkm::cont::CellSetExplicit<>()))
if (cellset.CanConvert<vtkm::cont::CellSetExplicit<>>())
{
type = Unstructured;
}
else if (cellset.IsSameType(vtkm::cont::CellSetSingleType<>()))
else if (cellset.CanConvert<vtkm::cont::CellSetSingleType<>>())
{
vtkm::cont::CellSetSingleType<> singleType = cellset.Cast<vtkm::cont::CellSetSingleType<>>();
vtkm::cont::CellSetSingleType<> singleType =
cellset.AsCellSet<vtkm::cont::CellSetSingleType<>>();
//
// Now we need to determine what type of cells this holds
//
@ -877,7 +878,7 @@ MeshConnectivityContainer* MeshConnectivityBuilder::BuildConnectivity(
if (shapeType == CELL_SHAPE_PYRAMID)
type = UnstructuredSingle;
}
else if (cellset.IsSameType(vtkm::cont::CellSetStructured<3>()))
else if (cellset.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
type = Structured;
}
@ -897,21 +898,21 @@ MeshConnectivityContainer* MeshConnectivityBuilder::BuildConnectivity(
if (type == Unstructured)
{
vtkm::cont::CellSetExplicit<> cells = cellset.Cast<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::CellSetExplicit<> cells = cellset.AsCellSet<vtkm::cont::CellSetExplicit<>>();
this->BuildConnectivity(cells, coordinates.GetDataAsMultiplexer(), coordBounds);
meshConn = new MeshConnectivityContainerUnstructured(
cells, coordinates, FaceConnectivity, FaceOffsets, Triangles);
}
else if (type == UnstructuredSingle)
{
vtkm::cont::CellSetSingleType<> cells = cellset.Cast<vtkm::cont::CellSetSingleType<>>();
vtkm::cont::CellSetSingleType<> cells = cellset.AsCellSet<vtkm::cont::CellSetSingleType<>>();
this->BuildConnectivity(cells, coordinates.GetDataAsMultiplexer(), coordBounds);
meshConn =
new MeshConnectivityContainerSingleType(cells, coordinates, FaceConnectivity, Triangles);
}
else if (type == Structured)
{
vtkm::cont::CellSetStructured<3> cells = cellset.Cast<vtkm::cont::CellSetStructured<3>>();
vtkm::cont::CellSetStructured<3> cells = cellset.AsCellSet<vtkm::cont::CellSetStructured<3>>();
Triangles = this->ExternalTrianglesStructured(cells);
meshConn = new MeshConnectivityContainerStructured(cells, coordinates, Triangles);
}

@ -219,9 +219,9 @@ void QuadExtractor::SetQuadIdsFromCells(const vtkm::cont::UnknownCellSet& cells)
//
// look for points in the cell set
//
if (cells.IsSameType(vtkm::cont::CellSetExplicit<>()))
if (cells.CanConvert<vtkm::cont::CellSetExplicit<>>())
{
auto cellsExplicit = cells.Cast<vtkm::cont::CellSetExplicit<>>();
auto cellsExplicit = cells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Id> points;
vtkm::worklet::DispatcherMapTopology<detail::CountQuads>(detail::CountQuads())

@ -223,9 +223,9 @@ void SphereExtractor::SetPointIdsFromCells(const vtkm::cont::UnknownCellSet& cel
//
// look for points in the cell set
//
if (cells.IsSameType(vtkm::cont::CellSetExplicit<>()))
if (cells.CanConvert<vtkm::cont::CellSetExplicit<>>())
{
auto cellsExplicit = cells.Cast<vtkm::cont::CellSetExplicit<>>();
auto cellsExplicit = cells.AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Id> points;
vtkm::worklet::DispatcherMapTopology<detail::CountPoints>(detail::CountPoints())
@ -241,9 +241,9 @@ void SphereExtractor::SetPointIdsFromCells(const vtkm::cont::UnknownCellSet& cel
vtkm::worklet::DispatcherMapTopology<detail::Pointify>(detail::Pointify())
.Invoke(cellsExplicit, cellOffsets, this->PointIds);
}
else if (cells.IsSameType(SingleType()))
else if (cells.CanConvert<SingleType>())
{
SingleType pointCells = cells.Cast<SingleType>();
SingleType pointCells = cells.AsCellSet<SingleType>();
vtkm::UInt8 shape_id = pointCells.GetCellShape(0);
if (shape_id == vtkm::CELL_SHAPE_VERTEX)
{

@ -328,7 +328,7 @@ public:
// Get information from input dataset
vtkm::cont::CellSetStructured<3> inCellSet;
InDataSet.GetCellSet().CopyTo(inCellSet);
InDataSet.GetCellSet().AsCellSet(inCellSet);
vtkm::Id3 vdims = inCellSet.GetSchedulingRange(vtkm::TopologyElementTagPoint());
vtkm::cont::ArrayHandle<vtkm::Vec<FieldType, 3>> fieldArray;

@ -221,8 +221,8 @@ public:
using ExplCoordsType = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
if (!(coords.GetData().IsType<ExplCoordsType>() &&
(cellset.IsSameType(vtkm::cont::CellSetExplicit<>()) ||
cellset.IsSameType(vtkm::cont::CellSetSingleType<>()))))
(cellset.CanConvert<vtkm::cont::CellSetExplicit<>>() ||
cellset.CanConvert<vtkm::cont::CellSetSingleType<>>())))
{
throw vtkm::cont::ErrorBadValue("Stream surface requires polyline data.");
}

@ -544,8 +544,8 @@ public:
{
using NormalsType = vtkm::cont::ArrayHandle<vtkm::Vec3f>;
if (!cellset.IsSameType(vtkm::cont::CellSetExplicit<>()) &&
!cellset.IsSameType(vtkm::cont::CellSetSingleType<>()))
if (!cellset.CanConvert<vtkm::cont::CellSetExplicit<>>() &&
!cellset.CanConvert<vtkm::cont::CellSetSingleType<>>())
{
throw vtkm::cont::ErrorBadValue("Tube filter only supported for polyline data.");
}

@ -26,18 +26,18 @@ public:
VTKM_CONT
GridMetaData(const vtkm::cont::UnknownCellSet cellSet)
{
if (cellSet.IsType<Structured2DType>())
if (cellSet.CanConvert<Structured2DType>())
{
this->cellSet2D = true;
vtkm::Id2 dims =
cellSet.Cast<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
cellSet.AsCellSet<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
this->Dims = vtkm::Id3(dims[0], dims[1], 1);
}
else
{
this->cellSet2D = false;
this->Dims =
cellSet.Cast<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
cellSet.AsCellSet<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
}
this->PlaneSize = Dims[0] * Dims[1];
this->RowSize = Dims[0];

@ -197,29 +197,29 @@ public:
VTKM_CONT
CellInterpolationHelper(const vtkm::cont::UnknownCellSet& cellSet)
{
if (cellSet.IsSameType(Structured2DType()))
if (cellSet.CanConvert<Structured2DType>())
{
this->Is3D = false;
vtkm::Id2 cellDims =
cellSet.Cast<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
cellSet.AsCellSet<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
vtkm::Id2 pointDims =
cellSet.Cast<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
cellSet.AsCellSet<Structured2DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
this->CellDims = vtkm::Id3(cellDims[0], cellDims[1], 0);
this->PointDims = vtkm::Id3(pointDims[0], pointDims[1], 1);
this->Type = vtkm::exec::CellInterpolationHelper::HelperType::STRUCTURED;
}
else if (cellSet.IsSameType(Structured3DType()))
else if (cellSet.CanConvert<Structured3DType>())
{
this->Is3D = true;
this->CellDims =
cellSet.Cast<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
cellSet.AsCellSet<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
this->PointDims =
cellSet.Cast<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
cellSet.AsCellSet<Structured3DType>().GetSchedulingRange(vtkm::TopologyElementTagPoint());
this->Type = vtkm::exec::CellInterpolationHelper::HelperType::STRUCTURED;
}
else if (cellSet.IsSameType(SingleExplicitType()))
else if (cellSet.CanConvert<SingleExplicitType>())
{
SingleExplicitType CellSet = cellSet.Cast<SingleExplicitType>();
SingleExplicitType CellSet = cellSet.AsCellSet<SingleExplicitType>();
const auto cellShapes =
CellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
const auto numIndices =
@ -230,9 +230,9 @@ public:
vtkm::TopologyElementTagPoint());
this->Type = vtkm::exec::CellInterpolationHelper::HelperType::EXPSINGLE;
}
else if (cellSet.IsSameType(ExplicitType()))
else if (cellSet.CanConvert<ExplicitType>())
{
vtkm::cont::CellSetExplicit<> CellSet = cellSet.Cast<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::CellSetExplicit<> CellSet = cellSet.AsCellSet<vtkm::cont::CellSetExplicit<>>();
Shape =
CellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
Offset =

@ -152,14 +152,14 @@ inline vtkm::cont::DataSet CreateExplicitFromStructuredDataSet(const vtkm::Bound
case ExplicitDataSetOption::SINGLE:
if (cellSet.IsType<Structured2DType>())
{
Structured2DType cells2D = cellSet.Cast<Structured2DType>();
Structured2DType cells2D = cellSet.AsCellSet<Structured2DType>();
vtkm::Id2 cellDims = cells2D.GetCellDimensions();
MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn);
output = dsb.Create(explCoords, vtkm::CellShapeTagQuad(), 4, conn, "coordinates");
}
else
{
Structured3DType cells3D = cellSet.Cast<Structured3DType>();
Structured3DType cells3D = cellSet.AsCellSet<Structured3DType>();
vtkm::Id3 cellDims = cells3D.GetCellDimensions();
MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn);
output = dsb.Create(explCoords, vtkm::CellShapeTagHexahedron(), 8, conn, "coordinates");
@ -176,14 +176,14 @@ inline vtkm::cont::DataSet CreateExplicitFromStructuredDataSet(const vtkm::Bound
case ExplicitDataSetOption::EXPLICIT:
if (cellSet.IsType<Structured2DType>())
{
Structured2DType cells2D = cellSet.Cast<Structured2DType>();
Structured2DType cells2D = cellSet.AsCellSet<Structured2DType>();
vtkm::Id2 cellDims = cells2D.GetCellDimensions();
MakeExplicitCells(cells2D, cellDims, numIndices, shapes, conn);
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");
}
else
{
Structured3DType cells3D = cellSet.Cast<Structured3DType>();
Structured3DType cells3D = cellSet.AsCellSet<Structured3DType>();
vtkm::Id3 cellDims = cells3D.GetCellDimensions();
MakeExplicitCells(cells3D, cellDims, numIndices, shapes, conn);
output = dsb.Create(explCoords, shapes, numIndices, conn, "coordinates");

@ -25,7 +25,7 @@ vtkm::cont::CellSetExplicit<> CreateCellSet()
vtkm::cont::testing::MakeTestDataSet makeData;
vtkm::cont::DataSet data = makeData.Make3DExplicitDataSet0();
vtkm::cont::CellSetExplicit<> cellSet;
data.GetCellSet().CopyTo(cellSet);
data.GetCellSet().AsCellSet(cellSet);
return cellSet;
}

@ -33,7 +33,7 @@ public:
filter.SetActiveField("tangle");
vtkm::cont::DataSet outputData = filter.Execute(dataSet);
auto cellSet = outputData.GetCellSet().Cast<vtkm::cont::CellSetSingleType<>>();
auto cellSet = outputData.GetCellSet().AsCellSet<vtkm::cont::CellSetSingleType<>>();
vtkm::cont::ArrayHandle<vtkm::Id> componentArray;
vtkm::worklet::connectivity::CellSetConnectivity().Run(cellSet, componentArray);
@ -48,7 +48,7 @@ public:
{
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5();
auto cellSet = dataSet.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>();
auto cellSet = dataSet.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Id> componentArray;
vtkm::worklet::connectivity::CellSetConnectivity().Run(cellSet, componentArray);

@ -193,7 +193,7 @@ void TestContourUniformGrid()
vtkm::cont::DataSet dataSet = genIds.Execute(tangle.Execute());
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::cont::ArrayHandle<vtkm::Float32> pointFieldArray;
dataSet.GetField("tangle").GetData().AsArrayHandle(pointFieldArray);
vtkm::cont::ArrayHandle<vtkm::FloatDefault> cellFieldArray;
@ -310,7 +310,7 @@ void TestContourExplicit()
vtkm::cont::DataSet dataSet = dataSetGenerator.Make3DRadiantDataSet(Dimension);
DataSetGenerator::CellSet cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::cont::Field contourField = dataSet.GetField("distanceToOrigin");
DataSetGenerator::DataArrayHandle contourArray;
@ -377,7 +377,7 @@ void TestContourClipped()
vtkm::cont::DataSet clipped = clip.Execute(dataSet);
vtkm::cont::CellSetExplicit<> cellSet;
clipped.GetCellSet().CopyTo(cellSet);
clipped.GetCellSet().AsCellSet(cellSet);
vtkm::cont::ArrayHandle<vtkm::Float32> pointFieldArray;
clipped.GetField("tangle").GetData().AsArrayHandle(pointFieldArray);
vtkm::cont::ArrayHandle<vtkm::FloatDefault> cellFieldArray;

@ -78,7 +78,7 @@ public:
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1();
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
vtkm::Id nRows = pointDimensions[0];
@ -124,7 +124,7 @@ public:
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
vtkm::Id nRows = pointDimensions[0];

@ -371,7 +371,7 @@ private:
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
@ -719,7 +719,7 @@ public:
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1();
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id2 pointDimensions2D = cellSet.GetPointDimensions();
vtkm::Id3 meshSize{ pointDimensions2D[0], pointDimensions2D[1], 1 };
@ -786,7 +786,7 @@ public:
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
@ -859,7 +859,7 @@ public:
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();

@ -30,15 +30,16 @@ vtkm::cont::DataSet RunExternalFaces(vtkm::cont::DataSet& inDataSet)
vtkm::cont::CellSetExplicit<> outCellSet;
//Run the External Faces worklet
if (inCellSet.IsSameType(vtkm::cont::CellSetStructured<3>()))
if (inCellSet.CanConvert<vtkm::cont::CellSetStructured<3>>())
{
vtkm::worklet::ExternalFaces().Run(inCellSet.Cast<vtkm::cont::CellSetStructured<3>>(),
vtkm::worklet::ExternalFaces().Run(inCellSet.AsCellSet<vtkm::cont::CellSetStructured<3>>(),
inDataSet.GetCoordinateSystem(),
outCellSet);
}
else
{
vtkm::worklet::ExternalFaces().Run(inCellSet.Cast<vtkm::cont::CellSetExplicit<>>(), outCellSet);
vtkm::worklet::ExternalFaces().Run(inCellSet.AsCellSet<vtkm::cont::CellSetExplicit<>>(),
outCellSet);
}
vtkm::cont::DataSet outDataSet;
@ -97,7 +98,7 @@ void TestExternalFaces1()
//Run the External Faces worklet
vtkm::cont::DataSet new_ds = RunExternalFaces(ds);
vtkm::cont::CellSetExplicit<> new_cs;
new_ds.GetCellSet().CopyTo(new_cs);
new_ds.GetCellSet().AsCellSet(new_cs);
vtkm::Id numExtFaces_out = new_cs.GetNumberOfCells();
@ -125,7 +126,7 @@ void TestExternalFaces2()
vtkm::cont::DataSet outDataSet = RunExternalFaces(inDataSet);
vtkm::cont::CellSetExplicit<> outCellSet;
outDataSet.GetCellSet().CopyTo(outCellSet);
outDataSet.GetCellSet().AsCellSet(outCellSet);
VTKM_TEST_ASSERT(outCellSet.GetNumberOfCells() == NUM_FACES, "Got wrong number of faces.");
@ -168,7 +169,7 @@ void TestExternalFaces3()
//Run the External Faces worklet
vtkm::cont::DataSet new_ds = RunExternalFaces(dataSet);
vtkm::cont::CellSetExplicit<> new_cs;
new_ds.GetCellSet().CopyTo(new_cs);
new_ds.GetCellSet().AsCellSet(new_cs);
vtkm::Id numExtFaces_out = new_cs.GetNumberOfCells();

@ -29,7 +29,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Cells to extract
vtkm::cont::ArrayHandle<vtkm::Id> cellIds = vtkm::cont::make_ArrayHandle<vtkm::Id>({ 1, 2 });
@ -60,7 +60,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Implicit function
vtkm::Vec3f minPoint(0.5f, 0.0f, 0.0f);
@ -103,7 +103,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet1();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Cells to extract
vtkm::cont::ArrayHandle<vtkm::Id> cellIds =
@ -136,7 +136,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Cells to extract
vtkm::cont::ArrayHandle<vtkm::Id> cellIds =
@ -168,7 +168,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Implicit function
vtkm::Vec3f minPoint(1.0f, 1.0f, 1.0f);
@ -208,7 +208,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Implicit function
vtkm::Vec3f center(2.f, 2.f, 2.f);

@ -27,7 +27,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
// RangeId3 and subsample
vtkm::RangeId3 range(1, 4, 1, 4, 0, 1);
@ -52,7 +52,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::worklet::ExtractStructured worklet;
vtkm::worklet::ExtractStructured::UncertainCellSetStructured outCellSet;
@ -118,7 +118,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet1();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::worklet::ExtractStructured worklet;
vtkm::worklet::ExtractStructured::UncertainCellSetStructured outCellSet;
@ -169,7 +169,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DRectilinearDataSet0();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
// RangeId3 and subsample
vtkm::RangeId3 range(0, 2, 0, 2, 0, 1);
@ -195,7 +195,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DRectilinearDataSet0();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
// RangeId3 and subsample
vtkm::RangeId3 range(0, 2, 0, 2, 0, 2);
@ -235,13 +235,14 @@ public:
VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), no_offset));
vtkm::Id3 cellDims =
outCellSet.Cast<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
outCellSet.AsCellSet<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
includeOffset = true;
cellSet.SetGlobalPointIndexStart(test_offset);
outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
cellDims = outCellSet.Cast<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
CellSetType cs = outCellSet.Cast<CellSetType>();
cellDims =
outCellSet.AsCellSet<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
CellSetType cs = outCellSet.AsCellSet<CellSetType>();
cellDims = cs.GetPointDimensions();
VTKM_TEST_ASSERT(test_equal(cellDims, new_dims));
VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), test_offset));
@ -264,7 +265,7 @@ public:
vtkm::worklet::ExtractStructured worklet;
auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
CellSetType cs = outCellSet.Cast<CellSetType>();
CellSetType cs = outCellSet.AsCellSet<CellSetType>();
vtkm::Id3 cellDims = cs.GetPointDimensions();
VTKM_TEST_ASSERT(test_equal(cellDims, test_dims));
VTKM_TEST_ASSERT(test_equal(cs.GetGlobalPointIndexStart(), test_offset));
@ -284,7 +285,7 @@ public:
vtkm::worklet::ExtractStructured worklet;
auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
CellSetType cs = outCellSet.Cast<CellSetType>();
CellSetType cs = outCellSet.AsCellSet<CellSetType>();
VTKM_TEST_ASSERT(test_equal(cs.GetPointDimensions(), test_dims));
}
void TestOffset2D() const
@ -305,13 +306,14 @@ public:
auto outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), no_offset));
vtkm::Id2 cellDims =
outCellSet.Cast<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
outCellSet.AsCellSet<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
// Test with offset now
includeOffset = true;
cellSet.SetGlobalPointIndexStart(test_offset);
outCellSet = worklet.Run(cellSet, range, sample, includeBoundary, includeOffset);
cellDims = outCellSet.Cast<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
CellSetType cs = outCellSet.Cast<CellSetType>();
cellDims =
outCellSet.AsCellSet<CellSetType>().GetSchedulingRange(vtkm::TopologyElementTagCell());
CellSetType cs = outCellSet.AsCellSet<CellSetType>();
cellDims = cs.GetPointDimensions();
VTKM_TEST_ASSERT(test_equal(cellDims, new_dims));
VTKM_TEST_ASSERT(test_equal(cellSet.GetGlobalPointIndexStart(), test_offset));

@ -45,7 +45,7 @@ public:
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::ImageConnectivity().Run(
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(),
data.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<2>>(),
colorField.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::UInt8>>(),
component);
@ -79,7 +79,7 @@ public:
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::ImageConnectivity().Run(
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(),
data.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<2>>(),
colorField.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::UInt8>>(),
component);
@ -118,7 +118,7 @@ public:
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::ImageConnectivity().Run(
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<2>>(),
data.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<2>>(),
colorField.GetData().AsArrayHandle<vtkm::cont::ArrayHandle<vtkm::UInt8>>(),
component);

@ -36,7 +36,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet1();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Output data set permutation
vtkm::worklet::Mask maskCells;
@ -62,7 +62,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet1();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Output data set with cell set permuted
vtkm::worklet::Mask maskCells;
@ -89,7 +89,7 @@ public:
// Input data set created
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet5();
CellSetType cellSet;
dataset.GetCellSet().CopyTo(cellSet);
dataset.GetCellSet().AsCellSet(cellSet);
// Output data set with cell set permuted
vtkm::worklet::Mask maskCells;

@ -137,7 +137,7 @@ struct ValidateNormals
const vtkm::cont::Field& pointNormalsField,
const vtkm::cont::Field& cellNormalsField)
: Coords{ dataset.GetCoordinateSystem() }
, Cells{ dataset.GetCellSet().Cast<CellSetType>() }
, Cells{ dataset.GetCellSet().AsCellSet<CellSetType>() }
, Points{ this->Coords.GetDataAsMultiplexer() }
, CheckPoints(checkPoints)
, CheckCells(checkCells)

@ -103,7 +103,7 @@ void TestMapWorklet()
vtkm::cont::DataSet data = builder.Make3DUniformDataSet1();
vtkm::cont::CellSetStructured<3> cellSet =
data.GetCellSet().Cast<vtkm::cont::CellSetStructured<3>>();
data.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<3>>();
vtkm::Id numPoints = cellSet.GetNumberOfPoints();
vtkm::cont::ArrayHandle<FieldType> inField;

@ -132,7 +132,7 @@ struct DoTestWorklet
vtkm::cont::DataSet dataSet3D = testDataSet.Make3DUniformDataSet0();
vtkm::cont::CellSetStructured<3> cellSet =
dataSet3D.GetCellSet().Cast<vtkm::cont::CellSetStructured<3>>();
dataSet3D.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<3>>();
vtkm::cont::Invoker invoker;
invoker(WorkletType{}, cellSet, dataSet3D.GetCoordinateSystem());
@ -153,7 +153,7 @@ struct DoTestWorklet<TestWorkletMapTopoSelect>
std::vector<vtkm::IdComponent>(static_cast<std::size_t>(dataSet3D.GetNumberOfPoints()), 0));
vtkm::cont::CellSetStructured<3> cellSet =
dataSet3D.GetCellSet().Cast<vtkm::cont::CellSetStructured<3>>();
dataSet3D.GetCellSet().AsCellSet<vtkm::cont::CellSetStructured<3>>();
vtkm::cont::Invoker invoker;
invoker(TestWorkletMapTopoSelect{},

@ -144,7 +144,7 @@ void TestStreamLineUniformGrid()
// Check output
vtkm::cont::CellSetExplicit<> outCellSet;
outDataSet.GetCellSet().CopyTo(outCellSet);
outDataSet.GetCellSet().AsCellSet(outCellSet);
auto coordArray = outDataSet.GetCoordinateSystem(0).GetData();
vtkm::Id numberOfCells = outCellSet.GetNumberOfCells();

@ -35,7 +35,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DUniformDataSet0();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
// Convert uniform hexahedra to tetrahedra
vtkm::worklet::Tetrahedralize tetrahedralize;
@ -63,7 +63,7 @@ public:
// Create the input explicit cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make3DExplicitDataSet5();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::cont::ArrayHandle<vtkm::IdComponent> outCellsPerCell;
// Convert explicit cells to tetrahedra

@ -92,7 +92,7 @@ public:
vtkm::cont::DataSet dataset = MakeTestDataSet().Make2DUniformDataSet0();
CellSetType cellset;
dataset.GetCellSet().CopyTo(cellset);
dataset.GetCellSet().AsCellSet(cellset);
vtkm::cont::ArrayHandle<vtkm::Float32> pointvar;
dataset.GetField("pointvar").GetData().AsArrayHandle(pointvar);
@ -152,7 +152,7 @@ public:
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DUniformDataSet0();
CellSetType cellset;
dataset.GetCellSet().CopyTo(cellset);
dataset.GetCellSet().AsCellSet(cellset);
vtkm::cont::ArrayHandle<vtkm::Float32> pointvar;
dataset.GetField("pointvar").GetData().AsArrayHandle(pointvar);
@ -217,7 +217,7 @@ public:
vtkm::cont::DataSet dataset = MakeTestDataSet().Make3DExplicitDataSet0();
CellSetType cellset;
dataset.GetCellSet().CopyTo(cellset);
dataset.GetCellSet().AsCellSet(cellset);
vtkm::cont::ArrayHandle<vtkm::Float32> cellvar;
dataset.GetField("cellvar").GetData().AsArrayHandle(cellvar);

@ -52,7 +52,7 @@ vtkm::cont::DataSet GenerateDataSet()
void Validate(vtkm::cont::DataSet dataSet)
{
const auto cellSet = dataSet.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>();
const auto cellSet = dataSet.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>();
const auto coordsArray = dataSet.GetCoordinateSystem().GetDataAsMultiplexer();
const auto conn =
cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell{}, vtkm::TopologyElementTagPoint{});
@ -109,7 +109,7 @@ void DoTest()
VTKM_TEST_ASSERT(threw, "Test dataset is already wound consistently wrt normals.");
auto cellSet = ds.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>();
auto cellSet = ds.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>();
const auto coords = ds.GetCoordinateSystem().GetData();
const auto cellNormalsVar = ds.GetCellField("normals").GetData();
const auto cellNormals = cellNormalsVar.AsArrayHandle<vtkm::cont::ArrayHandle<MyNormalT>>();

@ -30,7 +30,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DUniformDataSet1();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
// Convert uniform quadrilaterals to triangles
vtkm::worklet::Triangulate triangulate;
@ -55,7 +55,7 @@ public:
// Create the input uniform cell set
vtkm::cont::DataSet dataSet = MakeTestDataSet().Make2DExplicitDataSet0();
CellSetType cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::cont::ArrayHandle<vtkm::IdComponent> outCellsPerCell;
// Convert explicit cells to triangles

@ -57,7 +57,7 @@ void TestVertexClustering()
{
using CellSetType = vtkm::cont::CellSetSingleType<>;
CellSetType cellSet;
outDataSet.GetCellSet().CopyTo(cellSet);
outDataSet.GetCellSet().AsCellSet(cellSet);
auto cellArray =
cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
std::cerr << "output_pointIds = " << cellArray.GetNumberOfValues() << "\n";
@ -90,7 +90,7 @@ void TestVertexClustering()
using CellSetType = vtkm::cont::CellSetSingleType<>;
CellSetType cellSet;
outDataSet.GetCellSet().CopyTo(cellSet);
outDataSet.GetCellSet().AsCellSet(cellSet);
VTKM_TEST_ASSERT(
cellSet.GetConnectivityArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint())
.GetNumberOfValues() == output_pointIds,

@ -187,7 +187,7 @@ void TryExplicitGrid()
std::cout << "Testing explicit grid." << std::endl;
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5();
vtkm::cont::CellSetExplicit<> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::UInt8 expectedCellShapes[] = { vtkm::CELL_SHAPE_HEXAHEDRON,
vtkm::CELL_SHAPE_PYRAMID,
@ -223,7 +223,7 @@ void TryCellSetPermutation()
std::cout << "Testing permutation grid." << std::endl;
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DExplicitDataSet5();
vtkm::cont::CellSetExplicit<> originalCellSet;
dataSet.GetCellSet().CopyTo(originalCellSet);
dataSet.GetCellSet().AsCellSet(originalCellSet);
vtkm::Id permutationArray[] = { 2, 0, 1 };
@ -255,7 +255,7 @@ void TryStructuredGrid3D()
std::cout << "Testing 3D structured grid." << std::endl;
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make3DUniformDataSet0();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id expectedCellIndexSum[4] = { 40, 48, 88, 96 };
@ -285,7 +285,7 @@ void TryStructuredGrid2D()
std::cout << "Testing 2D structured grid." << std::endl;
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make2DUniformDataSet0();
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id expectedCellIndexSum[2] = { 8, 12 };
@ -314,7 +314,7 @@ void TryStructuredGrid1D()
std::cout << "Testing 1D structured grid." << std::endl;
vtkm::cont::DataSet dataSet = vtkm::cont::testing::MakeTestDataSet().Make1DUniformDataSet0();
vtkm::cont::CellSetStructured<1> cellSet;
dataSet.GetCellSet().CopyTo(cellSet);
dataSet.GetCellSet().AsCellSet(cellSet);
vtkm::Id expectedCellIndexSum[5] = { 1, 3, 5, 7, 9 };

@ -82,7 +82,7 @@ static void TestMaxPointOrCell()
std::cout << "Testing MaxPointOfCell worklet" << std::endl;
vtkm::cont::testing::MakeTestDataSet testDataSet;
vtkm::cont::DataSet dataSet = testDataSet.Make3DExplicitDataSet0();
auto cellset = dataSet.GetCellSet().Cast<vtkm::cont::CellSetExplicit<>>();
auto cellset = dataSet.GetCellSet().AsCellSet<vtkm::cont::CellSetExplicit<>>();
vtkm::cont::ArrayHandle<vtkm::Float32> result;