Remove multiple vtkm::cont::CellSet from vtkm::cont::DataSet

By removing the ability to have multiple CellSets in a DataSet
we can simplify the following things:

  - Cell Fields now don't require a CellSet name when being constructed
  - Filters don't need to manage what the active cellset is
This commit is contained in:
Robert Maynard 2019-08-13 13:08:54 -04:00
parent 80fa659e3f
commit 89fa2c0293
156 changed files with 627 additions and 1238 deletions

@ -1,6 +1,6 @@
# DataSet queries for CellSet and Coordinate System Indices don't throw
# DataSet queries for CoordinateSystem Indices don't throw
Asking for the index of a `vtkm::cont::CellSet` or `vtkm::cont::CoordinateSystem` by
Asking for the index of a `vtkm::cont::CoordinateSystem` by
name now returns a `-1` when no matching item has been found instead of throwing
an exception.

@ -0,0 +1,29 @@
# DataSet only has a single vtkm::cont::CellSet
Multiple `vtkm::cont::CellSets` on a datasets increased the
complexity of using VTK-m correctly without any significant
benefits.
It had the effect that `vtkm::cont::Fields` that representing
cell fields needed to be associated with a given cellset. This
has to be a loose coupling to allow for filters to generate
new output cellsets. At the same time it introduced errors when
that output had a different name.
It raised questions about how should filters propagate cell fields.
Should a filter drop all cell fields not associated with the active
CellSet, or is that too aggressive given the fact that maybe the
algorithm just mistakenly named the field, or the IO routine added
a field with the wrong cellset name.
It increased the complexity of filters, as the developer needed to
determine if the algorithm should support execution on a single `CellSet` or
execution over all `CellSets`.
Given these issues it was deemed that removing multiple `CellSets` was
the correct way forward. People using multiple `CellSets` will need to
move over to `vtkm::cont::MultiBlock` which supports shared points and
fields between multiple blocks.

@ -0,0 +1,5 @@
# Fields now don't require the associated CellSet name
Now that `vtkm::cont::DataSet` can only have a single `vtkm::cont::CellSet`
the requirement that cell based `vtkm::cont::Field`s need a CellSet name
has been lifted.

@ -1,6 +0,0 @@
# FilterField now tries to be smart when selecting active cellset
Now when a calls a `vtkm::filter::FilterField` algorithm without an explicit
active CellSet, if the field is cell based we set the active `vtkm::cont::CellSet`
to be the one associated with that field. If that `vtkm::cont::CellSet` doesn't
exist we default back to using the first CellSet in the input `vtkm::cont::DataSet`.

@ -0,0 +1,4 @@
# vtkm::cont::Filter now don't have an active cell set
`vtkm::filter::FilterField` has removed the concept of `ActiveCellSetIndex`. This
has been done as `vtkm::cont::DataSet` now only contains a single `vtkm::cont::CellSet`.

@ -115,7 +115,7 @@ public:
vtkm::cont::ArrayHandle<vtkm::Vec4ui_8> colors;
//get the coordinate system we are using for the 2D area
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
//get the previous state of the game
input.GetField("state", vtkm::cont::Field::Association::POINTS).GetData().CopyTo(prevstate);
@ -126,15 +126,10 @@ public:
//save the results
vtkm::cont::DataSet output;
output.AddCellSet(input.GetCellSet(this->GetActiveCellSetIndex()));
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
vtkm::cont::Field colorField("colors", vtkm::cont::Field::Association::POINTS, colors);
output.AddField(colorField);
vtkm::cont::Field stateField("state", vtkm::cont::Field::Association::POINTS, state);
output.AddField(stateField);
output.CopyStructure(input);
output.AddField(vtkm::cont::make_FieldPoint("colors", colors));
output.AddField(vtkm::cont::make_FieldPoint("state", state));
return output;
}
@ -206,7 +201,7 @@ struct RenderGameOfLife
void render(vtkm::cont::DataSet& data)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
vtkm::Int32 arraySize = (vtkm::Int32)data.GetCoordinateSystem().GetNumberOfPoints();
vtkm::Int32 arraySize = (vtkm::Int32)data.GetNumberOfPoints();
UploadData task(&this->ColorState,
data.GetField("colors", vtkm::cont::Field::Association::POINTS));

@ -67,11 +67,11 @@ void TubeThatSpiral(vtkm::FloatDefault radius, vtkm::Id numLineSegments, vtkm::I
// This generates a new pointset, and new cell set.
vtkm::cont::ArrayHandle<vtkm::Vec3f> tubePoints;
vtkm::cont::CellSetSingleType<> tubeCells;
tubeWorklet.Run(ds.GetCoordinateSystem(0), ds.GetCellSet(0), tubePoints, tubeCells);
tubeWorklet.Run(ds.GetCoordinateSystem(), ds.GetCellSet(), tubePoints, tubeCells);
vtkm::cont::DataSet tubeDataset;
tubeDataset.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", tubePoints));
tubeDataset.AddCellSet(tubeCells);
tubeDataset.SetCellSet(tubeCells);
vtkm::Bounds coordsBounds = tubeDataset.GetCoordinateSystem().GetBounds();

@ -62,11 +62,11 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
using Integrator = vtkm::worklet::particleadvection::EulerIntegrator<GridEvaluator>;
GridEvaluator eval(ds1.GetCoordinateSystem(),
ds1.GetCellSet(0),
ds1.GetCellSet(),
fieldArray1,
0,
ds2.GetCoordinateSystem(),
ds2.GetCellSet(0),
ds2.GetCellSet(),
fieldArray2,
10.0);
@ -99,7 +99,7 @@ void RunTest(vtkm::Id numSteps, vtkm::Float32 stepSize, vtkm::Id advectType)
vtkm::worklet::StreamlineResult res = streamline.Run(integrator, seedArray, numSteps);
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outputCoords("coordinates", res.positions);
outData.AddCellSet(res.polyLines);
outData.SetCellSet(res.polyLines);
outData.AddCoordinateSystem(outputCoords);
renderAndWriteDataSet(outData);
}

@ -18,13 +18,27 @@ void DataSet::Clear()
{
this->CoordSystems.clear();
this->Fields.clear();
this->CellSets.clear();
this->CellSet = this->CellSet.NewInstance();
}
vtkm::Id DataSet::GetNumberOfCells() const
{
return this->CellSet.GetNumberOfCells();
}
vtkm::Id DataSet::GetNumberOfPoints() const
{
if (this->CoordSystems.empty())
{
return 0;
}
return this->CoordSystems[0].GetNumberOfPoints();
}
void DataSet::CopyStructure(const vtkm::cont::DataSet& source)
{
this->CoordSystems = source.CoordSystems;
this->CellSets = source.CellSets;
this->CellSet = source.CellSet;
}
const vtkm::cont::Field& DataSet::GetField(vtkm::Id index) const
@ -111,62 +125,6 @@ vtkm::cont::CoordinateSystem& DataSet::GetCoordinateSystem(const std::string& na
return this->GetCoordinateSystem(index);
}
const vtkm::cont::DynamicCellSet& DataSet::GetCellSet(vtkm::Id index) const
{
VTKM_ASSERT((index >= 0) && (index < this->GetNumberOfCellSets()));
return this->CellSets[static_cast<std::size_t>(index)];
}
vtkm::cont::DynamicCellSet& DataSet::GetCellSet(vtkm::Id index)
{
VTKM_ASSERT((index >= 0) && (index < this->GetNumberOfCellSets()));
return this->CellSets[static_cast<std::size_t>(index)];
}
vtkm::Id DataSet::GetCellSetIndex(const std::string& name) const
{
vtkm::Id index = -1;
for (auto i = this->CellSets.begin(); i != this->CellSets.end(); ++i)
{
if (i->GetName() == name)
{
index = static_cast<vtkm::Id>(std::distance(this->CellSets.begin(), i));
break;
}
}
return index;
}
const vtkm::cont::DynamicCellSet& DataSet::GetCellSet(const std::string& name) const
{
vtkm::Id index = this->GetCellSetIndex(name);
if (index < 0)
{
std::string error_message("No cell set with the name " + name + " valid names are: \n");
for (const auto& cs : this->CellSets)
{
error_message += cs.GetName() + "\n";
}
throw vtkm::cont::ErrorBadValue(error_message);
}
return this->GetCellSet(index);
}
vtkm::cont::DynamicCellSet& DataSet::GetCellSet(const std::string& name)
{
vtkm::Id index = this->GetCellSetIndex(name);
if (index < 0)
{
std::string error_message("No cell set with the name " + name + " valid names are: \n");
for (const auto& cs : this->CellSets)
{
error_message += cs.GetName() + "\n";
}
throw vtkm::cont::ErrorBadValue(error_message);
}
return this->GetCellSet(index);
}
void DataSet::PrintSummary(std::ostream& out) const
{
out << "DataSet:\n";
@ -176,11 +134,8 @@ void DataSet::PrintSummary(std::ostream& out) const
this->CoordSystems[index].PrintSummary(out);
}
out << " CellSets[" << this->GetNumberOfCellSets() << "]\n";
for (vtkm::Id index = 0; index < this->GetNumberOfCellSets(); index++)
{
this->GetCellSet(index).PrintSummary(out);
}
out << " CellSet \n";
this->GetCellSet().PrintSummary(out);
out << " Fields[" << this->GetNumberOfFields() << "]\n";
for (vtkm::Id index = 0; index < this->GetNumberOfFields(); index++)

@ -30,6 +30,15 @@ class VTKM_CONT_EXPORT DataSet
public:
VTKM_CONT void Clear();
/// Get the number of cells contained in this DataSet
VTKM_CONT vtkm::Id GetNumberOfCells() const;
/// Get the number of points contained in this DataSet
///
/// Note: All coordinate systems for a DataSet are expected
/// to have the same number of points.
VTKM_CONT vtkm::Id GetNumberOfPoints() const;
VTKM_CONT void AddField(const Field& field) { this->Fields.push_back(field); }
VTKM_CONT
@ -158,48 +167,20 @@ public:
//@}
VTKM_CONT
void AddCellSet(const vtkm::cont::DynamicCellSet& cellSet) { this->CellSets.push_back(cellSet); }
void SetCellSet(const vtkm::cont::DynamicCellSet& cellSet) { this->CellSet = cellSet; }
template <typename CellSetType>
VTKM_CONT void AddCellSet(const CellSetType& cellSet)
VTKM_CONT void SetCellSet(const CellSetType& cellSet)
{
VTKM_IS_CELL_SET(CellSetType);
this->CellSets.push_back(vtkm::cont::DynamicCellSet(cellSet));
this->CellSet = vtkm::cont::DynamicCellSet(cellSet);
}
VTKM_CONT
bool HasCellSet(const std::string& name) const { return this->GetCellSetIndex(name) >= 0; }
const vtkm::cont::DynamicCellSet& GetCellSet() const { return this->CellSet; }
VTKM_CONT
const vtkm::cont::DynamicCellSet& GetCellSet(vtkm::Id index = 0) const;
VTKM_CONT
vtkm::cont::DynamicCellSet& GetCellSet(vtkm::Id index = 0);
/// Returns the index for the first cell set whose
/// name matches the provided string.
/// Will return -1 if no match is found
VTKM_CONT
vtkm::Id GetCellSetIndex(const std::string& name) const;
/// Returns the first DynamicCellSet that matches the provided name.
/// Will throw an exception if no match is found
//@{
VTKM_CONT
const vtkm::cont::DynamicCellSet& GetCellSet(const std::string& name) const;
VTKM_CONT
vtkm::cont::DynamicCellSet& GetCellSet(const std::string& name);
//@}
VTKM_CONT
vtkm::IdComponent GetNumberOfCellSets() const
{
return static_cast<vtkm::IdComponent>(this->CellSets.size());
}
vtkm::cont::DynamicCellSet& GetCellSet() { return this->CellSet; }
VTKM_CONT
vtkm::IdComponent GetNumberOfFields() const
@ -213,7 +194,7 @@ public:
return static_cast<vtkm::IdComponent>(this->CoordSystems.size());
}
/// Copies the structure i.e. coordinates systems and cellsets from the source
/// Copies the structure i.e. coordinates systems and cellset from the source
/// dataset. The fields are left unchanged.
VTKM_CONT
void CopyStructure(const vtkm::cont::DataSet& source);
@ -224,7 +205,7 @@ public:
private:
std::vector<vtkm::cont::CoordinateSystem> CoordSystems;
std::vector<vtkm::cont::Field> Fields;
std::vector<vtkm::cont::DynamicCellSet> CellSets;
vtkm::cont::DynamicCellSet CellSet;
VTKM_CONT
vtkm::Id FindFieldIndex(const std::string& name,
@ -279,12 +260,7 @@ public:
vtkmdiy::save(bb, dataset.GetCoordinateSystem(i));
}
vtkm::IdComponent numberOfCellSets = dataset.GetNumberOfCellSets();
vtkmdiy::save(bb, numberOfCellSets);
for (vtkm::IdComponent i = 0; i < numberOfCellSets; ++i)
{
vtkmdiy::save(bb, dataset.GetCellSet(i).ResetCellSetList(CellSetTypesList{}));
}
vtkmdiy::save(bb, dataset.GetCellSet().ResetCellSetList(CellSetTypesList{}));
vtkm::IdComponent numberOfFields = dataset.GetNumberOfFields();
vtkmdiy::save(bb, numberOfFields);
@ -308,14 +284,9 @@ public:
dataset.AddCoordinateSystem(coords);
}
vtkm::IdComponent numberOfCellSets = 0;
vtkmdiy::load(bb, numberOfCellSets);
for (vtkm::IdComponent i = 0; i < numberOfCellSets; ++i)
{
vtkm::cont::DynamicCellSetBase<CellSetTypesList> cells;
vtkmdiy::load(bb, cells);
dataset.AddCellSet(vtkm::cont::DynamicCellSet(cells));
}
vtkm::cont::DynamicCellSetBase<CellSetTypesList> cells;
vtkmdiy::load(bb, cells);
dataset.SetCellSet(vtkm::cont::DynamicCellSet(cells));
vtkm::IdComponent numberOfFields = 0;
vtkmdiy::load(bb, numberOfFields);

@ -215,7 +215,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
vtkm::cont::CellSetExplicit<> cellSet(cellNm);
cellSet.Fill(nPts, shapes, numIndices, connectivity);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -258,7 +258,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
vtkm::cont::CellSetExplicit<> cellSet(cellNm);
cellSet.Fill(nPts, shapes, numIndices, connectivity);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -298,7 +298,7 @@ inline VTKM_CONT vtkm::cont::DataSet DataSetBuilderExplicit::BuildDataSet(
vtkm::cont::CellSetSingleType<> cellSet(cellNm);
cellSet.Fill(coords.GetNumberOfValues(), tag.Id, numberOfPointsPerCell, connectivity);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}

@ -231,19 +231,19 @@ private:
{
vtkm::cont::CellSetStructured<1> cellSet(cellNm);
cellSet.SetPointDimensions(dims[0]);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
}
else if (ndims == 2)
{
vtkm::cont::CellSetStructured<2> cellSet(cellNm);
cellSet.SetPointDimensions(vtkm::make_Vec(dims[0], dims[1]));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
}
else if (ndims == 3)
{
vtkm::cont::CellSetStructured<3> cellSet(cellNm);
cellSet.SetPointDimensions(vtkm::make_Vec(dims[0], dims[1], dims[2]));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
}
else
{

@ -79,19 +79,19 @@ vtkm::cont::DataSet DataSetBuilderUniform::CreateDataSet(const vtkm::Id3& dimens
{
vtkm::cont::CellSetStructured<1> cellSet(cellNm);
cellSet.SetPointDimensions(dims[0]);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
}
else if (ndims == 2)
{
vtkm::cont::CellSetStructured<2> cellSet(cellNm);
cellSet.SetPointDimensions(vtkm::Id2(dims[0], dims[1]));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
}
else if (ndims == 3)
{
vtkm::cont::CellSetStructured<3> cellSet(cellNm);
cellSet.SetPointDimensions(vtkm::Id3(dims[0], dims[1], dims[2]));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
}
else
{

@ -64,83 +64,36 @@ public:
VTKM_CONT
static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const vtkm::cont::VariantArrayHandle& field,
const std::string& cellSetName)
const vtkm::cont::VariantArrayHandle& field)
{
dataSet.AddField(make_FieldCell(fieldName, cellSetName, field));
dataSet.AddField(make_FieldCell(fieldName, field));
}
template <typename T, typename Storage>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const vtkm::cont::ArrayHandle<T, Storage>& field,
const std::string& cellSetName)
const vtkm::cont::ArrayHandle<T, Storage>& field)
{
dataSet.AddField(make_FieldCell(fieldName, cellSetName, field));
dataSet.AddField(make_FieldCell(fieldName, field));
}
template <typename T>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const std::vector<T>& field,
const std::string& cellSetName)
const std::vector<T>& field)
{
dataSet.AddField(
make_Field(fieldName, vtkm::cont::Field::Association::CELL_SET, field, vtkm::CopyFlag::On));
}
template <typename T>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const T* field,
const vtkm::Id& n)
{
dataSet.AddField(make_Field(
fieldName, vtkm::cont::Field::Association::CELL_SET, cellSetName, field, vtkm::CopyFlag::On));
}
template <typename T>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const T* field,
const vtkm::Id& n,
const std::string& cellSetName)
{
dataSet.AddField(make_Field(fieldName,
vtkm::cont::Field::Association::CELL_SET,
cellSetName,
field,
n,
vtkm::CopyFlag::On));
}
VTKM_CONT
static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const vtkm::cont::VariantArrayHandle& field,
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName = dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, cellSetName);
}
template <typename T, typename Storage>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const vtkm::cont::ArrayHandle<T, Storage>& field,
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName = dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, cellSetName);
}
template <typename T>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const std::vector<T>& field,
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName = dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, cellSetName);
}
template <typename T>
VTKM_CONT static void AddCellField(vtkm::cont::DataSet& dataSet,
const std::string& fieldName,
const T* field,
const vtkm::Id& n,
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName = dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, n, cellSetName);
fieldName, vtkm::cont::Field::Association::CELL_SET, field, n, vtkm::CopyFlag::On));
}
};
}

@ -20,36 +20,16 @@ VTKM_CONT
Field::Field(std::string name, Association association, const vtkm::cont::VariantArrayHandle& data)
: Name(name)
, FieldAssociation(association)
, AssocCellSetName()
, Data(data)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT(this->FieldAssociation == Association::WHOLE_MESH ||
this->FieldAssociation == Association::POINTS);
}
/// constructors for cell set associations
VTKM_CONT
Field::Field(std::string name,
Association association,
const std::string& cellSetName,
const vtkm::cont::VariantArrayHandle& data)
: Name(name)
, FieldAssociation(association)
, AssocCellSetName(cellSetName)
, Data(data)
, Range()
, ModifiedFlag(true)
{
VTKM_ASSERT(this->FieldAssociation == Association::CELL_SET);
}
VTKM_CONT
Field::Field(const vtkm::cont::Field& src)
: Name(src.Name)
, FieldAssociation(src.FieldAssociation)
, AssocCellSetName(src.AssocCellSetName)
, Data(src.Data)
, Range(src.Range)
, ModifiedFlag(src.ModifiedFlag)
@ -59,7 +39,6 @@ Field::Field(const vtkm::cont::Field& src)
VTKM_CONT
Field::Field(vtkm::cont::Field&& src) noexcept : Name(std::move(src.Name)),
FieldAssociation(std::move(src.FieldAssociation)),
AssocCellSetName(std::move(src.AssocCellSetName)),
Data(std::move(src.Data)),
Range(std::move(src.Range)),
ModifiedFlag(std::move(src.ModifiedFlag))
@ -71,7 +50,6 @@ Field& Field::operator=(const vtkm::cont::Field& src)
{
this->Name = src.Name;
this->FieldAssociation = src.FieldAssociation;
this->AssocCellSetName = src.AssocCellSetName;
this->Data = src.Data;
this->Range = src.Range;
this->ModifiedFlag = src.ModifiedFlag;
@ -83,7 +61,6 @@ Field& Field::operator=(vtkm::cont::Field&& src) noexcept
{
this->Name = std::move(src.Name);
this->FieldAssociation = std::move(src.FieldAssociation);
this->AssocCellSetName = std::move(src.AssocCellSetName);
this->Data = std::move(src.Data);
this->Range = std::move(src.Range);
this->ModifiedFlag = std::move(src.ModifiedFlag);

@ -58,7 +58,6 @@ public:
VTKM_CONT
Field() = default;
/// constructors for points / whole mesh
VTKM_CONT
Field(std::string name, Association association, const vtkm::cont::VariantArrayHandle& data);
@ -70,22 +69,6 @@ public:
{
}
/// constructors for cell set associations
VTKM_CONT
Field(std::string name,
Association association,
const std::string& cellSetName,
const vtkm::cont::VariantArrayHandle& data);
template <typename T, typename Storage>
VTKM_CONT Field(std::string name,
Association association,
const std::string& cellSetName,
const vtkm::cont::ArrayHandle<T, Storage>& data)
: Field(name, association, cellSetName, vtkm::cont::VariantArrayHandle{ data })
{
}
Field(const vtkm::cont::Field& src);
Field(vtkm::cont::Field&& src) noexcept;
@ -96,7 +79,6 @@ public:
VTKM_CONT const std::string& GetName() const { return this->Name; }
VTKM_CONT Association GetAssociation() const { return this->FieldAssociation; }
VTKM_CONT std::string GetAssocCellSet() const { return this->AssocCellSetName; }
const vtkm::cont::VariantArrayHandle& GetData() const;
vtkm::cont::VariantArrayHandle& GetData();
@ -161,8 +143,6 @@ private:
std::string Name; ///< name of field
Association FieldAssociation = Association::ANY;
std::string AssocCellSetName; ///< only populate if assoc is cells
vtkm::cont::VariantArrayHandle Data;
mutable vtkm::cont::ArrayHandle<vtkm::Range> Range;
mutable bool ModifiedFlag = true;
@ -211,50 +191,8 @@ vtkm::cont::Field make_Field(std::string name,
return vtkm::cont::Field(name, association, vtkm::cont::make_ArrayHandle(data, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::Association association,
const std::string& cellSetName,
const T* data,
vtkm::Id size,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(
name, association, cellSetName, vtkm::cont::make_ArrayHandle(data, size, copy));
}
template <typename T>
vtkm::cont::Field make_Field(std::string name,
Field::Association association,
const std::string& cellSetName,
const std::vector<T>& data,
vtkm::CopyFlag copy = vtkm::CopyFlag::Off)
{
return vtkm::cont::Field(
name, association, cellSetName, vtkm::cont::make_ArrayHandle(data, copy));
}
//@}
/// Convenience functions to build a point or cell field from vtkm::cont::ArrayHandle
/// If \c association is CELL_SET it will
template <typename T, typename S>
vtkm::cont::Field make_Field(std::string name,
Field::Association association,
const std::string& cellSetName,
const vtkm::cont::ArrayHandle<T, S>& data)
{
if (association == Field::Association::CELL_SET)
{
return vtkm::cont::Field(name, association, cellSetName, data);
}
else
{
return vtkm::cont::Field(name, association, data);
}
}
/// Convenience function to build point fields from vtkm::cont::ArrayHandle
template <typename T, typename S>
vtkm::cont::Field make_FieldPoint(std::string name, const vtkm::cont::ArrayHandle<T, S>& data)
@ -271,20 +209,17 @@ inline vtkm::cont::Field make_FieldPoint(std::string name,
/// Convenience function to build cell fields from vtkm::cont::ArrayHandle
template <typename T, typename S>
vtkm::cont::Field make_FieldCell(std::string name,
const std::string& cellSetName,
const vtkm::cont::ArrayHandle<T, S>& data)
vtkm::cont::Field make_FieldCell(std::string name, const vtkm::cont::ArrayHandle<T, S>& data)
{
return vtkm::cont::Field(name, vtkm::cont::Field::Association::CELL_SET, cellSetName, data);
return vtkm::cont::Field(name, vtkm::cont::Field::Association::CELL_SET, data);
}
/// Convenience function to build cell fields from vtkm::cont::VariantArrayHandle
inline vtkm::cont::Field make_FieldCell(std::string name,
const std::string& cellSetName,
const vtkm::cont::VariantArrayHandle& data)
{
return vtkm::cont::Field(name, vtkm::cont::Field::Association::CELL_SET, cellSetName, data);
return vtkm::cont::Field(name, vtkm::cont::Field::Association::CELL_SET, data);
}
} // namespace cont
@ -343,10 +278,6 @@ public:
vtkmdiy::save(bb, field.GetName());
vtkmdiy::save(bb, static_cast<int>(field.GetAssociation()));
if (field.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
vtkmdiy::save(bb, field.GetAssocCellSet());
}
vtkmdiy::save(bb, field.GetData().ResetTypes(TypeList{}));
}
@ -361,19 +292,8 @@ public:
auto assoc = static_cast<vtkm::cont::Field::Association>(assocVal);
vtkm::cont::VariantArrayHandleBase<TypeList> data;
if (assoc == vtkm::cont::Field::Association::CELL_SET)
{
std::string assocCellSetName;
vtkmdiy::load(bb, assocCellSetName);
vtkmdiy::load(bb, data);
field =
vtkm::cont::Field(name, assoc, assocCellSetName, vtkm::cont::VariantArrayHandle(data));
}
else
{
vtkmdiy::load(bb, data);
field = vtkm::cont::Field(name, assoc, vtkm::cont::VariantArrayHandle(data));
}
vtkmdiy::load(bb, data);
field = vtkm::cont::Field(name, assoc, vtkm::cont::VariantArrayHandle(data));
}
};

@ -179,7 +179,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make2DUniformDataSet0()
dsf.AddPointField(dataSet, "pointvar", var, nVerts);
constexpr vtkm::Float32 cellvar[2] = { 100.1f, 200.1f };
dsf.AddCellField(dataSet, "cellvar", cellvar, 2, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, 2);
return dataSet;
}
@ -204,7 +204,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make2DUniformDataSet1()
};
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -259,7 +259,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DUniformDataSet0()
dsf.AddPointField(dataSet, "pointvar", vars, nVerts);
constexpr vtkm::Float32 cellvar[4] = { 100.1f, 100.2f, 100.3f, 100.4f };
dsf.AddCellField(dataSet, "cellvar", cellvar, 4, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, 4);
return dataSet;
}
@ -305,7 +305,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DUniformDataSet1()
};
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -409,7 +409,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make2DRectilinearDataSet0()
vtkm::Float32 cellvar[nCells];
for (int i = 0; i < nCells; i++)
cellvar[i] = (vtkm::Float32)i;
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -433,12 +433,12 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRegularDataSet0()
//Set cell scalar
vtkm::Float32 cellvar[4] = { 100.1f, 100.2f, 100.3f, 100.4f };
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, "cells", cellvar, 4, vtkm::CopyFlag::On));
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, 4, vtkm::CopyFlag::On));
static constexpr vtkm::IdComponent dim = 3;
vtkm::cont::CellSetStructured<dim> cellSet("cells");
cellSet.SetPointDimensions(vtkm::make_Vec(3, 2, 3));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -460,12 +460,12 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRegularDataSet1()
//Set cell scalar
vtkm::Float32 cellvar[1] = { 100.1f };
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, 1, vtkm::CopyFlag::On));
static constexpr vtkm::IdComponent dim = 3;
vtkm::cont::CellSetStructured<dim> cellSet("cells");
cellSet.SetPointDimensions(vtkm::make_Vec(2, 2, 2));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -497,7 +497,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DRectilinearDataSet0()
vtkm::Float32 cellvar[nCells];
for (int i = 0; i < nCells; i++)
cellvar[i] = (vtkm::Float32)i;
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -593,7 +593,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make2DExplicitDataSet0()
vtkm::Float32 cellvar[nCells] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f };
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -640,45 +640,11 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet0()
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(dataSet, "pointvar", vars, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, 2, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, 2);
return dataSet;
}
/*
inline vtkm::cont::DataSet
MakeTestDataSet::Make3DExplicitDataSet1()
{
vtkm::cont::DataSet dataSet;
vtkm::cont::DataSetIterativeBuilderExplicit dsb;
vtkm::Id id0, id1, id2, id3, id4;
dsb.Begin("coords", "cells");
id0 = dsb.AddPoint(0,0,0);
id1 = dsb.AddPoint(1,0,0);
id2 = dsb.AddPoint(1,1,0);
id3 = dsb.AddPoint(2,1,0);
id4 = dsb.AddPoint(2,2,0);
vtkm::Id ids0[3] = {id0, id1, id2};
dsb.AddCell(vtkm::CELL_SHAPE_TRIANGLE, ids0, 3);
vtkm::Id ids1[4] = {id2, id1, id3, id4};
dsb.AddCell(vtkm::CELL_SHAPE_QUAD, ids1, 4);
dataSet = dsb.Create();
vtkm::Float32 vars[5] = {10.1f, 20.1f, 30.2f, 40.2f, 50.3f};
vtkm::Float32 cellvar[2] = {100.1f, 100.2f};
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(dataSet, "pointvar", vars, 5);
dsf.AddCellField(dataSet, "cellvar", cellvar, 2, "cells");
return dataSet;
}
*/
inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet1()
{
vtkm::cont::DataSet dataSet;
@ -707,7 +673,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet1()
cellSet.AddCell(vtkm::CELL_SHAPE_TRIANGLE, 3, make_Vec<vtkm::Id>(0, 1, 2));
cellSet.AddCell(vtkm::CELL_SHAPE_QUAD, 4, make_Vec<vtkm::Id>(2, 1, 3, 4));
cellSet.CompleteAddingCells(nVerts);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
//Set point scalar
dataSet.AddField(make_Field(
@ -716,7 +682,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet1()
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f, 100.2f };
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, "cells", cellvar, 2, vtkm::CopyFlag::On));
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, 2, vtkm::CopyFlag::On));
return dataSet;
}
@ -749,7 +715,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet2()
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f };
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, 1, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 8> ids;
@ -767,7 +733,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet2()
cellSet.CompleteAddingCells(nVerts);
//todo this need to be a reference/shared_ptr style class
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -805,7 +771,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet4()
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f, 110.f };
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, "cells", cellvar, 2, vtkm::CopyFlag::On));
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, 2, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 8> ids;
@ -832,7 +798,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet4()
cellSet.CompleteAddingCells(nVerts);
//todo this need to be a reference/shared_ptr style class
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -858,7 +824,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet3()
//Set cell scalar
vtkm::Float32 cellvar[2] = { 100.1f };
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, "cells", cellvar, 1, vtkm::CopyFlag::On));
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, 1, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Id4 ids;
@ -872,7 +838,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet3()
cellSet.CompleteAddingCells(nVerts);
//todo this need to be a reference/shared_ptr style class
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -909,12 +875,8 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet5()
//Set cell scalar
const int nCells = 4;
vtkm::Float32 cellvar[nCells] = { 100.1f, 110.f, 120.2f, 130.5f };
dataSet.AddField(make_Field("cellvar",
vtkm::cont::Field::Association::CELL_SET,
"cells",
cellvar,
nCells,
vtkm::CopyFlag::On));
dataSet.AddField(make_Field(
"cellvar", vtkm::cont::Field::Association::CELL_SET, cellvar, nCells, vtkm::CopyFlag::On));
vtkm::cont::CellSetExplicit<> cellSet("cells");
vtkm::Vec<vtkm::Id, 8> ids;
@ -955,7 +917,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet5()
cellSet.CompleteAddingCells(nVerts);
//todo this need to be a reference/shared_ptr style class
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -1032,7 +994,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet6()
vtkm::Float32 cellvar[nCells] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -1280,7 +1242,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetZoo()
6.1f, 7.1f, 7.2f, 7.3f, 7.4f, 9.1f, 9.2f, 9.3f, 5.4f, 9.5f, 9.6f, 6.7f };
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -1347,7 +1309,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet7()
vtkm::Float32 cellvar[nCells] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -1427,7 +1389,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSet8()
vtkm::Float32 cellvar[nCells] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0f };
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -1510,7 +1472,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetPolygonal()
vtkm::Float32 cellvar[nCells] = { 0.0f, 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f };
dsf.AddPointField(dataSet, "pointvar", pointvar, nVerts);
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar, nCells);
return dataSet;
}
@ -1551,7 +1513,7 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetCowNose()
}
vtkm::cont::CellSetSingleType<> cellSet("cells");
cellSet.Fill(nVerts, vtkm::CELL_SHAPE_TRIANGLE, 3, connectivity);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
std::vector<vtkm::Float32> pointvar(nVerts);
std::iota(pointvar.begin(), pointvar.end(), 15.f);
@ -1568,9 +1530,9 @@ inline vtkm::cont::DataSet MakeTestDataSet::Make3DExplicitDataSetCowNose()
vtkm::cont::DataSetFieldAdd dsf;
dsf.AddPointField(dataSet, "pointvar", pointvar);
dsf.AddCellField(dataSet, "cellvar", cellvar, "cells");
dsf.AddCellField(dataSet, "cellvar", cellvar);
dsf.AddPointField(dataSet, "point_vectors", pointvec);
dsf.AddCellField(dataSet, "cell_vectors", cellvec, "cells");
dsf.AddCellField(dataSet, "cell_vectors", cellvec);
return dataSet;
}

@ -348,15 +348,6 @@ inline VTKM_CONT TestEqualResult test_equal_Fields(const vtkm::cont::Field& f1,
return result;
}
if (f1.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
if (f1.GetAssocCellSet() != f2.GetAssocCellSet())
{
result.PushMessage("associated cellset names don't match");
return result;
}
}
result =
test_equal_ArrayHandles(f1.GetData().ResetTypes(fTtypes), f2.GetData().ResetTypes(fTtypes));
if (!result)
@ -392,21 +383,13 @@ inline VTKM_CONT TestEqualResult test_equal_DataSets(const vtkm::cont::DataSet&
}
}
if (ds1.GetNumberOfCellSets() != ds2.GetNumberOfCellSets())
result = test_equal_CellSets(ds1.GetCellSet().ResetCellSetList(ctypes),
ds2.GetCellSet().ResetCellSetList(ctypes));
if (!result)
{
result.PushMessage("number of cellsets don't match");
result.PushMessage(std::string("cellsets don't match"));
return result;
}
for (vtkm::IdComponent i = 0; i < ds1.GetNumberOfCellSets(); ++i)
{
result = test_equal_CellSets(ds1.GetCellSet(i).ResetCellSetList(ctypes),
ds2.GetCellSet(i).ResetCellSetList(ctypes));
if (!result)
{
result.PushMessage(std::string("cellsets don't match at index ") + std::to_string(i));
return result;
}
}
if (ds1.GetNumberOfFields() != ds2.GetNumberOfFields())
{

@ -80,7 +80,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dims)
vtkm::cont::ArrayHandle<PointType> points;
vtkm::cont::ArrayCopy(uniformDs.GetCoordinateSystem().GetData(), points);
vtkm::Id numberOfCells = uniformDs.GetCellSet().GetNumberOfCells();
vtkm::Id numberOfCells = uniformDs.GetNumberOfCells();
vtkm::Id numberOfIndices = numberOfCells * PointsPerCell;
Connectivity structured;
@ -135,7 +135,7 @@ vtkm::cont::DataSet MakeTestDataSet(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dims)
// build dataset
vtkm::cont::DataSet out;
out.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", points));
out.AddCellSet(cellset);
out.SetCellSet(cellset);
return out;
}
@ -146,7 +146,7 @@ void GenerateRandomInput(const vtkm::cont::DataSet& ds,
vtkm::cont::ArrayHandle<PointType>& pcoords,
vtkm::cont::ArrayHandle<PointType>& wcoords)
{
vtkm::Id numberOfCells = ds.GetCellSet().GetNumberOfCells();
vtkm::Id numberOfCells = ds.GetNumberOfCells();
std::uniform_int_distribution<vtkm::Id> cellIdGen(0, numberOfCells - 1);
@ -201,8 +201,7 @@ void TestCellLocator(const vtkm::Vec<vtkm::Id, DIMENSIONS>& dim, vtkm::Id number
{
auto ds = MakeTestDataSet(dim);
std::cout << "Testing " << DIMENSIONS << "D dataset with " << ds.GetCellSet().GetNumberOfCells()
<< " cells\n";
std::cout << "Testing " << DIMENSIONS << "D dataset with " << ds.GetNumberOfCells() << " cells\n";
vtkm::cont::CellLocatorUniformBins locator;
locator.SetDensityL1(64.0f);

@ -58,8 +58,6 @@ private:
vtkm::cont::testing::MakeTestDataSet tds;
vtkm::cont::DataSet ds = tds.Make3DExplicitDataSet0();
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1, "Incorrect number of cell sets");
VTKM_TEST_ASSERT(ds.GetNumberOfFields() == 2, "Incorrect number of fields");
// test various field-getting methods and associations
@ -91,7 +89,7 @@ private:
// test cell-to-point connectivity
vtkm::cont::CellSetExplicit<> cellset;
ds.GetCellSet(0).CopyTo(cellset);
ds.GetCellSet().CopyTo(cellset);
vtkm::Id connectivitySize = 7;
vtkm::Id numPoints = 5;

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

@ -75,7 +75,7 @@ vtkm::cont::DataSet MakeTestDataSetCurvilinear()
}
vtkm::cont::DataSet curvi;
curvi.AddCellSet(recti.GetCellSet());
curvi.SetCellSet(recti.GetCellSet());
curvi.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", sheared));
return curvi;
@ -115,7 +115,7 @@ void GenerateRandomInput(const vtkm::cont::DataSet& ds,
vtkm::cont::ArrayHandle<PointType>& pcoords,
vtkm::cont::ArrayHandle<PointType>& wcoords)
{
vtkm::Id numberOfCells = ds.GetCellSet().GetNumberOfCells();
vtkm::Id numberOfCells = ds.GetNumberOfCells();
std::uniform_int_distribution<vtkm::Id> cellIdGen(0, numberOfCells - 1);
std::uniform_real_distribution<vtkm::FloatDefault> pcoordGen(0.0f, 1.0f);

@ -125,7 +125,7 @@ int TestCellSetExtrude()
vtkm::cont::DataSet dataset;
dataset.AddCoordinateSystem(vtkm::cont::CoordinateSystem("coords", coords));
dataset.AddCellSet(cells);
dataset.SetCellSet(cells);
// verify that a constant value point field can be accessed
std::vector<float> pvalues(static_cast<size_t>(coords.GetNumberOfValues()), 42.0f);
@ -136,7 +136,7 @@ int TestCellSetExtrude()
// verify that a constant cell value can be accessed
std::vector<float> cvalues(static_cast<size_t>(cells.GetNumberOfCells()), 42.0f);
vtkm::cont::Field cfield =
vtkm::cont::make_FieldCell("cfield", cells.GetName(), vtkm::cont::make_ArrayHandle(cvalues));
vtkm::cont::make_FieldCell("cfield", vtkm::cont::make_ArrayHandle(cvalues));
dataset.AddField(cfield);
vtkm::filter::PointAverage avg;

@ -40,12 +40,10 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
const vtkm::Bounds& bounds)
{
//Verify basics..
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1, "Wrong number of cell sets.");
VTKM_TEST_ASSERT(ds.GetNumberOfFields() == 2, "Wrong number of fields.");
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1, "Wrong number of coordinate systems.");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetNumberOfPoints() == numPoints,
"Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == numCells, "Wrong number of cells.");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == numPoints, "Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetNumberOfCells() == numCells, "Wrong number of cells.");
// test various field-getting methods and associations
try

