In DynamicCellSet, expose CellSet API.

Also changes GetCellSet() to CastToBase().
This commit is contained in:
T.J. Corona 2016-08-02 13:38:13 -04:00
parent 8f406cf460
commit 8ad8eeda77
10 changed files with 56 additions and 19 deletions

@ -227,7 +227,7 @@ public:
out<<" CellSets["<<this->GetNumberOfCellSets()<<"]\n";
for (vtkm::Id index = 0; index < this->GetNumberOfCellSets(); index++)
{
this->GetCellSet(index).GetCellSet().PrintSummary(out);
this->GetCellSet(index).PrintSummary(out);
}
out<<" Fields["<<this->GetNumberOfFields()<<"]\n";
@ -281,7 +281,7 @@ private:
{
for (std::size_t index=0; index < static_cast<size_t>(this->GetNumberOfCellSets()); ++index)
{
if (this->CellSets[index].GetCellSet().GetName() == name)
if (this->CellSets[index].GetName() == name)
{
found = true;
return static_cast<vtkm::Id>(index);

@ -133,7 +133,7 @@ public:
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName =
dataSet.GetCellSet(cellSetIndex).GetCellSet().GetName();
dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, cellSetName);
}
template <typename T, typename Storage>
@ -145,7 +145,7 @@ public:
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName =
dataSet.GetCellSet(cellSetIndex).GetCellSet().GetName();
dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, cellSetName);
}
template<typename T>
@ -157,7 +157,7 @@ public:
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName =
dataSet.GetCellSet(cellSetIndex).GetCellSet().GetName();
dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, cellSetName);
}
@ -170,7 +170,7 @@ public:
vtkm::Id cellSetIndex = 0)
{
std::string cellSetName =
dataSet.GetCellSet(cellSetIndex).GetCellSet().GetName();
dataSet.GetCellSet(cellSetIndex).GetName();
DataSetFieldAdd::AddCellField(dataSet, fieldName, field, n, cellSetName);
}

@ -181,7 +181,7 @@ public:
/// Returns the contained cell set as the abstract \c CellSet type.
///
VTKM_CONT_EXPORT
const vtkm::cont::CellSet &GetCellSet() const {
const vtkm::cont::CellSet &CastToBase() const {
return *reinterpret_cast<const vtkm::cont::CellSet *>(
this->CellSetContainer->GetVoidPointer());
}
@ -257,6 +257,43 @@ public:
return newCellSet;
}
VTKM_CONT_EXPORT
virtual std::string GetName() const
{
return this->CastToBase().GetName();
}
VTKM_CONT_EXPORT
virtual vtkm::Id GetNumberOfCells() const
{
return this->CastToBase().GetNumberOfCells();
}
VTKM_CONT_EXPORT
virtual vtkm::Id GetNumberOfFaces() const
{
return this->CastToBase().GetNumberOfFaces();
}
VTKM_CONT_EXPORT
virtual vtkm::Id GetNumberOfEdges() const
{
return this->CastToBase().GetNumberOfEdges();
}
VTKM_CONT_EXPORT
virtual vtkm::Id GetNumberOfPoints() const
{
return this->CastToBase().GetNumberOfPoints();
}
VTKM_CONT_EXPORT
virtual void PrintSummary(std::ostream& stream) const
{
return this->CastToBase().PrintSummary(stream);
}
private:
boost::shared_ptr<vtkm::cont::internal::SimplePolymorphicContainerBase>
CellSetContainer;

@ -59,7 +59,7 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
"Wrong number of coordinate systems.");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == numPoints,
"Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == numCells,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == numCells,
"Wrong number of cells.");
//Make sure bounds are correct.

@ -58,7 +58,7 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
"Wrong number of coordinate systems.");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == numPoints,
"Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == numCells,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == numCells,
"Wrong number of cells.");
//Make sure the bounds are correct.

@ -58,7 +58,7 @@ void ValidateDataSet(const vtkm::cont::DataSet &ds,
"Wrong number of coordinate systems.");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == numPoints,
"Wrong number of coordinates.");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == numCells,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == numCells,
"Wrong number of cells.");

@ -80,8 +80,8 @@ void TryNewInstance(
VTKM_TEST_ASSERT(newCellSet.template IsType<CellSetType>(),
"New cell set wrong type.");
VTKM_TEST_ASSERT(&originalCellSet.GetCellSet()
!= &newCellSet.GetCellSet(),
VTKM_TEST_ASSERT(&originalCellSet.CastToBase()
!= &newCellSet.CastToBase(),
"NewInstance did not make a copy.");
}

@ -71,7 +71,7 @@ vtkm::filter::ResultField CellAverage::DoExecute(
outArray,
outputName,
vtkm::cont::Field::ASSOC_CELL_SET,
cellSet.GetCellSet().GetName());
cellSet.GetName());
}
}

@ -332,7 +332,7 @@ void TestReadingPolyData(Format format)
"Incorrect number of fields");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == 8,
"Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == 6,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == 6,
"Incorrect number of cells");
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetSingleType<> >(),
"Incorrect cellset type");
@ -350,7 +350,7 @@ void TestReadingStructuredPoints(Format format)
"Incorrect number of fields");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == 72,
"Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == 30,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == 30,
"Incorrect number of cells");
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3> >(),
"Incorrect cellset type");
@ -368,7 +368,7 @@ void TestReadingStructuredPointsVisIt(Format format)
"Incorrect number of fields");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == 64,
"Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == 27,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == 27,
"Incorrect number of cells");
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetStructured<3> >(),
"Incorrect cellset type");
@ -388,7 +388,7 @@ void TestReadingUnstructuredGrid(Format format)
"Incorrect number of fields");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == 26,
"Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == 15,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == 15,
"Incorrect number of cells");
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetExplicit<> >(),
"Incorrect cellset type");
@ -406,7 +406,7 @@ void TestReadingUnstructuredGridVisIt(Format format)
"Incorrect number of fields");
VTKM_TEST_ASSERT(ds.GetCoordinateSystem().GetData().GetNumberOfValues() == 26,
"Incorrect number of points");
VTKM_TEST_ASSERT(ds.GetCellSet().GetCellSet().GetNumberOfCells() == 15,
VTKM_TEST_ASSERT(ds.GetCellSet().GetNumberOfCells() == 15,
"Incorrect number of cells");
VTKM_TEST_ASSERT(ds.GetCellSet().IsType<vtkm::cont::CellSetExplicit<> >(),
"Incorrect cellset type");

@ -265,7 +265,7 @@ private:
{
continue;
}
if (field.GetAssocCellSet() != cellSet.GetCellSet().GetName()) {
if (field.GetAssocCellSet() != cellSet.GetName()) {
continue;
}