mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
Add a release resources API to CellSet and its derived classes
This commit is contained in:
parent
3126037306
commit
86f22bf47f
@ -70,6 +70,8 @@ public:
|
|||||||
|
|
||||||
virtual void PrintSummary(std::ostream&) const = 0;
|
virtual void PrintSummary(std::ostream&) const = 0;
|
||||||
|
|
||||||
|
virtual void ReleaseResourcesExecution() = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string Name;
|
std::string Name;
|
||||||
};
|
};
|
||||||
|
@ -111,6 +111,7 @@ public:
|
|||||||
vtkm::Id GetNumberOfFaces() const override;
|
vtkm::Id GetNumberOfFaces() const override;
|
||||||
vtkm::Id GetNumberOfEdges() const override;
|
vtkm::Id GetNumberOfEdges() const override;
|
||||||
void PrintSummary(std::ostream& out) const override;
|
void PrintSummary(std::ostream& out) const override;
|
||||||
|
void ReleaseResourcesExecution() override;
|
||||||
|
|
||||||
VTKM_CONT vtkm::Id GetSchedulingRange(vtkm::TopologyElementTagCell) const;
|
VTKM_CONT vtkm::Id GetSchedulingRange(vtkm::TopologyElementTagCell) const;
|
||||||
VTKM_CONT vtkm::Id GetSchedulingRange(vtkm::TopologyElementTagPoint) const;
|
VTKM_CONT vtkm::Id GetSchedulingRange(vtkm::TopologyElementTagPoint) const;
|
||||||
|
@ -101,6 +101,19 @@ void CellSetExplicit<ShapeStorageTag,
|
|||||||
this->CellToPoint.PrintSummary(out);
|
this->CellToPoint.PrintSummary(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename ShapeStorageTag,
|
||||||
|
typename NumIndicesStorageTag,
|
||||||
|
typename ConnectivityStorageTag,
|
||||||
|
typename OffsetStorageTag>
|
||||||
|
void CellSetExplicit<ShapeStorageTag,
|
||||||
|
NumIndicesStorageTag,
|
||||||
|
ConnectivityStorageTag,
|
||||||
|
OffsetStorageTag>::ReleaseResourcesExecution()
|
||||||
|
{
|
||||||
|
this->PointToCell.ReleaseResourcesExecution();
|
||||||
|
this->CellToPoint.ReleaseResourcesExecution();
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
template <typename ShapeStorageTag,
|
template <typename ShapeStorageTag,
|
||||||
|
@ -205,6 +205,15 @@ public:
|
|||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
vtkm::Id GetNumberOfEdges() const override { return -1; }
|
vtkm::Id GetNumberOfEdges() const override { return -1; }
|
||||||
|
|
||||||
|
VTKM_CONT
|
||||||
|
void ReleaseResourcesExecution() override
|
||||||
|
{
|
||||||
|
this->ValidCellIds.ReleaseResourcesExecution();
|
||||||
|
this->FullCellSet.ReleaseResourcesExecution();
|
||||||
|
this->CellToPoint.ReleaseResourcesExecution();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VTKM_CONT
|
VTKM_CONT
|
||||||
vtkm::IdComponent GetNumberOfPointsInCell(vtkm::Id cellIndex) const
|
vtkm::IdComponent GetNumberOfPointsInCell(vtkm::Id cellIndex) const
|
||||||
{
|
{
|
||||||
|
@ -63,6 +63,9 @@ public:
|
|||||||
|
|
||||||
virtual vtkm::Id GetNumberOfEdges() const { return -1; }
|
virtual vtkm::Id GetNumberOfEdges() const { return -1; }
|
||||||
|
|
||||||
|
// Since the entire topology is defined by by three integers, nothing to do here.
|
||||||
|
virtual void ReleaseResourcesExecution() override {}
|
||||||
|
|
||||||
void SetPointDimensions(SchedulingRangeType dimensions)
|
void SetPointDimensions(SchedulingRangeType dimensions)
|
||||||
{
|
{
|
||||||
this->Structure.SetPointDimensions(dimensions);
|
this->Structure.SetPointDimensions(dimensions);
|
||||||
|
@ -153,6 +153,12 @@ void TestCellSetExplicit()
|
|||||||
{
|
{
|
||||||
VTKM_TEST_ASSERT(result.GetPortalConstControl().Get(i) == expected2[i], "incorrect result");
|
VTKM_TEST_ASSERT(result.GetPortalConstControl().Get(i) == expected2[i], "incorrect result");
|
||||||
}
|
}
|
||||||
|
std::cout << "Testing resource releasing in CellSetExplicit:\n";
|
||||||
|
cellset.ReleaseResourcesExecution();
|
||||||
|
VTKM_TEST_ASSERT(cellset.GetNumberOfCells() == ArrayLength(g_numIndices) / 2,
|
||||||
|
"release execution resources should not change the number of cells");
|
||||||
|
VTKM_TEST_ASSERT(cellset.GetNumberOfPoints() == ArrayLength(expected2),
|
||||||
|
"release execution resources should not change the number of points");
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@ -151,6 +151,12 @@ vtkm::cont::CellSetPermutation<CellSetType, vtkm::cont::ArrayHandleCounting<vtkm
|
|||||||
VTKM_TEST_ASSERT(result.GetPortalConstControl().Get(i) == expected[static_cast<std::size_t>(i)],
|
VTKM_TEST_ASSERT(result.GetPortalConstControl().Get(i) == expected[static_cast<std::size_t>(i)],
|
||||||
"incorrect result");
|
"incorrect result");
|
||||||
}
|
}
|
||||||
|
std::cout << "Testing resource releasing in CellSetPermutation:\n";
|
||||||
|
cs.ReleaseResourcesExecution();
|
||||||
|
VTKM_TEST_ASSERT(cs.GetNumberOfCells() == cellset.GetNumberOfCells() / 2,
|
||||||
|
"release execution resources should not change the number of cells");
|
||||||
|
VTKM_TEST_ASSERT(cs.GetNumberOfPoints() == cellset.GetNumberOfPoints(),
|
||||||
|
"release execution resources should not change the number of points");
|
||||||
|
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user