@ -30,12 +30,11 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
const vtkm::Bounds& bounds)
{
//Verify basics..
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1, "Wrong number of cell sets.");
VTKM_TEST_ASSERT(ds.GetNumberOfFields() == 2, "Wrong number of fields.");
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1, "Wrong number of coordinate systems.");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetNumberOfPoints() == numPoints,
"Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == numCells, "Wrong number of cells.");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == numPoints, "Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetNumberOfCells() == numCells, "Wrong number of cells.");
// test various field-getting methods and associations
try
@ -62,21 +61,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
if (dim == 1)
{
vtkm::cont::CellSetStructured<1> cellSet;
ds.GetCellSet(0).CopyTo(cellSet);
ds.GetCellSet().CopyTo(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(0).CopyTo(cellSet);
ds.GetCellSet().CopyTo(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(0).CopyTo(cellSet);
ds.GetCellSet().CopyTo(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type");
}

@ -31,12 +31,11 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
vtkm::Bounds bounds)
{
//Verify basics..
VTKM_TEST_ASSERT(ds.GetNumberOfCellSets() == 1, "Wrong number of cell sets.");
VTKM_TEST_ASSERT(ds.GetNumberOfFields() == 2, "Wrong number of fields.");
VTKM_TEST_ASSERT(ds.GetNumberOfCoordinateSystems() == 1, "Wrong number of coordinate systems.");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetNumberOfPoints() == numPoints,
"Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == numCells, "Wrong number of cells.");
VTKM_TEST_ASSERT(ds.GetNumberOfPoints() == numPoints, "Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetNumberOfCells() == numCells, "Wrong number of cells.");
// test various field-getting methods and associations
try
@ -63,21 +62,21 @@ void ValidateDataSet(const vtkm::cont::DataSet& ds,
if (dim == 1)
{
vtkm::cont::CellSetStructured<1> cellSet;
ds.GetCellSet(0).CopyTo(cellSet);
ds.GetCellSet().CopyTo(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(0).CopyTo(cellSet);
ds.GetCellSet().CopyTo(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(0).CopyTo(cellSet);
ds.GetCellSet().CopyTo(cellSet);
vtkm::IdComponent shape = cellSet.GetCellShape();
VTKM_TEST_ASSERT(shape == vtkm::CELL_SHAPE_HEXAHEDRON, "Wrong element type");
}

@ -95,7 +95,7 @@ void TestDataSet_Explicit()
//get the cellset single type from the dataset
vtkm::cont::CellSetSingleType<> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
dataSet.GetCellSet().CopyTo(cellSet);
//verify that we can create a subset of a singlset
using SubsetType = vtkm::cont::CellSetPermutation<vtkm::cont::CellSetSingleType<>>;
@ -141,7 +141,7 @@ void TestDataSet_Structured2D()
vtkm::cont::ArrayHandle<vtkm::Id> validCellIds = vtkm::cont::make_ArrayHandle(validIds);
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
dataSet.GetCellSet().CopyTo(cellSet);
//verify that we can create a subset of a 2d UniformDataSet
vtkm::cont::CellSetPermutation<vtkm::cont::CellSetStructured<2>> subset;
@ -183,7 +183,7 @@ void TestDataSet_Structured3D()
vtkm::cont::ArrayHandle<vtkm::Id> validCellIds = vtkm::cont::make_ArrayHandle(validIds);
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
dataSet.GetCellSet().CopyTo(cellSet);
//verify that we can create a subset of a 2d UniformDataSet
vtkm::cont::CellSetPermutation<vtkm::cont::CellSetStructured<3>> subset;

@ -40,9 +40,8 @@ static void TwoDimRectilinearTest()
vtkm::cont::DataSet dataSet = testDataSet.Make2DRectilinearDataSet0();
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
dataSet.GetCellSet().CopyTo(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfCellSets() == 1, "Incorrect number of cell sets");
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");
VTKM_TEST_ASSERT(dataSet.GetNumberOfCoordinateSystems() == 1,
"Incorrect number of coordinate systems");
@ -123,9 +122,7 @@ static void ThreeDimRectilinearTest()
vtkm::cont::DataSet dataSet = testDataSet.Make3DRectilinearDataSet0();
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfCellSets() == 1, "Incorrect number of cell sets");
dataSet.GetCellSet().CopyTo(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");

@ -41,9 +41,8 @@ static void TwoDimUniformTest()
dataSet.PrintSummary(std::cout);
vtkm::cont::CellSetStructured<2> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
dataSet.GetCellSet().CopyTo(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfCellSets() == 1, "Incorrect number of cell sets");
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");
VTKM_TEST_ASSERT(dataSet.GetNumberOfCoordinateSystems() == 1,
"Incorrect number of coordinate systems");
@ -128,9 +127,7 @@ static void ThreeDimUniformTest()
dataSet.PrintSummary(std::cout);
vtkm::cont::CellSetStructured<3> cellSet;
dataSet.GetCellSet(0).CopyTo(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfCellSets() == 1, "Incorrect number of cell sets");
dataSet.GetCellSet().CopyTo(cellSet);
VTKM_TEST_ASSERT(dataSet.GetNumberOfFields() == 2, "Incorrect number of fields");

@ -36,7 +36,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellAverage::DoExecute(
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
vtkm::cont::DynamicCellSet cellSet = input.GetCellSet(this->GetActiveCellSetIndex());
vtkm::cont::DynamicCellSet cellSet = input.GetCellSet();
//todo: we need to ask the policy what storage type we should be using
//If the input is implicit, we should know what to fall back to
@ -51,7 +51,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellAverage::DoExecute(
outputName = fieldMetadata.GetName();
}
return CreateResultFieldCell(input, outArray, outputName, cellSet);
return CreateResultFieldCell(input, outArray, outputName);
}
}
} // namespace vtkm::filter

@ -38,7 +38,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellMeasures<IntegrationType>::DoExecute(
throw vtkm::cont::ErrorFilterExecution("CellMeasures expects point field input.");
}
const auto& cellset = input.GetCellSet(this->GetActiveCellSetIndex());
const auto& cellset = input.GetCellSet();
vtkm::cont::ArrayHandle<T> outArray;
this->Invoke(vtkm::worklet::CellMeasure<IntegrationType>{},
@ -52,7 +52,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellMeasures<IntegrationType>::DoExecute(
// Default name is name of input.
outputName = "measure";
}
return CreateResultFieldCell(input, outArray, outputName, cellset);
return CreateResultFieldCell(input, outArray, outputName);
}
}
} // namespace vtkm::filter

@ -34,7 +34,7 @@ inline VTKM_CONT vtkm::cont::DataSet CellSetConnectivity::DoExecute(
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::CellSetConnectivity().Run(
vtkm::filter::ApplyPolicy(input.GetCellSet(this->GetActiveCellSetIndex()), policy), component);
vtkm::filter::ApplyPolicy(input.GetCellSet(), policy), component);
return CreateResult(input, component, this->GetOutputFieldName(), fieldMetadata);
}

@ -35,54 +35,49 @@ inline VTKM_CONT vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::Data
vtkm::filter::PolicyBase<Policy> policy)
{
using CellSetType = vtkm::cont::CellSetExplicit<>;
using VecId = std::vector<CellSetType>::size_type;
VecId numCellSets = static_cast<VecId>(inData.GetNumberOfCellSets());
std::vector<CellSetType> outputCellSets(numCellSets);
using VecId = std::size_t;
VecId activeCoordIndex = static_cast<VecId>(this->GetActiveCoordinateSystemIndex());
CellSetType outputCellSet;
// Do a deep copy of the cells to new CellSetExplicit structures
for (VecId cellSetIndex = 0; cellSetIndex < numCellSets; ++cellSetIndex)
const vtkm::cont::DynamicCellSet& inCellSet = inData.GetCellSet();
if (inCellSet.IsType<CellSetType>())
{
vtkm::cont::DynamicCellSet inCellSet =
inData.GetCellSet(static_cast<vtkm::IdComponent>(cellSetIndex));
if (inCellSet.IsType<CellSetType>())
{
// Is expected type, do a shallow copy
outputCellSets[cellSetIndex] = inCellSet.Cast<CellSetType>();
}
else
{ // Clean the grid
auto deducedCellSet = vtkm::filter::ApplyPolicy(inCellSet, policy);
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
this->Invoke(worklet::CellDeepCopy::CountCellPoints{}, deducedCellSet, numIndices);
vtkm::cont::ArrayHandle<vtkm::UInt8> shapes;
vtkm::cont::ArrayHandle<vtkm::Id> offsets;
vtkm::Id connectivitySize;
vtkm::cont::ConvertNumComponentsToOffsets(numIndices, offsets, connectivitySize);
numIndices.ReleaseResourcesExecution();
vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
connectivity.Allocate(connectivitySize);
this->Invoke(worklet::CellDeepCopy::PassCellStructure{},
deducedCellSet,
shapes,
vtkm::cont::make_ArrayHandleGroupVecVariable(connectivity, offsets));
shapes.ReleaseResourcesExecution();
offsets.ReleaseResourcesExecution();
connectivity.ReleaseResourcesExecution();
outputCellSets[cellSetIndex].Fill(
deducedCellSet.GetNumberOfPoints(), shapes, numIndices, connectivity, offsets);
//Release the input grid from the execution space
deducedCellSet.ReleaseResourcesExecution();
}
// Is expected type, do a shallow copy
outputCellSet = inCellSet.Cast<CellSetType>();
}
else
{ // Clean the grid
auto deducedCellSet = vtkm::filter::ApplyPolicy(inCellSet, policy);
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
this->Invoke(worklet::CellDeepCopy::CountCellPoints{}, deducedCellSet, numIndices);
vtkm::cont::ArrayHandle<vtkm::UInt8> shapes;
vtkm::cont::ArrayHandle<vtkm::Id> offsets;
vtkm::Id connectivitySize;
vtkm::cont::ConvertNumComponentsToOffsets(numIndices, offsets, connectivitySize);
numIndices.ReleaseResourcesExecution();
vtkm::cont::ArrayHandle<vtkm::Id> connectivity;
connectivity.Allocate(connectivitySize);
this->Invoke(worklet::CellDeepCopy::PassCellStructure{},
deducedCellSet,
shapes,
vtkm::cont::make_ArrayHandleGroupVecVariable(connectivity, offsets));
shapes.ReleaseResourcesExecution();
offsets.ReleaseResourcesExecution();
connectivity.ReleaseResourcesExecution();
outputCellSet.Fill(
deducedCellSet.GetNumberOfPoints(), shapes, numIndices, connectivity, offsets);
//Release the input grid from the execution space
deducedCellSet.ReleaseResourcesExecution();
}
VecId numCoordSystems = static_cast<VecId>(inData.GetNumberOfCoordinateSystems());
std::vector<vtkm::cont::CoordinateSystem> outputCoordinateSystems(numCoordSystems);
@ -98,16 +93,10 @@ inline VTKM_CONT vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::Data
if (this->GetCompactPointFields())
{
this->PointCompactor.FindPointsStart();
for (VecId cellSetIndex = 0; cellSetIndex < numCellSets; cellSetIndex++)
{
this->PointCompactor.FindPoints(outputCellSets[cellSetIndex]);
}
this->PointCompactor.FindPoints(outputCellSet);
this->PointCompactor.FindPointsEnd();
for (VecId cellSetIndex = 0; cellSetIndex < numCellSets; ++cellSetIndex)
{
outputCellSets[cellSetIndex] = this->PointCompactor.MapCellSet(outputCellSets[cellSetIndex]);
}
outputCellSet = this->PointCompactor.MapCellSet(outputCellSet);
for (VecId coordSystemIndex = 0; coordSystemIndex < numCoordSystems; ++coordSystemIndex)
{
@ -149,24 +138,18 @@ inline VTKM_CONT vtkm::cont::DataSet CleanGrid::DoExecute(const vtkm::cont::Data
}
}
for (VecId cellSetIndex = 0; cellSetIndex < numCellSets; ++cellSetIndex)
{
outputCellSets[cellSetIndex] = this->PointMerger.MapCellSet(outputCellSets[cellSetIndex]);
}
outputCellSet = this->PointMerger.MapCellSet(outputCellSet);
}
// Optionally remove degenerate cells
if (this->GetRemoveDegenerateCells())
{
outputCellSets[activeCoordIndex] = this->CellCompactor.Run(outputCellSets[activeCoordIndex]);
outputCellSet = this->CellCompactor.Run(outputCellSet);
}
// Construct resulting data set with new cell sets
vtkm::cont::DataSet outData;
for (VecId cellSetIndex = 0; cellSetIndex < numCellSets; cellSetIndex++)
{
outData.AddCellSet(outputCellSets[cellSetIndex]);
}
outData.SetCellSet(outputCellSet);
// Pass the coordinate systems
for (VecId coordSystemIndex = 0; coordSystemIndex < numCoordSystems; ++coordSystemIndex)

@ -42,7 +42,7 @@ inline VTKM_CONT vtkm::cont::DataSet ClipWithField::DoExecute(
}
//get the cells and coordinates of the dataset
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& inputCoords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -52,7 +52,7 @@ inline VTKM_CONT vtkm::cont::DataSet ClipWithField::DoExecute(
//create the output data
vtkm::cont::DataSet output;
output.AddCellSet(outputCellSet);
output.SetCellSet(outputCellSet);
// Compute the new boundary points and add them to the output:
auto outputCoordsArray = this->Worklet.ProcessPointField(inputCoords.GetData());

@ -29,7 +29,7 @@ inline vtkm::cont::DataSet ClipWithImplicitFunction::DoExecute(
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
{
//get the cells and coordinates of the dataset
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& inputCoords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -43,7 +43,7 @@ inline vtkm::cont::DataSet ClipWithImplicitFunction::DoExecute(
//create the output data
vtkm::cont::DataSet output;
output.AddCellSet(outputCellSet);
output.SetCellSet(outputCellSet);
output.AddCoordinateSystem(outputCoords);
return output;

@ -41,7 +41,7 @@ inline VTKM_CONT vtkm::cont::DataSet ComputeMoments::DoExecute(
auto worklet = vtkm::worklet::moments::ComputeMoments(this->Radius);
worklet.Run(input.GetCellSet(this->GetActiveCellSetIndex()), field, this->Order, output);
worklet.Run(input.GetCellSet(), field, this->Order, output);
return output;
}

@ -120,7 +120,7 @@ inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
}
//get the cells and coordinates of the dataset
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -190,7 +190,7 @@ inline VTKM_CONT vtkm::cont::DataSet Contour::DoExecute(
}
//assign the connectivity to the cell set
output.AddCellSet(outputCells);
output.SetCellSet(outputCells);
//add the coordinates to the output dataset
vtkm::cont::CoordinateSystem outputCoords("coordinates", vertices);

@ -84,7 +84,7 @@ vtkm::cont::DataSet ContourTreeMesh2D::DoExecute(
}
// Collect sizing information from the dataset
const auto& dynamicCellSet = input.GetCellSet(this->GetActiveCellSetIndex());
const auto& dynamicCellSet = input.GetCellSet();
vtkm::cont::CellSetStructured<2> cellSet;
dynamicCellSet.CopyTo(cellSet);
@ -97,7 +97,7 @@ vtkm::cont::DataSet ContourTreeMesh2D::DoExecute(
vtkm::worklet::ContourTreeMesh2D worklet;
worklet.Run(field, nRows, nCols, saddlePeak);
return CreateResultFieldCell(input, saddlePeak, this->GetOutputFieldName(), dynamicCellSet);
return CreateResultFieldCell(input, saddlePeak, this->GetOutputFieldName());
}
//-----------------------------------------------------------------------------
ContourTreeMesh3D::ContourTreeMesh3D()
@ -121,7 +121,7 @@ vtkm::cont::DataSet ContourTreeMesh3D::DoExecute(
// Collect sizing information from the dataset
vtkm::cont::CellSetStructured<3> cellSet;
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
input.GetCellSet().CopyTo(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
vtkm::Id nRows = pointDimensions[0];

@ -115,7 +115,7 @@ vtkm::cont::DataSet ContourTreePPP2::DoExecute(const vtkm::cont::DataSet& input,
vtkm::Id nRows;
vtkm::Id nCols;
vtkm::Id nSlices = 1;
const auto& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const auto& cells = input.GetCellSet();
vtkm::filter::ApplyPolicy(cells, policy).CastAndCall(GetRowsColsSlices(), nRows, nCols, nSlices);
// Run the worklet

@ -79,18 +79,17 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResult(const vtkm::cont::DataSet& inD
/// Use this function if you want to explicit construct a Cell field and have a ArrayHandle
/// that holds the data for the field.
template <typename T, typename Storage, typename CellSetTags>
template <typename T, typename Storage>
inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldCell(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::ArrayHandle<T, Storage>& fieldArray,
const std::string& fieldName,
const vtkm::cont::DynamicCellSetBase<CellSetTags>& cellSet)
const std::string& fieldName)
{
VTKM_ASSERT(!fieldName.empty());
vtkm::cont::DataSet clone;
clone.CopyStructure(inDataSet);
clone.AddField(vtkm::cont::make_FieldCell(fieldName, cellSet.GetName(), fieldArray));
clone.AddField(vtkm::cont::make_FieldCell(fieldName, fieldArray));
// Sanity check.
VTKM_ASSERT(clone.HasCellField(fieldName));
@ -99,18 +98,16 @@ inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldCell(
/// Use this function if you want to explicit construct a Cell field and have a VariantArrayHandle
/// that holds the data for the field.
template <typename CellSetTags>
inline VTKM_CONT vtkm::cont::DataSet CreateResultFieldCell(
const vtkm::cont::DataSet& inDataSet,
const vtkm::cont::VariantArrayHandle& fieldArray,
const std::string& fieldName,
const vtkm::cont::DynamicCellSetBase<CellSetTags>& cellSet)
const std::string& fieldName)
{
VTKM_ASSERT(!fieldName.empty());
vtkm::cont::DataSet clone;
clone.CopyStructure(inDataSet);
clone.AddField(vtkm::cont::make_FieldCell(fieldName, cellSet.GetName(), fieldArray));
clone.AddField(vtkm::cont::make_FieldCell(fieldName, fieldArray));
// Sanity check.
VTKM_ASSERT(clone.HasCellField(fieldName));

@ -47,7 +47,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExternalFaces::DoExecute(
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
//1. extract the cell set
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
//2. using the policy convert the dynamic cell set, and run the
// external faces worklet
@ -81,7 +81,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExternalFaces::DoExecute(
//4. create the output dataset
vtkm::cont::DataSet output;
output.AddCellSet(outCellSet);
output.SetCellSet(outCellSet);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
if (this->CompactPoints)

@ -78,7 +78,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExtractGeometry::DoExecute(
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
{
// extract the input cell set and coordinates
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -95,7 +95,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExtractGeometry::DoExecute(
// create the output dataset
vtkm::cont::DataSet output;
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
output.AddCellSet(outCells);
output.SetCellSet(outCells);
return output;
}

@ -48,7 +48,7 @@ inline vtkm::cont::DataSet ExtractPoints::DoExecute(const vtkm::cont::DataSet& i
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
// extract the input cell set and coordinates
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -63,7 +63,7 @@ inline vtkm::cont::DataSet ExtractPoints::DoExecute(const vtkm::cont::DataSet& i
// create the output dataset
vtkm::cont::DataSet output;
output.AddCellSet(outCellSet);
output.SetCellSet(outCellSet);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
// compact the unused points in the output dataset

@ -30,9 +30,8 @@ inline VTKM_CONT vtkm::cont::DataSet ExtractStructured::DoExecute(
const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::CoordinateSystem& coordinates =
input.GetCoordinateSystem(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coordinates = input.GetCoordinateSystem();
auto cellset = this->Worklet.Run(vtkm::filter::ApplyPolicyStructured(cells, policy),
this->VOI,
@ -44,7 +43,7 @@ inline VTKM_CONT vtkm::cont::DataSet ExtractStructured::DoExecute(
vtkm::cont::CoordinateSystem outputCoordinates(coordinates.GetName(), coords);
vtkm::cont::DataSet output;
output.AddCellSet(vtkm::cont::DynamicCellSet(cellset));
output.SetCellSet(vtkm::cont::DynamicCellSet(cellset));
output.AddCoordinateSystem(outputCoordinates);
return output;
}

@ -26,7 +26,6 @@ public:
FieldMetadata()
: Name()
, Association(vtkm::cont::Field::Association::ANY)
, CellSetName()
{
}
@ -34,7 +33,6 @@ public:
FieldMetadata(const vtkm::cont::Field& f)
: Name(f.GetName())
, Association(f.GetAssociation())
, CellSetName(f.GetAssocCellSet())
{
}
@ -42,7 +40,6 @@ public:
FieldMetadata(const vtkm::cont::CoordinateSystem& sys)
: Name(sys.GetName())
, Association(sys.GetAssociation())
, CellSetName(sys.GetAssocCellSet())
{
}
@ -58,23 +55,13 @@ public:
VTKM_CONT
vtkm::cont::Field::Association GetAssociation() const { return this->Association; }
VTKM_CONT
const std::string& GetCellSetName() const { return this->CellSetName; }
/// Construct a new field with the same association as stored in this FieldMetaData
/// but with a new name
template <typename T, typename StorageTag>
VTKM_CONT vtkm::cont::Field AsField(const std::string& name,
const vtkm::cont::ArrayHandle<T, StorageTag>& handle) const
{
if (this->IsCellField())
{
return vtkm::cont::Field(name, this->Association, this->CellSetName, handle);
}
else
{
return vtkm::cont::Field(name, this->Association, handle);
}
return vtkm::cont::Field(name, this->Association, handle);
}
/// Construct a new field with the same association as stored in this FieldMetaData
/// but with a new name
@ -82,14 +69,7 @@ public:
vtkm::cont::Field AsField(const std::string& name,
const vtkm::cont::VariantArrayHandle& handle) const
{
if (this->IsCellField())
{
return vtkm::cont::Field(name, this->Association, this->CellSetName, handle);
}
else
{
return vtkm::cont::Field(name, this->Association, handle);
}
return vtkm::cont::Field(name, this->Association, handle);
}
/// Construct a new field with the same association and name as stored in this FieldMetaData
@ -107,7 +87,6 @@ public:
private:
std::string Name; ///< name of field
vtkm::cont::Field::Association Association;
std::string CellSetName; ///< only populate if assoc is cells
};
}
}

@ -35,12 +35,6 @@ public:
VTKM_CONT
~FilterDataSet();
VTKM_CONT
void SetActiveCellSetIndex(vtkm::Id index) { this->CellSetIndex = index; }
VTKM_CONT
vtkm::Id GetActiveCellSetIndex() const { return this->CellSetIndex; }
VTKM_CONT
void SetActiveCoordinateSystem(vtkm::Id index) { this->CoordinateSystemIndex = index; }
@ -66,7 +60,6 @@ public:
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
private:
vtkm::Id CellSetIndex;
vtkm::Id CoordinateSystemIndex;
friend class vtkm::filter::Filter<Derived>;

@ -23,8 +23,7 @@ namespace filter
//----------------------------------------------------------------------------
template <typename Derived>
inline VTKM_CONT FilterDataSet<Derived>::FilterDataSet()
: CellSetIndex(0)
, CoordinateSystemIndex(0)
: CoordinateSystemIndex(0)
{
}

@ -35,12 +35,6 @@ public:
VTKM_CONT
~FilterDataSetWithField();
VTKM_CONT
void SetActiveCellSetIndex(vtkm::Id index) { this->CellSetIndex = index; }
VTKM_CONT
vtkm::Id GetActiveCellSetIndex() const { return this->CellSetIndex; }
VTKM_CONT
void SetActiveCoordinateSystem(vtkm::Id index) { this->CoordinateSystemIndex = index; }
@ -80,7 +74,6 @@ public:
// Association::WHOLE_MESH -> (I think this is points)
// Association::POINTS -> map using point mapping
// Association::CELL_SET -> how do we map this?
// Association::LOGICAL_DIM -> unable to map?
template <typename DerivedPolicy>
VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result,
const vtkm::cont::Field& field,
@ -106,7 +99,6 @@ private:
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
std::string OutputFieldName;
vtkm::Id CellSetIndex;
vtkm::Id CoordinateSystemIndex;
std::string ActiveFieldName;
vtkm::cont::Field::Association ActiveFieldAssociation;

@ -31,7 +31,6 @@ namespace filter
template <typename Derived>
inline VTKM_CONT FilterDataSetWithField<Derived>::FilterDataSetWithField()
: OutputFieldName()
, CellSetIndex(0)
, CoordinateSystemIndex(0)
, ActiveFieldName()
, ActiveFieldAssociation(vtkm::cont::Field::Association::ANY)
@ -56,8 +55,7 @@ inline VTKM_CONT vtkm::cont::DataSet FilterDataSetWithField<Derived>::PrepareFor
{
// we need to state that the field is actually a coordinate system, so that
// the filter uses the proper policy to convert the types.
return this->PrepareForExecution(
input, input.GetCoordinateSystem(this->GetActiveCellSetIndex()), policy);
return this->PrepareForExecution(input, input.GetCoordinateSystem(), policy);
}
else
{

@ -74,26 +74,13 @@ public:
/// DataSet. This is used primarily by the Filter to select the coordinate system
/// to use as a field when \c UseCoordinateSystemAsField is true.
VTKM_CONT
void SetActiveCoordinateSystem(vtkm::Id index)
{
this->DeduceCellSetIndex = false;
this->CoordinateSystemIndex = index;
}
void SetActiveCoordinateSystem(vtkm::Id index) { this->CoordinateSystemIndex = index; }
VTKM_CONT
vtkm::Id GetActiveCoordinateSystemIndex() const { return this->CoordinateSystemIndex; }
//@}
//@{
/// Override the cellSet index to be active when executing the filter. By default
/// When processing cell fields the active cellset is the one assoicated with the
/// provided field, otherwise it will default to 0.
VTKM_CONT
void SetActiveCellSetIndex(vtkm::Id index) { this->CellSetIndex = index; }
VTKM_CONT
vtkm::Id GetActiveCellSetIndex() const { return this->CellSetIndex; }
/// These are provided to satisfy the Filter API requirements.
template <typename DerivedPolicy>
VTKM_CONT vtkm::cont::DataSet PrepareForExecution(
@ -111,15 +98,14 @@ public:
const vtkm::cont::DataSet& input,
const vtkm::cont::CoordinateSystem& field,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy);
//@}
protected:
private:
std::string OutputFieldName;
vtkm::Id CellSetIndex;
vtkm::Id CoordinateSystemIndex;
std::string ActiveFieldName;
vtkm::cont::Field::Association ActiveFieldAssociation;
bool DeduceCellSetIndex;
bool UseCoordinateSystemAsField;
friend class vtkm::filter::Filter<Derived>;

@ -30,11 +30,9 @@ namespace filter
template <typename Derived>
inline VTKM_CONT FilterField<Derived>::FilterField()
: OutputFieldName()
, CellSetIndex(0)
, CoordinateSystemIndex(0)
, ActiveFieldName()
, ActiveFieldAssociation(vtkm::cont::Field::Association::ANY)
, DeduceCellSetIndex(true)
, UseCoordinateSystemAsField(false)
{
}
@ -74,17 +72,6 @@ inline VTKM_CONT vtkm::cont::DataSet FilterField<Derived>::PrepareForExecution(
const vtkm::cont::Field& field,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
{
//If the user hasn't specified a field, try and deduce
//one based on the field. Once we are done executing we
//need to rollback the CellSetIndex so this isn't used on
//a subsequent execution by a non-cell field
if (this->DeduceCellSetIndex && field.IsFieldCell())
{
//If no cellset is found that matches the name, default to the first
//cellset
this->CellSetIndex = std::max(vtkm::Id{ 0 }, input.GetCellSetIndex(field.GetAssocCellSet()));
}
vtkm::filter::FieldMetadata metaData(field);
vtkm::cont::DataSet result;
@ -96,10 +83,6 @@ inline VTKM_CONT vtkm::cont::DataSet FilterField<Derived>::PrepareForExecution(
metaData,
policy,
result);
if (this->DeduceCellSetIndex)
{
this->CellSetIndex = 0;
}
return result;
}

@ -136,7 +136,7 @@ template <typename Policy>
inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<Policy>)
{
const vtkm::cont::DynamicCellSet& cellset = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cellset = input.GetCellSet();
vtkm::Id numCells = cellset.GetNumberOfCells();
vtkm::cont::ArrayHandleIndex indexArray(numCells);
vtkm::cont::ArrayHandle<vtkm::UInt8> ghosts;
@ -176,7 +176,7 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellClassify::DoExecute(const vtkm::co
throw vtkm::cont::ErrorFilterExecution("Unsupported cellset type for GhostCellClassify.");
}
return CreateResultFieldCell(input, ghosts, "vtkmGhostCells", cellset);
return CreateResultFieldCell(input, ghosts, "vtkmGhostCells");
}
template <typename ValueType, typename Storage, typename Policy>

@ -305,7 +305,7 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellRemove::DoExecute(
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
//get the cells and coordinates of the dataset
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::DynamicCellSet cellOut;
//Preserve structured output where possible.
@ -354,7 +354,7 @@ inline VTKM_CONT vtkm::cont::DataSet GhostCellRemove::DoExecute(
vtkm::cont::DataSet output;
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
output.AddCellSet(cellOut);
output.SetCellSet(cellOut);
return output;
}

@ -49,7 +49,7 @@ inline vtkm::cont::DataSet Gradient::DoExecute(
throw vtkm::cont::ErrorFilterExecution("Point field expected.");
}
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -91,22 +91,22 @@ inline vtkm::cont::DataSet Gradient::DoExecute(
: vtkm::cont::Field::Association::CELL_SET);
vtkm::cont::DataSet result;
result.CopyStructure(input);
result.AddField(vtkm::cont::make_Field(outputName, fieldAssociation, cells.GetName(), outArray));
result.AddField(vtkm::cont::Field{ outputName, fieldAssociation, outArray });
if (this->GetComputeDivergence() && isVector)
{
result.AddField(vtkm::cont::make_Field(
this->GetDivergenceName(), fieldAssociation, cells.GetName(), gradientfields.Divergence));
result.AddField(
vtkm::cont::Field{ this->GetDivergenceName(), fieldAssociation, gradientfields.Divergence });
}
if (this->GetComputeVorticity() && isVector)
{
result.AddField(vtkm::cont::make_Field(
this->GetVorticityName(), fieldAssociation, cells.GetName(), gradientfields.Vorticity));
result.AddField(
vtkm::cont::Field{ this->GetVorticityName(), fieldAssociation, gradientfields.Vorticity });
}
if (this->GetComputeQCriterion() && isVector)
{
result.AddField(vtkm::cont::make_Field(
this->GetQCriterionName(), fieldAssociation, cells.GetName(), gradientfields.QCriterion));
result.AddField(
vtkm::cont::Field{ this->GetQCriterionName(), fieldAssociation, gradientfields.QCriterion });
}
return result;
}

@ -33,9 +33,7 @@ inline VTKM_CONT vtkm::cont::DataSet ImageConnectivity::DoExecute(
vtkm::cont::ArrayHandle<vtkm::Id> component;
vtkm::worklet::connectivity::ImageConnectivity().Run(
vtkm::filter::ApplyPolicy(input.GetCellSet(this->GetActiveCellSetIndex()), policy),
field,
component);
vtkm::filter::ApplyPolicy(input.GetCellSet(), policy), field, component);
auto result = CreateResult(input, component, this->GetOutputFieldName(), fieldMetadata);
return result;

@ -108,8 +108,7 @@ inline void Lagrangian::WriteDataSet(vtkm::Id cycle,
file << filename << cycle << ".vtk";
vtkm::io::writer::VTKDataSetWriter writer(file.str().c_str());
writer.WriteDataSet(dataset);
std::cout << "Number of flows in writedataset is : " << dataset.GetCellSet(0).GetNumberOfCells()
<< std::endl;
std::cout << "Number of flows in writedataset is : " << dataset.GetNumberOfCells() << std::endl;
}
//-----------------------------------------------------------------------------
@ -228,7 +227,7 @@ inline VTKM_CONT vtkm::cont::DataSet Lagrangian::DoExecute(
cycle += 1;
std::cout << "Cycle : " << cycle << std::endl;
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
vtkm::Bounds bounds = input.GetCoordinateSystem().GetBounds();

@ -127,7 +127,7 @@ inline VTKM_CONT vtkm::cont::DataSet LagrangianStructures::DoExecute(
vtkm::cont::DataSet output;
vtkm::cont::DataSetFieldAdd fieldAdder;
output.AddCoordinateSystem(lcsInput.GetCoordinateSystem());
output.AddCellSet(lcsInput.GetCellSet());
output.SetCellSet(lcsInput.GetCellSet());
fieldAdder.AddPointField(output, this->GetOutputFieldName(), outputField);
return output;
}

@ -51,7 +51,7 @@ template <typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet Mask::DoExecute(const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::DynamicCellSet cellOut;
CallWorklet workletCaller(this->Stride, cellOut, this->Worklet);
vtkm::filter::ApplyPolicy(cells, policy).CastAndCall(workletCaller);
@ -59,7 +59,7 @@ inline VTKM_CONT vtkm::cont::DataSet Mask::DoExecute(const vtkm::cont::DataSet&
// create the output dataset
vtkm::cont::DataSet output;
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
output.AddCellSet(cellOut);
output.SetCellSet(cellOut);
return output;
}

@ -46,7 +46,7 @@ inline VTKM_CONT vtkm::cont::DataSet MaskPoints::DoExecute(
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
// extract the input cell set
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
// run the worklet on the cell set and input field
vtkm::cont::CellSetSingleType<> outCellSet;
@ -56,7 +56,7 @@ inline VTKM_CONT vtkm::cont::DataSet MaskPoints::DoExecute(
// create the output dataset
vtkm::cont::DataSet output;
output.AddCellSet(outCellSet);
output.SetCellSet(outCellSet);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
// compact the unused points in the output dataset

@ -83,7 +83,7 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
//TODO: Should other cellset types be supported?
vtkm::cont::CellSetExplicit<> cellSet;
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
input.GetCellSet().CopyTo(cellSet);
ShapeHandle cellShapes =
cellSet.GetShapesArray(vtkm::TopologyElementTagCell(), vtkm::TopologyElementTagPoint());
@ -229,7 +229,7 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
}
//Append the summary stats into the output dataset as a new field
result.AddField(vtkm::cont::make_FieldCell(fieldName, "cells", shapeMeshQuality));
result.AddField(vtkm::cont::make_FieldCell(fieldName, shapeMeshQuality));
#ifdef DEBUG_PRINT
std::cout << "-----------------------------------------------------\n"
@ -255,7 +255,7 @@ inline VTKM_CONT vtkm::cont::DataSet MeshQuality::DoExecute(
//Append the metric values of all cells into the output
//dataset as a new field
const std::string s = "allCells-metricValues";
result.AddField(vtkm::cont::make_FieldCell(s, "cells", outArray));
result.AddField(vtkm::cont::make_FieldCell(s, outArray));
return result;
}

@ -48,9 +48,8 @@ inline VTKM_CONT vtkm::cont::DataSet Pathline::DoExecute(
throw vtkm::cont::ErrorFilterExecution("No seeds provided.");
}
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells2 =
this->NextDataSet.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::DynamicCellSet& cells2 = this->NextDataSet.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
const vtkm::cont::CoordinateSystem& coords2 =
@ -81,7 +80,7 @@ inline VTKM_CONT vtkm::cont::DataSet Pathline::DoExecute(
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outputCoords("coordinates", res.positions);
outData.AddCellSet(res.polyLines);
outData.SetCellSet(res.polyLines);
outData.AddCoordinateSystem(outputCoords);
return outData;

@ -36,7 +36,7 @@ inline VTKM_CONT vtkm::cont::DataSet PointAverage::DoExecute(
throw vtkm::cont::ErrorFilterExecution("Cell field expected.");
}
vtkm::cont::DynamicCellSet cellSet = input.GetCellSet(this->GetActiveCellSetIndex());
vtkm::cont::DynamicCellSet cellSet = input.GetCellSet();
//todo: we need to ask the policy what storage type we should be using
//If the input is implicit, we should know what to fall back to

@ -17,7 +17,7 @@ VTKM_CONT
inline void Probe::SetGeometry(const vtkm::cont::DataSet& geometry)
{
this->Geometry = vtkm::cont::DataSet();
this->Geometry.AddCellSet(geometry.GetCellSet());
this->Geometry.SetCellSet(geometry.GetCellSet());
this->Geometry.AddCoordinateSystem(geometry.GetCoordinateSystem());
}
@ -26,10 +26,9 @@ VTKM_CONT inline vtkm::cont::DataSet Probe::DoExecute(
const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
this->Worklet.Run(
vtkm::filter::ApplyPolicy(input.GetCellSet(this->GetActiveCellSetIndex()), policy),
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
this->Geometry.GetCoordinateSystem().GetData());
this->Worklet.Run(vtkm::filter::ApplyPolicy(input.GetCellSet(), policy),
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
this->Geometry.GetCoordinateSystem().GetData());
auto output = this->Geometry;
auto hpf = this->Worklet.GetHiddenPointsField();
@ -37,7 +36,7 @@ VTKM_CONT inline vtkm::cont::DataSet Probe::DoExecute(
this->Worklet.GetHiddenCellsField(vtkm::filter::ApplyPolicy(output.GetCellSet(), policy));
output.AddField(vtkm::cont::make_FieldPoint("HIDDEN", hpf));
output.AddField(vtkm::cont::make_FieldCell("HIDDEN", output.GetCellSet().GetName(), hcf));
output.AddField(vtkm::cont::make_FieldCell("HIDDEN", hcf));
return output;
}

@ -34,7 +34,7 @@ inline VTKM_CONT vtkm::cont::DataSet SplitSharpEdges::DoExecute(
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
// Get the cells and coordinates of the dataset
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::ArrayHandle<vtkm::Vec3f> newCoords;
vtkm::cont::CellSetExplicit<> newCellset;
@ -46,7 +46,7 @@ inline VTKM_CONT vtkm::cont::DataSet SplitSharpEdges::DoExecute(
newCellset);
vtkm::cont::DataSet output;
output.AddCellSet(newCellset);
output.SetCellSet(newCellset);
output.AddCoordinateSystem(
vtkm::cont::CoordinateSystem(input.GetCoordinateSystem().GetName(), newCoords));
return output;

@ -40,7 +40,7 @@ inline VTKM_CONT vtkm::cont::DataSet StreamSurface::DoExecute(
if (this->Seeds.GetNumberOfValues() == 0)
throw vtkm::cont::ErrorFilterExecution("No seeds provided.");
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -70,7 +70,7 @@ inline VTKM_CONT vtkm::cont::DataSet StreamSurface::DoExecute(
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outputCoords("coordinates", srfPoints);
outData.AddCoordinateSystem(outputCoords);
outData.AddCellSet(srfCells);
outData.SetCellSet(srfCells);
return outData;
}

@ -47,7 +47,7 @@ inline VTKM_CONT vtkm::cont::DataSet Streamline::DoExecute(
throw vtkm::cont::ErrorFilterExecution("No seeds provided.");
}
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
const vtkm::cont::CoordinateSystem& coords =
input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex());
@ -71,7 +71,7 @@ inline VTKM_CONT vtkm::cont::DataSet Streamline::DoExecute(
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outputCoords("coordinates", res.positions);
outData.AddCellSet(res.polyLines);
outData.SetCellSet(res.polyLines);
outData.AddCoordinateSystem(outputCoords);
return outData;

@ -83,8 +83,7 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
throw vtkm::cont::ErrorFilterExecution("No normals selected.");
}
const auto cellset =
vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(this->GetActiveCellSetIndex()), policy);
const auto cellset = vtkm::filter::ApplyPolicyUnstructured(input.GetCellSet(), policy);
const auto& coords = input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()).GetData();
vtkm::cont::ArrayHandle<vtkm::Vec3f> faceNormals;
@ -103,14 +102,13 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
result = CreateResultFieldPoint(input, pointNormals, internal::ComputePointNormalsName(this));
if (this->GenerateCellNormals)
{
result.AddField(vtkm::cont::make_FieldCell(
internal::ComputeCellNormalsName(this), cellset.GetName(), faceNormals));
result.AddField(
vtkm::cont::make_FieldCell(internal::ComputeCellNormalsName(this), faceNormals));
}
}
else
{
result =
CreateResultFieldCell(input, faceNormals, internal::ComputeCellNormalsName(this), cellset);
result = CreateResultFieldCell(input, faceNormals, internal::ComputeCellNormalsName(this));
}
if (this->AutoOrientNormals)
@ -146,31 +144,7 @@ inline vtkm::cont::DataSet SurfaceNormals::DoExecute(
if (this->Consistency && this->GenerateCellNormals)
{
auto newCells = vtkm::worklet::TriangleWinding::Run(cellset, coords, faceNormals);
// Add the new cells into the result:
vtkm::cont::DataSet newResult;
for (vtkm::Id i = 0; i < result.GetNumberOfCoordinateSystems(); ++i)
{
newResult.AddCoordinateSystem(result.GetCoordinateSystem(i));
}
const vtkm::Id activeCells = this->GetActiveCellSetIndex();
for (vtkm::Id i = 0; i < result.GetNumberOfCellSets(); ++i)
{
if (i != activeCells)
{
newResult.AddCellSet(result.GetCellSet(i));
}
else
{
newResult.AddCellSet(newCells);
}
}
for (vtkm::Id i = 0; i < result.GetNumberOfFields(); ++i)
{
newResult.AddField(result.GetField(i));
}
result = newResult;
result.SetCellSet(newCells); // Overwrite the cellset in the result
}
return result;

@ -40,7 +40,7 @@ inline VTKM_CONT vtkm::cont::DataSet Tetrahedralize::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::filter::PolicyBase<DerivedPolicy>& policy)
{
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::CellSetSingleType<> outCellSet;
vtkm::cont::CastAndCall(
@ -48,7 +48,7 @@ inline VTKM_CONT vtkm::cont::DataSet Tetrahedralize::DoExecute(
// create the output dataset
vtkm::cont::DataSet output;
output.AddCellSet(outCellSet);
output.SetCellSet(outCellSet);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
return output;
}

@ -61,14 +61,14 @@ inline VTKM_CONT vtkm::cont::DataSet Threshold::DoExecute(
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
//get the cells and coordinates of the dataset
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
ThresholdRange predicate(this->GetLowerThreshold(), this->GetUpperThreshold());
vtkm::cont::DynamicCellSet cellOut = this->Worklet.Run(
vtkm::filter::ApplyPolicy(cells, policy), field, fieldMeta.GetAssociation(), predicate);
vtkm::cont::DataSet output;
output.AddCellSet(cellOut);
output.SetCellSet(cellOut);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
return output;
}

@ -143,7 +143,7 @@ inline VTKM_CONT vtkm::cont::DataSet ThresholdPoints::DoExecute(
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
// extract the input cell set
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
// field to threshold on must be a point field
if (fieldMeta.IsPointField() == false)
@ -181,7 +181,7 @@ inline VTKM_CONT vtkm::cont::DataSet ThresholdPoints::DoExecute(
// create the output dataset
vtkm::cont::DataSet output;
output.AddCellSet(outCellSet);
output.SetCellSet(outCellSet);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
// compact the unused points in the output dataset

@ -65,7 +65,7 @@ inline VTKM_CONT vtkm::cont::DataSet Triangulate::DoExecute(
const vtkm::cont::DataSet& input,
vtkm::filter::PolicyBase<DerivedPolicy> policy)
{
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet(this->GetActiveCellSetIndex());
const vtkm::cont::DynamicCellSet& cells = input.GetCellSet();
vtkm::cont::CellSetSingleType<> outCellSet;
DeduceCellSet triangulate(this->Worklet, outCellSet);
@ -74,7 +74,7 @@ inline VTKM_CONT vtkm::cont::DataSet Triangulate::DoExecute(
// create the output dataset
vtkm::cont::DataSet output;
output.AddCellSet(outCellSet);
output.SetCellSet(outCellSet);
output.AddCoordinateSystem(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()));
return output;

@ -36,13 +36,13 @@ inline VTKM_CONT vtkm::cont::DataSet Tube::DoExecute(const vtkm::cont::DataSet&
vtkm::cont::ArrayHandle<vtkm::Vec3f> newPoints;
vtkm::cont::CellSetSingleType<> newCells;
this->Worklet.Run(input.GetCoordinateSystem(this->GetActiveCoordinateSystemIndex()),
input.GetCellSet(this->GetActiveCellSetIndex()),
input.GetCellSet(),
newPoints,
newCells);
vtkm::cont::DataSet outData;
vtkm::cont::CoordinateSystem outCoords("coordinates", newPoints);
outData.AddCellSet(newCells);
outData.SetCellSet(newCells);
outData.AddCoordinateSystem(outCoords);
return outData;
}

@ -43,25 +43,11 @@ inline VTKM_CONT ZFPCompressor1D::ZFPCompressor1D()
//-----------------------------------------------------------------------------
template <typename T, typename StorageType, typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor1D::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<T, StorageType>& field,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
// Check the fields of the dataset to see what kinds of fields are present so
// we can free the mapping arrays that won't be needed. A point field must
// exist for this algorithm, so just check cells.
const vtkm::Id numFields = input.GetNumberOfFields();
bool hasCellFields = false;
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
{
auto f = input.GetField(fieldIdx);
if (f.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
hasCellFields = true;
}
}
auto compressed = compressor.Compress(field, rate, field.GetNumberOfValues());
vtkm::cont::DataSet dataset;

@ -47,28 +47,15 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor2D::DoExecute(
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
// Check the fields of the dataset to see what kinds of fields are present so
// we can free the mapping arrays that won't be needed. A point field must
// exist for this algorithm, so just check cells.
const vtkm::Id numFields = input.GetNumberOfFields();
bool hasCellFields = false;
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
{
auto f = input.GetField(fieldIdx);
if (f.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
hasCellFields = true;
}
}
vtkm::cont::CellSetStructured<2> cellSet;
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
input.GetCellSet().CopyTo(cellSet);
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
auto compressed = compressor.Compress(field, rate, pointDimensions);
vtkm::cont::DataSet dataset;
dataset.AddCellSet(cellSet);
dataset.SetCellSet(cellSet);
dataset.AddField(vtkm::cont::make_FieldPoint("compressed", compressed));
return dataset;

@ -47,28 +47,15 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPCompressor3D::DoExecute(
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
// Check the fields of the dataset to see what kinds of fields are present so
// we can free the mapping arrays that won't be needed. A point field must
// exist for this algorithm, so just check cells.
const vtkm::Id numFields = input.GetNumberOfFields();
bool hasCellFields = false;
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
{
auto f = input.GetField(fieldIdx);
if (f.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
hasCellFields = true;
}
}
vtkm::cont::CellSetStructured<3> cellSet;
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
input.GetCellSet().CopyTo(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
auto compressed = compressor.Compress(field, rate, pointDimensions);
vtkm::cont::DataSet dataset;
dataset.AddCellSet(cellSet);
dataset.SetCellSet(cellSet);
dataset.AddField(vtkm::cont::make_FieldPoint("compressed", compressed));
return dataset;

@ -39,25 +39,11 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(
//-----------------------------------------------------------------------------
template <typename StorageType, typename DerivedPolicy>
inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor1D::DoExecute(
const vtkm::cont::DataSet& input,
const vtkm::cont::DataSet&,
const vtkm::cont::ArrayHandle<vtkm::Int64, StorageType>& field,
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
// Check the fields of the dataset to see what kinds of fields are present so
// we can free the mapping arrays that won't be needed. A point field must
// exist for this algorithm, so just check cells.
const vtkm::Id numFields = input.GetNumberOfFields();
bool hasCellFields = false;
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
{
auto f = input.GetField(fieldIdx);
if (f.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
hasCellFields = true;
}
}
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;
decompressor.Decompress(field, decompress, rate, field.GetNumberOfValues());

@ -45,22 +45,8 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor2D::DoExecute(
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
// Check the fields of the dataset to see what kinds of fields are present so
// we can free the mapping arrays that won't be needed. A point field must
// exist for this algorithm, so just check cells.
const vtkm::Id numFields = input.GetNumberOfFields();
bool hasCellFields = false;
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
{
auto f = input.GetField(fieldIdx);
if (f.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
hasCellFields = true;
}
}
vtkm::cont::CellSetStructured<2> cellSet;
input.GetCellSet(this->GetActiveCellSetIndex()).CopyTo(cellSet);
input.GetCellSet().CopyTo(cellSet);
vtkm::Id2 pointDimensions = cellSet.GetPointDimensions();
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;

@ -44,22 +44,8 @@ inline VTKM_CONT vtkm::cont::DataSet ZFPDecompressor3D::DoExecute(
const vtkm::filter::FieldMetadata&,
const vtkm::filter::PolicyBase<DerivedPolicy>&)
{
// Check the fields of the dataset to see what kinds of fields are present so
// we can free the mapping arrays that won't be needed. A point field must
// exist for this algorithm, so just check cells.
const vtkm::Id numFields = input.GetNumberOfFields();
bool hasCellFields = false;
for (vtkm::Id fieldIdx = 0; fieldIdx < numFields && !hasCellFields; ++fieldIdx)
{
auto f = input.GetField(fieldIdx);
if (f.GetAssociation() == vtkm::cont::Field::Association::CELL_SET)
{
hasCellFields = true;
}
}
vtkm::cont::CellSetStructured<3> cellSet;
input.GetCellSet(this->GetActiveCoordinateSystemIndex()).CopyTo(cellSet);
input.GetCellSet().CopyTo(cellSet);
vtkm::Id3 pointDimensions = cellSet.GetPointDimensions();
vtkm::cont::ArrayHandle<vtkm::Float64> decompress;

@ -30,12 +30,9 @@ void TestCellMeasuresFilter(vtkm::cont::DataSet& dataset,
vtkm::cont::DataSet outputData = vols.Execute(dataset);
VTKM_TEST_ASSERT(vols.GetCellMeasureName().empty(), "Default output field name should be empty.");
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
VTKM_TEST_ASSERT(outputData.GetCellSet().GetNumberOfCells() ==
static_cast<vtkm::Id>(expected.size()),
VTKM_TEST_ASSERT(outputData.GetNumberOfCells() == static_cast<vtkm::Id>(expected.size()),
"Wrong number of cells in the output dataset");
// Check that the empty measure name above produced a field with the expected name.

@ -101,10 +101,10 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
static constexpr vtkm::IdComponent ndim = 3;
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
cellSet.SetPointDimensions(vdims);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
dataSet.AddField(vtkm::cont::make_FieldPoint("nodevar", pointFieldArray));
dataSet.AddField(vtkm::cont::make_FieldCell("cellvar", "cells", cellFieldArray));
dataSet.AddField(vtkm::cont::make_FieldCell("cellvar", cellFieldArray));
return dataSet;
}

@ -80,7 +80,7 @@ void TestPointMerging()
constexpr vtkm::Id originalNumPoints = 228;
constexpr vtkm::Id originalNumCells = 76;
VTKM_TEST_ASSERT(inData.GetCellSet().GetNumberOfPoints() == originalNumPoints);
VTKM_TEST_ASSERT(inData.GetCellSet().GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(inData.GetNumberOfCells() == originalNumCells);
vtkm::filter::CleanGrid cleanGrid;
@ -89,9 +89,9 @@ void TestPointMerging()
cleanGrid.SetMergePoints(false);
cleanGrid.SetRemoveDegenerateCells(false);
vtkm::cont::DataSet noMerging = cleanGrid.Execute(inData);
VTKM_TEST_ASSERT(noMerging.GetCellSet().GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(noMerging.GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(noMerging.GetCellSet().GetNumberOfPoints() == originalNumPoints);
VTKM_TEST_ASSERT(noMerging.GetCoordinateSystem().GetNumberOfPoints() == originalNumPoints);
VTKM_TEST_ASSERT(noMerging.GetNumberOfPoints() == originalNumPoints);
VTKM_TEST_ASSERT(noMerging.GetField("pointvar").GetNumberOfValues() == originalNumPoints);
VTKM_TEST_ASSERT(noMerging.GetField("cellvar").GetNumberOfValues() == originalNumCells);
@ -100,18 +100,18 @@ void TestPointMerging()
cleanGrid.SetFastMerge(false);
vtkm::cont::DataSet closeMerge = cleanGrid.Execute(inData);
constexpr vtkm::Id closeMergeNumPoints = 62;
VTKM_TEST_ASSERT(closeMerge.GetCellSet().GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(closeMerge.GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(closeMerge.GetCellSet().GetNumberOfPoints() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeMerge.GetCoordinateSystem().GetNumberOfPoints() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeMerge.GetNumberOfPoints() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeMerge.GetField("pointvar").GetNumberOfValues() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeMerge.GetField("cellvar").GetNumberOfValues() == originalNumCells);
std::cout << "Clean grid by merging very close points with fast merge" << std::endl;
cleanGrid.SetFastMerge(true);
vtkm::cont::DataSet closeFastMerge = cleanGrid.Execute(inData);
VTKM_TEST_ASSERT(closeFastMerge.GetCellSet().GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(closeFastMerge.GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(closeFastMerge.GetCellSet().GetNumberOfPoints() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeFastMerge.GetCoordinateSystem().GetNumberOfPoints() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeFastMerge.GetNumberOfPoints() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeFastMerge.GetField("pointvar").GetNumberOfValues() == closeMergeNumPoints);
VTKM_TEST_ASSERT(closeFastMerge.GetField("cellvar").GetNumberOfValues() == originalNumCells);
@ -120,9 +120,9 @@ void TestPointMerging()
cleanGrid.SetTolerance(0.1);
vtkm::cont::DataSet farMerge = cleanGrid.Execute(inData);
constexpr vtkm::Id farMergeNumPoints = 36;
VTKM_TEST_ASSERT(farMerge.GetCellSet().GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(farMerge.GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(farMerge.GetCellSet().GetNumberOfPoints() == farMergeNumPoints);
VTKM_TEST_ASSERT(farMerge.GetCoordinateSystem().GetNumberOfPoints() == farMergeNumPoints);
VTKM_TEST_ASSERT(farMerge.GetNumberOfPoints() == farMergeNumPoints);
VTKM_TEST_ASSERT(farMerge.GetField("pointvar").GetNumberOfValues() == farMergeNumPoints);
VTKM_TEST_ASSERT(farMerge.GetField("cellvar").GetNumberOfValues() == originalNumCells);
@ -130,9 +130,9 @@ void TestPointMerging()
cleanGrid.SetFastMerge(true);
vtkm::cont::DataSet farFastMerge = cleanGrid.Execute(inData);
constexpr vtkm::Id farFastMergeNumPoints = 19;
VTKM_TEST_ASSERT(farFastMerge.GetCellSet().GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(farFastMerge.GetNumberOfCells() == originalNumCells);
VTKM_TEST_ASSERT(farFastMerge.GetCellSet().GetNumberOfPoints() == farFastMergeNumPoints);
VTKM_TEST_ASSERT(farFastMerge.GetCoordinateSystem().GetNumberOfPoints() == farFastMergeNumPoints);
VTKM_TEST_ASSERT(farFastMerge.GetNumberOfPoints() == farFastMergeNumPoints);
VTKM_TEST_ASSERT(farFastMerge.GetField("pointvar").GetNumberOfValues() == farFastMergeNumPoints);
VTKM_TEST_ASSERT(farFastMerge.GetField("cellvar").GetNumberOfValues() == originalNumCells);
@ -141,10 +141,9 @@ void TestPointMerging()
cleanGrid.SetRemoveDegenerateCells(true);
vtkm::cont::DataSet noDegenerateCells = cleanGrid.Execute(inData);
constexpr vtkm::Id numNonDegenerateCells = 33;
VTKM_TEST_ASSERT(noDegenerateCells.GetCellSet().GetNumberOfCells() == numNonDegenerateCells);
VTKM_TEST_ASSERT(noDegenerateCells.GetNumberOfCells() == numNonDegenerateCells);
VTKM_TEST_ASSERT(noDegenerateCells.GetCellSet().GetNumberOfPoints() == farFastMergeNumPoints);
VTKM_TEST_ASSERT(noDegenerateCells.GetCoordinateSystem().GetNumberOfPoints() ==
farFastMergeNumPoints);
VTKM_TEST_ASSERT(noDegenerateCells.GetNumberOfPoints() == farFastMergeNumPoints);
VTKM_TEST_ASSERT(noDegenerateCells.GetField("pointvar").GetNumberOfValues() ==
farFastMergeNumPoints);
VTKM_TEST_ASSERT(noDegenerateCells.GetField("cellvar").GetNumberOfValues() ==

@ -62,8 +62,6 @@ void TestClipExplicit()
const vtkm::cont::DataSet outputData = clip.Execute(ds);
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 1,

@ -56,13 +56,11 @@ void TestClipStructured()
vtkm::cont::DataSet outputData = clip.Execute(ds);
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 1,
"Wrong number of fields in the output dataset");
VTKM_TEST_ASSERT(outputData.GetCellSet().GetNumberOfCells() == 8,
VTKM_TEST_ASSERT(outputData.GetNumberOfCells() == 8,
"Wrong number of cells in the output dataset");
vtkm::cont::VariantArrayHandle temp = outputData.GetField("scalars").GetData();
@ -96,13 +94,9 @@ void TestClipStructuredInverted()
clip.SetFieldsToPass("scalars");
auto outputData = clip.Execute(ds);
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 1,
"Wrong number of fields in the output dataset");
VTKM_TEST_ASSERT(outputData.GetCellSet().GetNumberOfCells() == 4,
VTKM_TEST_ASSERT(outputData.GetNumberOfCells() == 4,
"Wrong number of cells in the output dataset");
vtkm::cont::VariantArrayHandle temp = outputData.GetField("scalars").GetData();

@ -103,7 +103,7 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
static constexpr vtkm::IdComponent ndim = 3;
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
cellSet.SetPointDimensions(vdims);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -263,7 +263,7 @@ inline vtkm::cont::DataSet MakeRadiantDataSet::Make3DRadiantDataSet(vtkm::IdComp
CellSet cellSet("cells");
cellSet.Fill(coordinates.GetNumberOfValues(), HexTag::Id, HexTraits::NUM_POINTS, connectivity);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
@ -284,8 +284,6 @@ void TestContourUniformGrid()
auto result = mc.Execute(dataSet);
{
VTKM_TEST_ASSERT(result.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
VTKM_TEST_ASSERT(result.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
//since normals is on we have one field
@ -358,10 +356,6 @@ void TestContourCustomPolicy()
mc.SetFieldsToPass({ "distanceToOrigin", "distanceToOther" });
vtkm::cont::DataSet outputData = mc.Execute(dataSet, PolicyRadiantDataSet{});
VTKM_TEST_ASSERT(outputData.GetNumberOfCellSets() == 1,
"Wrong number of cellsets in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset");
VTKM_TEST_ASSERT(outputData.GetNumberOfFields() == 2,
"Wrong number of fields in the output dataset");

@ -94,7 +94,7 @@ vtkm::cont::DataSet MakeTestDataSet(const CoordinateType& cType)
}
cellSet.CompleteAddingCells(vtkm::Id(coordinates.size()));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}

@ -96,7 +96,7 @@ vtkm::cont::DataSet MakeIsosurfaceTestDataSet(vtkm::Id3 dims)
static constexpr vtkm::IdComponent ndim = 3;
vtkm::cont::CellSetStructured<ndim> cellSet("cells");
cellSet.SetPointDimensions(vdims);
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}

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

@ -39,8 +39,7 @@ public:
extractGeometry.SetExtractOnlyBoundaryCells(false);
vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8),
"Wrong result for ExtractGeometry");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8), "Wrong result for ExtractGeometry");
vtkm::cont::ArrayHandle<vtkm::Float32> outCellData;
output.GetField("cellvar").GetData().CopyTo(outCellData);
@ -67,8 +66,7 @@ public:
extractGeometry.SetExtractOnlyBoundaryCells(false);
vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 56),
"Wrong result for ExtractGeometry");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 56), "Wrong result for ExtractGeometry");
vtkm::cont::ArrayHandle<vtkm::Float32> outCellData;
output.GetField("cellvar").GetData().CopyTo(outCellData);
@ -95,8 +93,7 @@ public:
extractGeometry.SetExtractOnlyBoundaryCells(false);
vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 64),
"Wrong result for ExtractGeometry");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 64), "Wrong result for ExtractGeometry");
vtkm::cont::ArrayHandle<vtkm::Float32> outCellData;
output.GetField("cellvar").GetData().CopyTo(outCellData);
@ -122,8 +119,7 @@ public:
extractGeometry.SetExtractOnlyBoundaryCells(true);
vtkm::cont::DataSet output = extractGeometry.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 56),
"Wrong result for ExtractGeometry");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 56), "Wrong result for ExtractGeometry");
vtkm::cont::ArrayHandle<vtkm::Float32> outCellData;
output.GetField("cellvar").GetData().CopyTo(outCellData);

@ -38,14 +38,13 @@ public:
extractPoints.SetCompactPoints(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 27),
"Wrong result for ExtractPoints");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 27), "Wrong result for ExtractPoints");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
output.GetField("pointvar").GetData().CopyTo(outPointData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractPoints filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 99.0f,
@ -71,17 +70,16 @@ public:
extractPoints.SetCompactPoints(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 98),
"Wrong result for ExtractPoints");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 98), "Wrong result for ExtractPoints");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
output.GetField("pointvar").GetData().CopyTo(outPointData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractPoints filter");
for (vtkm::Id i = 0; i < output.GetCellSet(0).GetNumberOfPoints(); i++)
for (vtkm::Id i = 0; i < output.GetCellSet().GetNumberOfPoints(); i++)
{
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(i) == 0.0f,
"Wrong point field data");
@ -104,8 +102,7 @@ public:
extractPoints.SetExtractInside(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 27),
"Wrong result for ExtractPoints");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 27), "Wrong result for ExtractPoints");
}
void TestExplicitByBox0() const
@ -124,8 +121,7 @@ public:
extractPoints.SetExtractInside(true);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8),
"Wrong result for ExtractPoints");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8), "Wrong result for ExtractPoints");
}
void TestExplicitByBox1() const
@ -144,8 +140,7 @@ public:
extractPoints.SetExtractInside(false);
vtkm::cont::DataSet output = extractPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 3),
"Wrong result for ExtractPoints");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 3), "Wrong result for ExtractPoints");
}
void operator()() const

@ -35,9 +35,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 9),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 9),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 4),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 4),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -46,11 +46,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 71.0f,
"Wrong point field data");
@ -74,9 +73,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 27),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 27),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 8),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -85,11 +84,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 99.0f,
"Wrong point field data");
@ -115,9 +113,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 125),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 125),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 64),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 64),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -126,11 +124,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(31) == 99.0f,
"Wrong point field data");
@ -155,9 +152,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 27),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 27),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 8),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -166,11 +163,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(26) == 15.0f,
@ -194,9 +190,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 64),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 64),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 27),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 27),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -205,11 +201,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 99.0f,
"Wrong point field data");
@ -235,9 +230,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 27),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 27),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 8),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -246,11 +241,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 90.0f,
"Wrong point field data");
@ -276,9 +270,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 9),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 9),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 4),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 4),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -287,11 +281,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 90.0f,
"Wrong point field data");
@ -316,9 +309,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 27),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 27),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 8),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -327,11 +320,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(26) == 0.0f,
@ -356,9 +348,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 8),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 8),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 1),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 1),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -367,11 +359,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(7) == 97.0f,
@ -395,9 +386,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 18),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 18),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 4),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 4),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -406,11 +397,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(4) == 99.0f,
@ -437,9 +427,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 4),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 4),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 1),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 1),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -448,11 +438,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(3) == 4.0f, "Wrong point field data");
@ -475,9 +464,9 @@ public:
extract.SetFieldsToPass({ "pointvar", "cellvar" });
vtkm::cont::DataSet output = extract.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfPoints(), 8),
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfPoints(), 8),
"Wrong result for ExtractStructured worklet");
VTKM_TEST_ASSERT(test_equal(output.GetCellSet(0).GetNumberOfCells(), 1),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 1),
"Wrong result for ExtractStructured worklet");
vtkm::cont::ArrayHandle<vtkm::Float32> outPointData;
@ -486,11 +475,10 @@ public:
output.GetField("cellvar").GetData().CopyTo(outCellData);
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(
test_equal(output.GetCellSet(0).GetNumberOfCells(), outCellData.GetNumberOfValues()),
test_equal(output.GetCellSet().GetNumberOfPoints(), outPointData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), outCellData.GetNumberOfValues()),
"Data/Geometry mismatch for ExtractStructured filter");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(0) == 0.0f, "Wrong point field data");
VTKM_TEST_ASSERT(outPointData.GetPortalConstControl().Get(7) == 10.0f,

@ -52,14 +52,13 @@ void TestFieldTypesCell()
{
vtkm::filter::FieldMetadata defaultMD;
vtkm::filter::FieldMetadata helperMD(
vtkm::cont::make_FieldCell("foo", std::string(), vtkm::cont::ArrayHandle<vtkm::Float32>()));
vtkm::cont::make_FieldCell("foo", vtkm::cont::ArrayHandle<vtkm::Float32>()));
VTKM_TEST_ASSERT(helperMD.IsPointField() == false, "cell can't be a point field");
VTKM_TEST_ASSERT(helperMD.IsCellField() == true, "cell should be a cell field");
//verify the field helper works properly
vtkm::Float32 vars[6] = { 10.1f, 20.1f, 30.1f, 40.1f, 50.1f, 60.1f };
auto field =
vtkm::cont::make_FieldCell("pointvar", std::string(), vtkm::cont::make_ArrayHandle(vars, 6));
auto field = vtkm::cont::make_FieldCell("pointvar", vtkm::cont::make_ArrayHandle(vars, 6));
vtkm::filter::FieldMetadata makeMDFromField(field);
VTKM_TEST_ASSERT(makeMDFromField.IsPointField() == false, "cell can't be a point field");
VTKM_TEST_ASSERT(makeMDFromField.IsCellField() == true, "cell should be a cell field");

@ -106,10 +106,9 @@ void TestStructured()
auto output = addGhost.Execute(ds, vtkm::filter::GhostCellClassifyPolicy());
//Validate the output.
VTKM_TEST_ASSERT(output.GetNumberOfCellSets() == 1, "Wrong number of cell sets in output");
VTKM_TEST_ASSERT(output.HasCellField("vtkmGhostCells"),
"Ghost cells array not found in output");
vtkm::Id numCells = output.GetCellSet(0).GetNumberOfCells();
vtkm::Id numCells = output.GetNumberOfCells();
auto fieldArray = output.GetCellField("vtkmGhostCells").GetData();
VTKM_TEST_ASSERT(fieldArray.GetNumberOfValues() == numCells,
"Wrong number of values in ghost cell array");

@ -189,7 +189,7 @@ static vtkm::cont::DataSet MakeExplicit(vtkm::Id numI, vtkm::Id numJ, vtkm::Id n
for (vtkm::Id i = 0; i < numPts; i++)
explPortal.Set(i, cp.Get(i));
vtkm::cont::DynamicCellSet cellSet = dsUniform.GetCellSet(0);
vtkm::cont::DynamicCellSet cellSet = dsUniform.GetCellSet();
vtkm::cont::ArrayHandle<vtkm::Id> conn;
vtkm::cont::ArrayHandle<vtkm::IdComponent> numIndices;
vtkm::cont::ArrayHandle<vtkm::UInt8> shapes;
@ -265,11 +265,10 @@ void TestGhostCellRemove()
static_cast<vtkm::UInt8>(vtkm::CellClassification::GHOST));
auto output = ghostCellRemoval.Execute(ds, vtkm::filter::GhostCellRemovePolicy());
vtkm::Id numCells = output.GetCellSet(0).GetNumberOfCells();
vtkm::Id numCells = output.GetNumberOfCells();
//Validate the output.
VTKM_TEST_ASSERT(output.GetNumberOfCellSets() == 1,
"Wrong number of cell sets in output");
vtkm::Id numCellsReq = (nx - 2 * layer) * (ny - 2 * layer);
if (nz != 0)
numCellsReq *= (nz - 2 * layer);
@ -279,18 +278,18 @@ void TestGhostCellRemove()
{
if (nz == 0)
{
VTKM_TEST_ASSERT(output.GetCellSet(0).IsSameType(vtkm::cont::CellSetStructured<2>()),
VTKM_TEST_ASSERT(output.GetCellSet().IsSameType(vtkm::cont::CellSetStructured<2>()),
"Wrong cell type for explicit conversion");
}
else if (nz > 0)
{
VTKM_TEST_ASSERT(output.GetCellSet(0).IsSameType(vtkm::cont::CellSetStructured<3>()),
VTKM_TEST_ASSERT(output.GetCellSet().IsSameType(vtkm::cont::CellSetStructured<3>()),
"Wrong cell type for explicit conversion");
}
}
else
{
VTKM_TEST_ASSERT(output.GetCellSet(0).IsType<vtkm::cont::CellSetExplicit<>>(),
VTKM_TEST_ASSERT(output.GetCellSet().IsType<vtkm::cont::CellSetExplicit<>>(),
"Wrong cell type for explicit conversion");
}
}
@ -307,7 +306,7 @@ void TestGhostCellRemove()
vtkm::filter::GhostCellRemove ghostCellRemoval;
ghostCellRemoval.RemoveGhostField();
auto output = ghostCellRemoval.Execute(ds, vtkm::filter::GhostCellRemovePolicy());
VTKM_TEST_ASSERT(output.GetCellSet(0).IsType<vtkm::cont::CellSetExplicit<>>(),
VTKM_TEST_ASSERT(output.GetCellSet().IsType<vtkm::cont::CellSetExplicit<>>(),
"Wrong cell type for explicit conversion");
}
}

@ -227,36 +227,23 @@ vtkm::cont::DataSet MakeTestDataSet()
"p_uniform", vtkm::cont::Field::Association::POINTS, uniform, nVerts, vtkm::CopyFlag::On));
// Set cell scalars
dataSet.AddField(vtkm::cont::make_Field("c_poisson",
vtkm::cont::Field::Association::CELL_SET,
"cells",
poisson,
nCells,
vtkm::CopyFlag::On));
dataSet.AddField(vtkm::cont::make_Field("c_normal",
vtkm::cont::Field::Association::CELL_SET,
"cells",
normal,
nCells,
vtkm::CopyFlag::On));
dataSet.AddField(vtkm::cont::make_Field(
"c_poisson", vtkm::cont::Field::Association::CELL_SET, poisson, nCells, vtkm::CopyFlag::On));
dataSet.AddField(vtkm::cont::make_Field(
"c_normal", vtkm::cont::Field::Association::CELL_SET, normal, nCells, vtkm::CopyFlag::On));
dataSet.AddField(vtkm::cont::make_Field("c_chiSquare",
vtkm::cont::Field::Association::CELL_SET,
"cells",
chiSquare,
nCells,
vtkm::CopyFlag::On));
dataSet.AddField(vtkm::cont::make_Field("c_uniform",
vtkm::cont::Field::Association::CELL_SET,
"cells",
poisson,
nCells,
vtkm::CopyFlag::On));
dataSet.AddField(vtkm::cont::make_Field(
"c_uniform", vtkm::cont::Field::Association::CELL_SET, poisson, nCells, vtkm::CopyFlag::On));
vtkm::cont::CellSetStructured<dimension> cellSet("cells");
//Set regular structure
cellSet.SetPointDimensions(vtkm::make_Vec(xVerts, yVerts));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}

@ -78,17 +78,15 @@ void TestLagrangianFilterMultiStepInterval()
vtkm::cont::DataSet extractedBasisFlows = lagrangianFilter2.Execute(input);
if (i % write_interval == 0)
{
VTKM_TEST_ASSERT(extractedBasisFlows.GetNumberOfCellSets() == 1,
"Wrong number of cell sets in the output dataset.");
VTKM_TEST_ASSERT(extractedBasisFlows.GetNumberOfCoordinateSystems() == 1,
"Wrong number of coordinate systems in the output dataset.");
VTKM_TEST_ASSERT(extractedBasisFlows.GetCellSet().GetNumberOfCells() == 3375,
VTKM_TEST_ASSERT(extractedBasisFlows.GetNumberOfCells() == 3375,
"Wrong number of basis flows extracted.");
}
else
{
VTKM_TEST_ASSERT(extractedBasisFlows.GetNumberOfCellSets() == 0,
"Wrong number of cell sets in the output dataset.");
VTKM_TEST_ASSERT(extractedBasisFlows.GetNumberOfCells() == 0,
"Output dataset should have no cells.");
VTKM_TEST_ASSERT(extractedBasisFlows.GetNumberOfCoordinateSystems() == 0,
"Wrong number of coordinate systems in the output dataset.");
}

@ -33,8 +33,7 @@ public:
vtkm::cont::DataSet output = mask.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 8),
"Wrong result for Mask");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 8), "Wrong result for Mask");
vtkm::cont::ArrayHandle<vtkm::Float32> cellFieldArray;
@ -56,8 +55,7 @@ public:
mask.SetStride(stride);
vtkm::cont::DataSet output = mask.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 7),
"Wrong result for Mask");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 7), "Wrong result for Mask");
vtkm::cont::ArrayHandle<vtkm::Float32> cellFieldArray;
output.GetField("cellvar").GetData().CopyTo(cellFieldArray);
@ -78,8 +76,7 @@ public:
mask.SetStride(stride);
vtkm::cont::DataSet output = mask.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 2),
"Wrong result for Mask");
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 2), "Wrong result for Mask");
vtkm::cont::ArrayHandle<vtkm::Float32> cellFieldArray;
output.GetField("cellvar").GetData().CopyTo(cellFieldArray);

