ENH: snappyHexMesh: remove any left-over mesh data before topo change

This commit is contained in:
mattijs
2022-03-09 11:30:46 +00:00
committed by Andrew Heather
parent 6a8ddbb296
commit 3a8a7cc6d4
4 changed files with 72 additions and 0 deletions

View File

@ -1135,6 +1135,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemoveCells
meshMod
);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -1327,6 +1331,10 @@ Foam::label Foam::meshRefinement::splitFacesUndo
// Insert the mesh changes
doSplitFaces(splitFaces, splits, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -1339,6 +1347,10 @@ Foam::label Foam::meshRefinement::splitFacesUndo
{
mesh_.movePoints(map.preMotionPoints());
}
else
{
mesh_.clearOut();
}
// Reset the instance for if in overwrite mode
mesh_.setInstance(timeName());
@ -1550,6 +1562,10 @@ Foam::label Foam::meshRefinement::splitFacesUndo
nSplit -= n;
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -1562,6 +1578,10 @@ Foam::label Foam::meshRefinement::splitFacesUndo
{
mesh_.movePoints(map.preMotionPoints());
}
else
{
mesh_.clearOut();
}
// Reset the instance for if in overwrite mode
mesh_.setInstance(timeName());

View File

@ -600,6 +600,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
autoPtr<mapPolyMesh> mapPtr;
if (returnReduce(nBaffles, sumOp<label>()))
{
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation, parallel sync)
mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -1314,6 +1318,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
}
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -5346,6 +5354,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints
// Insert changes into meshMod
pointDuplicator.setRefinement(regionSide, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation, parallel sync)
mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -5421,6 +5433,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergePoints
// Insert changes
polyMeshAdder::mergePoints(mesh_, pointToMaster, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation, parallel sync)
mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -5988,6 +6004,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
meshMod
);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation, parallel sync)
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);

View File

@ -108,6 +108,10 @@ Foam::label Foam::meshRefinement::mergePatchFaces
// unused points.
faceCombiner.setRefinement(mergeSets, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -197,6 +201,10 @@ Foam::label Foam::meshRefinement::mergePatchFaces
//
// pointRemover.setRefinement(pointCanBeDeleted, meshMod);
//
// // Remove any unnecessary fields
// mesh_.clearOut();
// mesh_.moving(false);
//
// // Change the mesh (no inflation)
// map = meshMod.changeMesh(mesh_, false, true);
//
@ -359,6 +367,10 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
labelList(0) // cells to store
);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
@ -544,6 +556,10 @@ Foam::label Foam::meshRefinement::mergePatchFacesUndo
restoredCells
);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> map = meshMod.changeMesh(mesh_, false, true);
@ -629,6 +645,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemovePoints
pointRemover.setRefinement(pointCanBeDeleted, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;
@ -702,6 +722,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRestorePoints
meshMod
);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Change the mesh (no inflation)
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false, true);
mapPolyMesh& map = *mapPtr;

View File

@ -2352,6 +2352,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::refine
// Play refinement commands into mesh changer.
meshCutter_.setRefinement(cellsToRefine, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
// Create mesh (no inflation), return map from old to new mesh.
autoPtr<mapPolyMesh> mapPtr = meshMod.changeMesh(mesh_, false);
mapPolyMesh& map = *mapPtr;
@ -2774,6 +2778,10 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::directionalRefine
// Insert mesh refinement into polyTopoChange.
meshRefiner.setRefinement(cuts, meshMod);
// Remove any unnecessary fields
mesh_.clearOut();
mesh_.moving(false);
autoPtr<mapPolyMesh> morphMap = meshMod.changeMesh(mesh_, false);
// Update fields