ENH: extrudeMesh: preserve hexRef8Data. Fixes #471.

This commit is contained in:
mattijs
2017-09-06 12:24:32 +01:00
parent 2f2e0cf1a6
commit dbc0bbc903
3 changed files with 128 additions and 3 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -57,6 +57,7 @@ Description
#include "planeExtrusion.H"
#include "emptyPolyPatch.H"
#include "processorMeshes.H"
#include "hexRef8Data.H"
using namespace Foam;
@ -338,6 +339,9 @@ int main(int argc, char *argv[])
// Optional added cells (get written to cellSet)
labelHashSet addedCellsSet;
// Optional refinement data
autoPtr<hexRef8Data> refDataPtr;
if (mode == PATCH || mode == MESH)
{
if (flipNormals && mode == MESH)
@ -640,6 +644,32 @@ int main(int argc, char *argv[])
// Expansion ratio not used.
scalarField ratio(extrudePatch.nPoints(), 1.0);
// Load any refinement data
if (mode == MESH)
{
// Tricky: register hexRef8 onto the database
// since the mesh does not yet exist. It should not be registered
// onto the input mesh.
refDataPtr.reset
(
new hexRef8Data
(
IOobject
(
"dummy",
mesh.facesInstance(),
polyMesh::meshSubDir,
runTimeExtruded, //mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE,
false
)
)
);
}
// Topo change container. Either copy an existing mesh or start
// with empty storage (number of patches only needed for checking)
autoPtr<polyTopoChange> meshMod
@ -746,6 +776,12 @@ int main(int argc, char *argv[])
backPatchFaces
);
// Update
if (refDataPtr.valid())
{
refDataPtr().updateMesh(map());
}
// Store added cells
if (mode == MESH)
{
@ -909,6 +945,11 @@ int main(int argc, char *argv[])
updateFaceLabels(map(), backPatchFaces);
updateCellSet(map(), addedCellsSet);
if (refDataPtr.valid())
{
refDataPtr().updateMesh(map());
}
// Move mesh (if inflation used)
if (map().hasMotionPoints())
{
@ -1039,6 +1080,11 @@ int main(int argc, char *argv[])
// Update local data
updateCellSet(map(), addedCellsSet);
if (refDataPtr.valid())
{
refDataPtr().updateMesh(map());
}
// Move mesh (if inflation used)
if (map().hasMotionPoints())
{
@ -1072,6 +1118,12 @@ int main(int argc, char *argv[])
}
}
if (refDataPtr.valid())
{
refDataPtr().write();
}
Info<< "End\n" << endl;
return 0;