Switching on/off polyhedral refinement engine

This commit is contained in:
Vuko Vukcevic 2018-01-12 15:59:06 +01:00
parent fe2911f9e3
commit 6e33ee25f0

View file

@ -134,7 +134,8 @@ bool dynamicPolyRefinementFvMesh::update()
polyhedralRefinement& polyRefModifier = polyhedralRefinement& polyRefModifier =
refCast<polyhedralRefinement>(topoChanger_[0]); refCast<polyhedralRefinement>(topoChanger_[0]);
// Get refinement candidates from refinement selection algorithm // Get refinement candidates from refinement selection algorithm. Note:
// return type is Xfer<labelList> so there's no copying
const labelList refCandidates const labelList refCandidates
( (
refinementSelectionPtr_->refinementCellCandidates() refinementSelectionPtr_->refinementCellCandidates()
@ -144,7 +145,8 @@ bool dynamicPolyRefinementFvMesh::update()
// point consistent refinement is performed // point consistent refinement is performed
polyRefModifier.setCellsToRefine(refCandidates); polyRefModifier.setCellsToRefine(refCandidates);
// Get unrefinement point candidates from refinement selection algorithm // Get unrefinement point candidates from refinement selection
// algorithm. Note: return type is Xfer<labelList> so there's no copying
const labelList unrefCandidates const labelList unrefCandidates
( (
refinementSelectionPtr_->unrefinementPointCandidates() refinementSelectionPtr_->unrefinementPointCandidates()
@ -155,6 +157,17 @@ bool dynamicPolyRefinementFvMesh::update()
// unrefinement // unrefinement
polyRefModifier.setSplitPointsToUnrefine(unrefCandidates); polyRefModifier.setSplitPointsToUnrefine(unrefCandidates);
// Activate the polyhedral refinement engine if there are some cells to
// refine or there are some split points to unrefine around
if (!refCandidates.empty() || !unrefCandidates.empty())
{
polyRefModifier.enable();
}
else
{
polyRefModifier.disable();
}
// Perform refinement and unrefinement in one go // Perform refinement and unrefinement in one go
autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(); autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh();