Commit 572be798 authored by mattijs's avatar mattijs
Browse files

ENH: snappyHexMesh : correct mesh instance

parent 4da55e85
......@@ -159,11 +159,6 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
faceCombiner.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0));
......@@ -324,11 +319,6 @@ Foam::label Foam::autoLayerDriver::mergePatchFacesUndo
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
faceCombiner.updateMesh(map);
// Renumber restore maps
......@@ -396,11 +386,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoLayerDriver::doRemovePoints
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
pointRemover.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0));
......@@ -454,11 +439,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::autoLayerDriver::doRestorePoints
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
pointRemover.updateMesh(map);
meshRefiner_.updateMesh(map, labelList(0));
......@@ -3100,10 +3080,7 @@ void Foam::autoLayerDriver::addLayers
//?neccesary? Update fields
newMesh.updateMesh(map);
if (meshRefiner_.overwrite())
{
newMesh.setInstance(meshRefiner_.oldInstance());
}
newMesh.setInstance(meshRefiner_.timeName());
// Update numbering on addLayer:
// - cell/point labels to be newMesh.
......@@ -3229,11 +3206,6 @@ void Foam::autoLayerDriver::addLayers
mesh.clearOut();
}
if (meshRefiner_.overwrite())
{
mesh.setInstance(meshRefiner_.oldInstance());
}
meshRefiner_.updateMesh(map, labelList(0));
......
......@@ -481,11 +481,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::doRemoveCells
mesh_.clearOut();
}
if (overwrite_)
{
mesh_.setInstance(oldInstance_);
}
// Update local mesh data
cellRemover.updateMesh(map);
......@@ -1903,9 +1898,14 @@ void Foam::meshRefinement::distribute(const mapDistributePolyMesh& map)
pointMap.clear();
}
}
// If necessary reset the instance
mesh_.setInstance(timeName());
setInstance(mesh_.facesInstance());
}
// Update local data for a mesh change
void Foam::meshRefinement::updateMesh
(
const mapPolyMesh& map,
......@@ -2027,6 +2027,10 @@ void Foam::meshRefinement::updateMesh
data.transfer(newFaceData);
}
}
// If necessary reset the instance
mesh_.setInstance(timeName());
setInstance(mesh_.facesInstance());
}
......@@ -2137,7 +2141,7 @@ void Foam::meshRefinement::dumpRefinementLevel() const
IOobject
(
"cellLevel",
timeName(),
mesh_.time().timeName(),// Dump to current time, not to mesh inst
mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE,
......@@ -2165,7 +2169,7 @@ void Foam::meshRefinement::dumpRefinementLevel() const
IOobject
(
"pointLevel",
timeName(),
mesh_.time().timeName(),// Dump to current time, not to mesh inst
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
......
......@@ -517,11 +517,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createBaffles
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
//- Redo the intersections on the newly create baffle faces. Note that
// this changes also the cell centre positions.
faceSet baffledFacesSet(mesh_, "baffledFacesSet", 2*nBaffles);
......@@ -965,11 +960,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeBaffles
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Update intersections. Recalculate intersections on merged faces since
// this seems to give problems? Note: should not be nessecary since
// baffles preserve intersections from when they were created.
......@@ -2249,11 +2239,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Update intersections. Is mapping only (no faces created, positions stay
// same) so no need to recalculate intersections.
updateMesh(map, labelList(0));
......@@ -2783,11 +2768,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Print some stats (note: zones are synchronised)
if (mesh_.cellZones().size() > 0)
{
......
......@@ -103,11 +103,6 @@ Foam::label Foam::meshRefinement::mergePatchFaces
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
faceCombiner.updateMesh(map);
// Get the kept faces that need to be recalculated.
......@@ -203,11 +198,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::mergeEdges
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
pointRemover.updateMesh(map);
// Get the kept faces that need to be recalculated.
......
......@@ -1236,11 +1236,6 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::refine
mesh_.clearOut();
}
if (overwrite())
{
mesh_.setInstance(oldInstance());
}
// Update intersection info
updateMesh(map, getChangedFaces(map, cellsToRefine));
......
Supports Markdown
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