@ -30,7 +30,7 @@ public:
maskPoints.SetStride(2);
maskPoints.SetFieldsToPass("pointvar");
vtkm::cont::DataSet output = maskPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 12),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 12),
"Wrong number of cells for MaskPoints");
VTKM_TEST_ASSERT(test_equal(output.GetField("pointvar").GetNumberOfValues(), 12),
"Wrong number of points for MaskPoints");
@ -45,7 +45,7 @@ public:
maskPoints.SetStride(5);
maskPoints.SetFieldsToPass("pointvar");
vtkm::cont::DataSet output = maskPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 25),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 25),
"Wrong number of cells for MaskPoints");
VTKM_TEST_ASSERT(test_equal(output.GetField("pointvar").GetNumberOfValues(), 25),
"Wrong number of points for MaskPoints");
@ -61,7 +61,7 @@ public:
maskPoints.SetCompactPoints(false);
maskPoints.SetFieldsToPass("pointvar");
vtkm::cont::DataSet output = maskPoints.Execute(dataset);
VTKM_TEST_ASSERT(test_equal(output.GetCellSet().GetNumberOfCells(), 3),
VTKM_TEST_ASSERT(test_equal(output.GetNumberOfCells(), 3),
"Wrong number of cells for MaskPoints");
VTKM_TEST_ASSERT(test_equal(output.GetField("pointvar").GetNumberOfValues(), 11),
"Wrong number of points for MaskPoints");

@ -51,7 +51,7 @@ vtkm::cont::DataSet MakePointElevationTestDataSet()
}
cellSet.CompleteAddingCells(vtkm::Id(coordinates.size()));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}
}

@ -56,7 +56,7 @@ vtkm::cont::DataSet MakePointTransformTestDataSet()
}
cellSet.CompleteAddingCells(vtkm::Id(coordinates.size()));
dataSet.AddCellSet(cellSet);
dataSet.SetCellSet(cellSet);
return dataSet;
}

@ -50,7 +50,7 @@ vtkm::cont::DataSet ConvertDataSetUniformToExplicit(const vtkm::cont::DataSet& u
vtkm::cont::DataSet eds;
vtkm::cont::CellSetExplicit<> cs(uds.GetCellSet().GetName());
vtkm::worklet::CellDeepCopy::Run(uds.GetCellSet(), cs);
eds.AddCellSet(cs);
eds.SetCellSet(cs);
vtkm::cont::ArrayHandle<vtkm::Vec3f> points;
vtkm::cont::ArrayCopy(uds.GetCoordinateSystem().GetData(), points);

Some files were not shown because too many files have changed in this diff Show More