Commit 10023b8b authored by Sujin Philip's avatar Sujin Philip

Fix vtkm CellSets API

Expect NumberOfPoints as a parameter for the Fill methods
parent 1cac785b
......@@ -70,6 +70,7 @@ namespace cont {
//------------------------------------------------------------------------------
void vtkmCellSetExplicitAOS::Fill(
vtkm::Id numberOfPoints,
const vtkm::cont::ArrayHandle<vtkm::UInt8, tovtkm::vtkAOSArrayContainerTag>&
cellTypes,
const vtkm::cont::ArrayHandle<vtkm::Id, tovtkm::vtkCellArrayContainerTag>&
......@@ -80,7 +81,7 @@ void vtkmCellSetExplicitAOS::Fill(
this->Shapes = cellTypes;
this->Connectivity = connectivity;
this->IndexOffsets = offsets;
this->NumberOfPoints = 0;
this->NumberOfPoints = numberOfPoints;
}
//------------------------------------------------------------------------------
......
......@@ -39,17 +39,10 @@ namespace cont {
class vtkmCellSetExplicitAOS : public CellSet
{
public:
vtkmCellSetExplicitAOS()
: CellSet(std::string()), Shapes(), Connectivity(), IndexOffsets(),
ReverseConnectivityBuilt(false),RConn(), RNumIndices(), RIndexOffsets(),
NumberOfPoints(0)
{
}
vtkmCellSetExplicitAOS(const std::string& name, vtkm::Id numPoints)
vtkmCellSetExplicitAOS(const std::string& name = std::string())
: CellSet(name), Shapes(), Connectivity(), IndexOffsets(),
ReverseConnectivityBuilt(false),RConn(), RNumIndices(), RIndexOffsets(),
NumberOfPoints(numPoints)
NumberOfPoints(0)
{
}
......@@ -103,6 +96,7 @@ public:
/// Assigns the array handles to the explicit connectivity. This is
/// the way you can fill the memory from another system without copying
void Fill(
vtkm::Id numberOfPoints,
const vtkm::cont::ArrayHandle<vtkm::UInt8,
tovtkm::vtkAOSArrayContainerTag>& cellTypes,
const vtkm::cont::ArrayHandle<vtkm::Id, tovtkm::vtkCellArrayContainerTag>&
......
......@@ -86,6 +86,7 @@ vtkm::IdComponent vtkmCellSetSingleType::DetermineNumberOfPoints() const
//------------------------------------------------------------------------------
void vtkmCellSetSingleType::Fill(
vtkm::Id numberOfPoints,
const vtkm::cont::ArrayHandle<vtkm::Id, tovtkm::vtkCellArrayContainerTag>&
connectivity)
{
......@@ -94,6 +95,7 @@ void vtkmCellSetSingleType::Fill(
this->NumberOfCells =
connectivity.GetNumberOfValues() / (numberOfPointsPerCell + 1);
this->Connectivity = connectivity;
this->NumberOfPoints = numberOfPoints;
}
//------------------------------------------------------------------------------
......
......@@ -58,10 +58,10 @@ public:
}
template <typename CellShapeTag>
vtkmCellSetSingleType(CellShapeTag, const std::string& name, vtkm::Id numPoints)
vtkmCellSetSingleType(CellShapeTag, const std::string& name)
: CellSet(name),
NumberOfCells(0),
NumberOfPoints(numPoints),
NumberOfPoints(0),
CellTypeAsId(CellShapeTag::Id),
Connectivity(),
ReverseConnectivityBuilt(false),
......@@ -111,6 +111,7 @@ public:
// This is the way you can fill the memory from another system without copying
void Fill(
vtkm::Id numberOfPoints,
const vtkm::cont::ArrayHandle<vtkm::Id, tovtkm::vtkCellArrayContainerTag>&
connectivity);
......
......@@ -52,50 +52,50 @@ vtkm::cont::DynamicCellSet ConvertSingleType(vtkCellArray* cells, int cellType,
{
case VTK_LINE:
{
CellSetType c(vtkm::CellShapeTagLine(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagLine(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_HEXAHEDRON:
{
CellSetType c(vtkm::CellShapeTagHexahedron(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagHexahedron(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_QUAD:
{
CellSetType c(vtkm::CellShapeTagQuad(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagQuad(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_TETRA:
{
CellSetType c(vtkm::CellShapeTagTetra(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagTetra(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_TRIANGLE:
{
CellSetType c(vtkm::CellShapeTagTriangle(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagTriangle(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_VERTEX:
{
CellSetType c(vtkm::CellShapeTagVertex(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagVertex(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_WEDGE:
{
CellSetType c(vtkm::CellShapeTagWedge(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagWedge(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
case VTK_PYRAMID:
{
CellSetType c(vtkm::CellShapeTagPyramid(), "cells", numberOfPoints);
c.Fill(handle);
CellSetType c(vtkm::CellShapeTagPyramid(), "cells");
c.Fill(numberOfPoints, handle);
return vtkm::cont::DynamicCellSet(c);
}
default:
......@@ -128,8 +128,8 @@ vtkm::cont::DynamicCellSet Convert(vtkUnsignedCharArray* types,
vtkm::cont::ArrayHandle<vtkm::UInt8, ArrayTag> thandle(tstorage);
vtkm::cont::ArrayHandle<vtkIdType, ArrayTag> lhandle(lstorage);
vtkm::cont::vtkmCellSetExplicitAOS cellset("cells", numberOfPoints);
cellset.Fill(thandle, chandle, lhandle);
vtkm::cont::vtkmCellSetExplicitAOS cellset("cells");
cellset.Fill(numberOfPoints, thandle, chandle, lhandle);
return vtkm::cont::DynamicCellSet(cellset);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment