automatically build connectivity as needed.

This commit is contained in:
Jeremy Meredith 2015-09-01 18:37:17 -04:00
parent 407d1619d0
commit 11708c6ef7
2 changed files with 30 additions and 8 deletions

@ -236,14 +236,14 @@ public:
typename ExecutionTypes<Device,FromTopology,ToTopology>::ExecObjectType
PrepareForInput(Device, FromTopology, ToTopology) const
{
this->BuildConnectivity(FromTopology(), ToTopology());
const typename
ConnectivityChooser<FromTopology,ToTopology>::ConnectivityType
&connectivity = this->GetConnectivity(FromTopology(), ToTopology());
VTKM_ASSERT_CONT(connectivity.ElementsValid);
connectivity.BuildIndexOffsets(Device());
typedef typename
ExecutionTypes<Device,FromTopology,ToTopology>::ExecObjectType
ExecObjType;
@ -253,8 +253,35 @@ public:
connectivity.IndexOffsets.PrepareForInput(Device()));
}
void CreateCellToPointConnectivity()
template<typename FromTopology, typename ToTopology>
VTKM_CONT_EXPORT
void BuildConnectivity(FromTopology, ToTopology) const
{
typedef CellSetExplicit<ShapeStorageTag,
NumIndicesStorageTag,
ConnectivityStorageTag> CSE;
CSE *self = const_cast<CSE*>(this);
self->CreateConnectivity(FromTopology(), ToTopology());
self->GetConnectivity(FromTopology(), ToTopology()).
BuildIndexOffsets(VTKM_DEFAULT_DEVICE_ADAPTER_TAG());
}
VTKM_CONT_EXPORT
void CreateConnectivity(vtkm::TopologyElementTagPoint,
vtkm::TopologyElementTagCell)
{
// nothing to do
}
VTKM_CONT_EXPORT
void CreateConnectivity(vtkm::TopologyElementTagCell,
vtkm::TopologyElementTagPoint)
{
if (this->CellToPoint.ElementsValid)
return;
std::multimap<vtkm::Id,vtkm::Id> cells_of_nodes;
vtkm::Id maxNodeID = 0;

@ -152,7 +152,6 @@ MakeTestDataSet::Make3DExplicitDataSet0()
vtkm::cont::CellSetExplicit<> cellSet(nVerts, "cells", 2);
cellSet.FillViaCopy(shapes, numindices, conn);
cellSet.CreateCellToPointConnectivity();
dataSet.AddCellSet(cellSet);
@ -192,8 +191,6 @@ MakeTestDataSet::Make3DExplicitDataSet1()
cellSet.AddCell(vtkm::CELL_SHAPE_QUAD, 4, make_Vec<vtkm::Id>(2,1,3,4));
cellSet.CompleteAddingCells();
cellSet.CreateCellToPointConnectivity();
dataSet.AddCellSet(cellSet);
return dataSet;
@ -266,8 +263,6 @@ MakeTestDataSet::Make3DExplicitDataSetCowNose(double *pBounds)
}
cellSet.CompleteAddingCells();
cellSet.CreateCellToPointConnectivity();
dataSet.AddCellSet(cellSet);
// copy bounds