Universal code base cfMesh clean-up

This commit is contained in:
Hrvoje Jasak 2015-08-06 18:57:00 +01:00 committed by Dominik Christ
parent dc73aad201
commit a5e7b980ad
66 changed files with 72 additions and 10973 deletions

View file

@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "triSurfModifier.H" #include "triSurfModifier.H"
#include "triFaceList.H" #include "triFaceList.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-lmeshLibrary \
-lmeshTools \ -lmeshTools \
-ledgeMesh -ledgeMesh

View file

@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "triSurfaceCopyParts.H" #include "triSurfaceCopyParts.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \ -I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(FOAM_SRC)/edgeMesh/lnInclude -I$(FOAM_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-lmeshTools \ -lmeshTools \
-ledgeMesh \ -ledgeMesh
-lmeshLibrary

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \ -I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(FOAM_SRC)/edgeMesh/lnInclude -I$(FOAM_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \
@ -7,7 +6,6 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-ltriSurface \
-lfiniteVolume \ -lfiniteVolume \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary -lcfMesh

View file

@ -30,7 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "cartesian2DMeshGenerator.H" #include "cartesian2DMeshGenerator.H"
using namespace Foam; using namespace Foam;

View file

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \
@ -7,7 +6,6 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-ltriSurface \
-lfiniteVolume \ -lfiniteVolume \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary -lcfMesh

View file

@ -31,7 +31,7 @@ Description
#include "argList.H" #include "argList.H"
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "cartesianMeshGenerator.H" #include "cartesianMeshGenerator.H"
using namespace Foam; using namespace Foam;

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-lmeshLibrary \
-lmeshTools \ -lmeshTools \
-ledgeMesh -ledgeMesh

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-lmeshLibrary \
-lmeshTools \ -lmeshTools \
-ledgeMesh -ledgeMesh

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-lmeshLibrary \
-lmeshTools \ -lmeshTools \
-ledgeMesh -ledgeMesh

View file

@ -28,7 +28,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "triSurfaceExtrude2DEdges.H" #include "triSurfaceExtrude2DEdges.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lcfMesh \
-lmeshTools \ -lmeshTools \
-ltriSurface \ -ledgeMesh
-ledgeMesh \
-lmeshLibrary

View file

@ -28,7 +28,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "meshOptimizer.H" #include "meshOptimizer.H"
#include "boundaryLayers.H" #include "boundaryLayers.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-ltriSurface \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary -lcfMesh

View file

@ -28,7 +28,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "meshOptimizer.H" #include "meshOptimizer.H"

View file

@ -6,4 +6,4 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary -lcfMesh

View file

@ -28,7 +28,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "symmetryPlaneOptimisation.H" #include "symmetryPlaneOptimisation.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \ -I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(FOAM_SRC)/edgeMesh/lnInclude -I$(FOAM_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -32,7 +32,7 @@ Author
#include "argList.H" #include "argList.H"
#include "autoPtr.H" #include "autoPtr.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "triSurfModifier.H" #include "triSurfModifier.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"

View file

@ -4,6 +4,6 @@ EXE_INC = \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lmeshLibrary \ -lcfMesh \
-ledgeMesh \ -ledgeMesh \
-lmeshTools -lmeshTools

View file

@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "writeMeshFPMA.H" #include "writeMeshFPMA.H"

4
applications/utilities/mesh/cfMesh/pMesh/Make/options Executable file → Normal file
View file

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \
@ -7,7 +6,6 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-ltriSurface \
-lfiniteVolume \ -lfiniteVolume \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary -lcfMesh

View file

@ -30,7 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "voronoiMeshGenerator.H" #include "voronoiMeshGenerator.H"
using namespace Foam; using namespace Foam;

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "triFaceList.H" #include "triFaceList.H"
#include "labelLongList.H" #include "labelLongList.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \ -I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(FOAM_SRC)/edgeMesh/lnInclude -I$(FOAM_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-lmeshTools \ -lmeshTools \
-ledgeMesh \ -ledgeMesh
-lmeshLibrary

View file

@ -30,7 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include <sstream> #include <sstream>

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -28,7 +28,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "triSurfaceRemoveFacets.H" #include "triSurfaceRemoveFacets.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary \ -lcfMesh \
-lmeshTools -lmeshTools

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(FOAM_SRC)/meshTools/lnInclude \ -I$(FOAM_SRC)/meshTools/lnInclude \
-I$(FOAM_SRC)/triSurface/lnInclude \
-I$(FOAM_SRC)/edgeMesh/lnInclude -I$(FOAM_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -27,7 +27,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "triSurf.H" #include "triSurf.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary \ -lcfMesh \
-lmeshTools -lmeshTools

View file

@ -1,11 +1,9 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/mesh/cfMesh/lnInclude \ -I$(LIB_SRC)/mesh/cfMesh/lnInclude \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude -I$(LIB_SRC)/edgeMesh/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ltriSurface \ -lcfMesh \
-ledgeMesh \ -lmeshTools \
-lmeshLibrary \ -ledgeMesh
-lmeshTools

View file

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/edgeMesh/lnInclude \ -I$(LIB_SRC)/edgeMesh/lnInclude \
@ -7,7 +6,6 @@ EXE_INC = \
EXE_LIBS = \ EXE_LIBS = \
-lmeshTools \ -lmeshTools \
-ltriSurface \
-lfiniteVolume \ -lfiniteVolume \
-ledgeMesh \ -ledgeMesh \
-lmeshLibrary -lcfMesh

View file

@ -30,7 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "argList.H" #include "argList.H"
#include "Time.H" #include "foamTime.H"
#include "tetMeshGenerator.H" #include "tetMeshGenerator.H"
using namespace Foam; using namespace Foam;

View file

@ -468,4 +468,4 @@ $(writeAsFPMA)/fpmaMesh.C
$(workflowControls)/workflowControls.C $(workflowControls)/workflowControls.C
LIB = $(FOAM_LIBBIN)/libmeshLibrary LIB = $(FOAM_LIBBIN)/libcfMesh

View file

@ -10,7 +10,9 @@
EXE_INC = \ EXE_INC = \
$(OMP_FLAGS) \ $(OMP_FLAGS) \
-I$(LIB_SRC)/edgeMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-ledgeMesh \
-lmeshTools -lmeshTools

View file

@ -39,7 +39,7 @@ SourceFiles
#include "word.H" #include "word.H"
#include "point.H" #include "point.H"
#include "coordinateModificationList.H" #include "coordinateModificationList.H"
#include "Time.H" #include "foamTime.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,838 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "boundaryLayers.H"
#include "meshSurfaceEngine.H"
#include "helperFunctions.H"
#include "helperFunctionsPar.H"
#include "demandDrivenData.H"
#include "VRWGraphList.H"
#include "labelledPair.H"
#include "HashSet.H"
#include <map>
//#define DEBUGLayer
# ifdef DEBUGLayer
#include "polyMeshGenAddressing.H"
# endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::createLayerCells(const labelList& patchLabels)
{
Info << "Starting creating layer cells" << endl;
const meshSurfaceEngine& mse = surfaceEngine();
const faceList::subList& bFaces = mse.boundaryFaces();
const edgeList& edges = mse.edges();
const VRWGraph& faceEdges = mse.faceEdges();
const VRWGraph& edgeFaces = mse.edgeFaces();
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
const labelList& faceOwners = mse.faceOwners();
const labelList& bp = mse.bp();
const VRWGraph& pointFaces = mse.pointFaces();
const meshSurfacePartitioner& mPart = surfacePartitioner();
const VRWGraph& pointPatches = mPart.pointPatches();
//- mark patches which will be extruded into layer cells
boolList treatPatches(mesh_.boundaries().size(), false);
forAll(patchLabels, patchI)
{
const label pLabel = patchLabels[patchI];
forAll(treatPatchesWithPatch_[pLabel], i)
treatPatches[treatPatchesWithPatch_[pLabel][i]] = true;
}
//- create new faces at parallel boundaries
const Map<label>* otherProcPatchPtr(NULL);
const Map<label>* otherFaceProcPtr(NULL);
if( Pstream::parRun() )
{
createNewFacesParallel(treatPatches);
otherProcPatchPtr = &mse.otherEdgeFacePatch();
otherFaceProcPtr = &mse.otherEdgeFaceAtProc();
}
//- create lists for new boundary faces
VRWGraph newBoundaryFaces;
labelLongList newBoundaryOwners;
labelLongList newBoundaryPatches;
//- create storage for new cells
VRWGraphList cellsToAdd;
//- create layer cells and store boundary faces
const label nOldCells = mesh_.cells().size();
forAll(bFaces, bfI)
{
if( treatPatches[boundaryFacePatches[bfI]] )
{
const face& f = bFaces[bfI];
const label pKey = patchKey_[boundaryFacePatches[bfI]];
DynList<DynList<label> > cellFaces;
DynList<label> newF;
//- store the current boundary face
newF.clear();
newF.append(f[0]);
for(label pI=f.size()-1;pI>0;--pI)
newF.append(f[pI]);
cellFaces.append(newF);
//- create parallel face
forAll(f, pI)
newF[pI] = findNewNodeLabel(f[pI], pKey);
cellFaces.append(newF);
newBoundaryFaces.appendList(newF);
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
newBoundaryPatches.append(boundaryFacePatches[bfI]);
//- create quad faces
newF.setSize(4);
forAll(f, pI)
{
newF[0] = f[pI];
newF[1] = f.nextLabel(pI);
newF[2] = findNewNodeLabel(newF[1], pKey);
newF[3] = findNewNodeLabel(f[pI], pKey);
cellFaces.append(newF);
//- check if the face is at the boundary
//- of the treated partitions
const label edgeI = faceEdges(bfI, pI);
if( edgeFaces.sizeOfRow(edgeI) == 2 )
{
label neiFace = edgeFaces(edgeI, 0);
if( neiFace == bfI )
neiFace = edgeFaces(edgeI, 1);
if( !treatPatches[boundaryFacePatches[neiFace]] )
{
newBoundaryFaces.appendList(newF);
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
newBoundaryPatches.append(boundaryFacePatches[neiFace]);
}
}
else if( edgeFaces.sizeOfRow(edgeI) == 1 )
{
const Map<label>& otherProcPatch = *otherProcPatchPtr;
if( !treatPatches[otherProcPatch[edgeI]] )
{
//- face is a new boundary face
newBoundaryFaces.appendList(newF);
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
newBoundaryPatches.append(otherProcPatch[edgeI]);
}
}
}
# ifdef DEBUGLayer
Info << "Adding cell " << cellFaces << endl;
# endif
cellsToAdd.appendGraph(cellFaces);
}
else
{
# ifdef DEBUGLayer
Info << "Storing original boundary face "
<< bfI << " into patch " << boundaryFacePatches[bfI] << endl;
# endif
newBoundaryFaces.appendList(bFaces[bfI]);
newBoundaryOwners.append(faceOwners[bfI]);
newBoundaryPatches.append(boundaryFacePatches[bfI]);
}
}
//- data for parallel execution
boolList procPoint;
LongList<DynList<label, 4> > pointProcFaces;
LongList<labelPair> faceAtPatches;
if( Pstream::parRun() )
{
procPoint.setSize(nPoints_);
procPoint = false;
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
const labelList& bPoints = mse.boundaryPoints();
for
(
Map<label>::const_iterator iter=globalToLocal.begin();
iter!=globalToLocal.end();
++iter
)
{
const label bpI = iter();
procPoint[bPoints[bpI]] = true;
}
}
//- create cells at edges
forAll(edgeFaces, edgeI)
{
//- do not consider edges with no faces attached to it
if( edgeFaces.sizeOfRow(edgeI) == 0 )
continue;
//- cells are generated at the processor with the lowest label
if(
(edgeFaces.sizeOfRow(edgeI) == 1) &&
(otherFaceProcPtr->operator[](edgeI) < Pstream::myProcNo())
)
continue;
//- check if the edge is a feature edge
const label patchI = boundaryFacePatches[edgeFaces(edgeI, 0)];
label patchJ;
if( otherProcPatchPtr && otherProcPatchPtr->found(edgeI) )
{
patchJ = otherProcPatchPtr->operator[](edgeI);
}
else
{
patchJ = boundaryFacePatches[edgeFaces(edgeI, 1)];
}
if( patchI == patchJ )
continue;
//- check if the faces attached to the edge have different keys
const label pKeyI = patchKey_[patchI];
const label pKeyJ = patchKey_[patchJ];
if( pKeyI < 0 || pKeyJ < 0 )
{
continue;
FatalErrorIn
(
"void boundaryLayers::createLayerCells(const labelList&)"
) << "Patch key is negative at concave edge" << abort(FatalError);
}
if( pKeyI == pKeyJ )
continue;
const edge& e = edges[edgeI];
if( otherVrts_.find(e.start()) == otherVrts_.end() )
continue;
if( otherVrts_.find(e.end()) == otherVrts_.end() )
continue;
//- generate faces of the bnd layer cell
FixedList<FixedList<label, 4>, 6> cellFaces;
createNewCellFromEdge(e, pKeyI, pKeyJ, cellFaces);
//- store boundary faces
newBoundaryFaces.appendList(cellFaces[1]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(patchJ);
newBoundaryFaces.appendList(cellFaces[3]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(patchI);
//- check if face 5 is a boundary face or at an inter-processor boundary
const label bps = bp[e.start()];
label unusedPatch(-1);
forAllRow(pointPatches, bps, i)
{
const label ptchI = pointPatches(bps, i);
if( ptchI == patchI )
continue;
if( ptchI == patchJ )
continue;
if( unusedPatch != -1 )
{
unusedPatch = -1;
break;
}
unusedPatch = ptchI;
}
if( unusedPatch != -1 && treatedPatch_[unusedPatch] )
{
//- add a face in the empty patch in case of 2D layer generation
newBoundaryFaces.appendList(cellFaces[5]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(unusedPatch);
}
else if( Pstream::parRun() && procPoint[e.start()] )
{
//- add a face at inter-pocessor boundary
pointProcFaces.append(cellFaces[5]);
faceAtPatches.append(labelPair(patchI, patchJ));
}
//- check if face 4 is a boundary face or at an inter-processor boundary
const label bpe = bp[e.end()];
unusedPatch = -1;
forAllRow(pointPatches, bpe, i)
{
const label ptchI = pointPatches(bpe, i);
if( ptchI == patchI )
continue;
if( ptchI == patchJ )
continue;
if( unusedPatch != -1 )
{
unusedPatch = -1;
break;
}
unusedPatch = ptchI;
}
if( unusedPatch != -1 && treatedPatch_[unusedPatch] )
{
//- add a face in the empty patch in case of 2D layer generation
newBoundaryFaces.appendList(cellFaces[4]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(unusedPatch);
}
else if( Pstream::parRun() && procPoint[e.end()] )
{
//- add a face at inter-pocessor boundary
pointProcFaces.append(cellFaces[4]);
faceAtPatches.append(labelPair(patchI, patchJ));
}
# ifdef DEBUGLayer
Info << "Adding new cell at edge " << cellFaces << endl;
# endif
//- append cell to the queue
cellsToAdd.appendGraph(cellFaces);
}
//- create cells for corner nodes
typedef std::map<std::pair<label, label>, label> mPairToLabelType;
typedef std::map<label, mPairToLabelType> mPointsType;
typedef std::map<label, DynList<label, 3> > ppType;
ppType nodePatches;
labelHashSet parPoint;
if( Pstream::parRun() )
{
const labelList& bPoints = mse.boundaryPoints();
const VRWGraph& pProcs = mse.bpAtProcs();
const labelList& globalPointLabel = mse.globalBoundaryPointLabel();
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
std::map<label, labelLongList> facesToSend;
typedef std::map<label, DynList<DynList<label, 8>, 8> > ppfType;
ppfType parPointFaces;
ppType parPointPatches;
forAllConstIter(mPointsType, otherVrts_, iter)
{
//- skip points on feature edges
if( iter->second.size() == 2 )
continue;
const label bpI = bp[iter->first];
if( pProcs.sizeOfRow(bpI) != 0 )
{
parPoint.insert(iter->first);
//- point is at a parallel boundary
label pMin = pProcs(bpI, 0);
forAllRow(pProcs, bpI, i)
{
const label prI = pProcs(bpI, i);
if( facesToSend.find(prI) == facesToSend.end() )
facesToSend.insert
(
std::make_pair(prI, labelLongList())
);
if( prI < pMin )
pMin = prI;
}
if( Pstream::myProcNo() == pMin )
{
DynList<label, 3>& pPatches = parPointPatches[bpI];
pPatches.setSize(pointFaces.sizeOfRow(bpI));
DynList<DynList<label, 8>, 8>& pFaces = parPointFaces[bpI];
pFaces.setSize(pPatches.size());
forAllRow(pointFaces, bpI, pfI)
{
const label bfI = pointFaces(bpI, pfI);
const face& bf = bFaces[bfI];
pPatches[pfI] = boundaryFacePatches[bfI];
DynList<label, 8>& bfCopy = pFaces[pfI];
bfCopy.setSize(bf.size());
forAll(bf, pI)
bfCopy[pI] = globalPointLabel[bp[bf[pI]]];
}
continue;
}
labelLongList& stp = facesToSend[pMin];
//- send the data to the processor with the lowest label
//- data is flatenned as follows
//- 1. the number of faces and global point label
//- 2. number of points in the face
//- 3. patch label
//- 4. global labels of face points
stp.append(globalPointLabel[bpI]);
stp.append(pointFaces.sizeOfRow(bpI));
forAllRow(pointFaces, bpI, pfI)
{
const label bfI = pointFaces(bpI, pfI);
const face& bf = bFaces[bfI];
stp.append(bf.size());
stp.append(boundaryFacePatches[bfI]);
forAll(bf, pI)
stp.append(globalPointLabel[bp[bf[pI]]]);
}
}
}
//- exchange data with other processors
labelLongList receivedData;
help::exchangeMap(facesToSend, receivedData);
label counter(0);
while( counter < receivedData.size() )
{
const label bpI = globalToLocal[receivedData[counter++]];
const label nFaces = receivedData[counter++];
for(label fI=0;fI<nFaces;++fI)
{
DynList<label, 8> f(receivedData[counter++]);
parPointPatches[bpI].append(receivedData[counter++]);
forAll(f, pI)
f[pI] = receivedData[counter++];
parPointFaces[bpI].append(f);
}
}
//- sort faces sharing corners at the parallel boundaries
forAllIter(ppfType, parPointFaces, iter)
{
DynList<DynList<label, 8>, 8>& pFaces = iter->second;
DynList<label, 3>& fPatches = parPointPatches[iter->first];
const label gpI = globalPointLabel[iter->first];
for(label i=0;i<pFaces.size();++i)
{
const DynList<label, 8>& bf = pFaces[i];
const label pos = bf.containsAtPosition(gpI);
const edge e(bf[pos], bf[bf.fcIndex(pos)]);
for(label j=i+1;j<pFaces.size();++j)
{
const DynList<label, 8>& obf = pFaces[j];
if( obf.contains(e.start()) && obf.contains(e.end()) )
{
DynList<label, 8> add;
add = pFaces[i+1];
pFaces[i+1] = pFaces[j];
pFaces[j] = add;
const label pAdd = fPatches[i+1];
fPatches[i+1] = fPatches[j];
fPatches[j] = pAdd;
break;
}
}
}
DynList<label, 3> patchIDs;
forAll(fPatches, fpI)
patchIDs.appendIfNotIn(fPatches[fpI]);
nodePatches.insert(std::make_pair(bPoints[iter->first], patchIDs));
}
}
//- sort out point which are not at inter-processor boundaries
forAllConstIter(mPointsType, otherVrts_, iter)
{
if( iter->second.size() == 2 )
continue;
if( parPoint.found(iter->first) )
continue;
const label bpI = bp[iter->first];
//- ensure correct orientation
DynList<label> pFaces(pointFaces.sizeOfRow(bpI));
forAll(pFaces, fI)
pFaces[fI] = pointFaces(bpI, fI);
for(label i=0;i<pFaces.size();++i)
{
const face& bf = bFaces[pFaces[i]];
const edge e = bf.faceEdge(bf.which(iter->first));
for(label j=i+1;j<pFaces.size();++j)
{
const face& obf = bFaces[pFaces[j]];
if(
(obf.which(e.start()) >= 0) &&
(obf.which(e.end()) >= 0)
)
{
const label add = pFaces[i+1];
pFaces[i+1] = pFaces[j];
pFaces[j] = add;
break;
}
}
}
DynList<label, 3> patchIDs;
forAll(pFaces, patchI)
{
patchIDs.appendIfNotIn(boundaryFacePatches[pFaces[patchI]]);
}
nodePatches.insert(std::make_pair(iter->first, patchIDs));
}
//- create layer cells for corner nodes
forAllIter(ppType, nodePatches, iter)
{
const DynList<label, 3>& patchIDs = iter->second;
DynList<label, 3> pKeys;
forAll(patchIDs, patchI)
{
const label pKey = patchKey_[patchIDs[patchI]];
if( pKey < 0 )
continue;
pKeys.appendIfNotIn(pKey);
}
if( pKeys.size() != 3 )
continue;
# ifdef DEBUGLayer
Pout << "Creating corner cell at point " << iter->first << endl;
# endif
FixedList<FixedList<label, 4>, 6> cellFaces;
createNewCellFromNode(iter->first, pKeys, cellFaces);
//- store boundary faces
newBoundaryFaces.appendList(cellFaces[1]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(patchIDs[0]);
newBoundaryFaces.appendList(cellFaces[3]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(patchIDs[1]);
newBoundaryFaces.appendList(cellFaces[5]);
newBoundaryOwners.append(nOldCells+cellsToAdd.size());
newBoundaryPatches.append(patchIDs[2]);
if( Pstream::parRun() )
{
if( procPoint[iter->first] )
{
pointProcFaces.append(cellFaces[0]);
faceAtPatches.append(labelPair(patchIDs[1], patchIDs[2]));
pointProcFaces.append(cellFaces[2]);
faceAtPatches.append(labelPair(patchIDs[0], patchIDs[2]));
pointProcFaces.append(cellFaces[4]);
faceAtPatches.append(labelPair(patchIDs[0], patchIDs[1]));
}
}
# ifdef DEBUGLayer
Info << "Adding corner cell " << cellFaces << endl;
# endif
//- append cell to the queue
cellsToAdd.appendGraph(cellFaces);
}
if( Pstream::parRun() )
{
//- create faces at parallel boundaries created from
//- points at parallel boundaries
createNewFacesFromPointsParallel
(
pointProcFaces,
faceAtPatches
);
}
//- create mesh modifier
polyMeshGenModifier meshModifier(mesh_);
meshModifier.addCells(cellsToAdd);
cellsToAdd.clear();
meshModifier.reorderBoundaryFaces();
meshModifier.replaceBoundary
(
patchNames_,
newBoundaryFaces,
newBoundaryOwners,
newBoundaryPatches
);
//- delete meshSurfaceEngine
this->clearOut();
Info << "Finished creating layer cells" << endl;
}
void boundaryLayers::createNewFacesFromPointsParallel
(
const LongList<DynList<label, 4> >& faceCandidates,
const LongList<labelPair>& candidatePatches
)
{
const meshSurfaceEngine& mse = this->surfaceEngine();
const labelList& bPoints = mse.boundaryPoints();
const labelList& bp = mse.bp();
const VRWGraph& bpAtProcs = mse.bpAtProcs();
const labelList& globalPointLabel = mse.globalBoundaryPointLabel();
const Map<label>& globalToLocal = mse.globalToLocalBndPointAddressing();
labelList otherFaceProc(faceCandidates.size(), -1);
//- some faces may appear more than once
//- such faces are ordinary internal faces
VRWGraph pointFaceCandidates(nPoints_);
forAll(faceCandidates, fI)
{
forAll(faceCandidates[fI], pI)
pointFaceCandidates.append(faceCandidates[fI][pI], fI);
}
boolList duplicateFace(faceCandidates.size(), false);
List<labelledPair> pointOfOrigin(faceCandidates.size());
std::map<labelledPair, label> pointOfOriginToFaceLabel;
forAll(faceCandidates, fI)
{
const DynList<label, 4>& f = faceCandidates[fI];
const label pointI = f[0];
const labelledPair lp
(
globalPointLabel[bp[pointI]],
Pair<label>
(
patchKey_[candidatePatches[fI][0]],
patchKey_[candidatePatches[fI][1]]
)
);
if(
pointOfOriginToFaceLabel.find(lp) != pointOfOriginToFaceLabel.end()
)
{
duplicateFace[fI] = true;
pointOfOrigin[fI] = lp;
duplicateFace[pointOfOriginToFaceLabel[lp]] = true;
continue;
}
pointOfOrigin[fI] = lp;
pointOfOriginToFaceLabel.insert(std::make_pair(lp, fI));
}
//- find the processor patch for each processor boundary face
//- the key of the algorithm is the point from which the face was created
//- by sending the point label and the associated patches, it will be
//- possible to find the other processor containing that face
std::map<label, LongList<labelledPair> > exchangeData;
const DynList<label>& neiProcs = mse.bpNeiProcs();
forAll(neiProcs, procI)
{
const label neiProcI = neiProcs[procI];
if( neiProcI == Pstream::myProcNo() )
continue;
if( exchangeData.find(neiProcI) == exchangeData.end() )
exchangeData.insert
(
std::make_pair(neiProcI, LongList<labelledPair>())
);
}
forAll(faceCandidates, fI)
{
if( duplicateFace[fI] )
continue;
const label bpI = bp[faceCandidates[fI][0]];
forAllRow(bpAtProcs, bpI, procI)
{
const label neiProcNo = bpAtProcs(bpI, procI);
if( neiProcNo == Pstream::myProcNo() )
continue;
LongList<labelledPair>& dataToSend = exchangeData[neiProcNo];
dataToSend.append(pointOfOrigin[fI]);
}
}
//- exchange the data with other processors
std::map<label, List<labelledPair> > receivedMap;
help::exchangeMap(exchangeData, receivedMap);
exchangeData.clear();
for
(
std::map<label, List<labelledPair> >::const_iterator
iter=receivedMap.begin();
iter!=receivedMap.end();
++iter
)
{
const List<labelledPair>& receivedData = iter->second;
forAll(receivedData, i)
{
const labelledPair& lpp = receivedData[i];
const label gpI = lpp.pairLabel();
const label pointI = bPoints[globalToLocal[gpI]];
const labelPair& lp = lpp.pair();
forAllRow(pointFaceCandidates, pointI, i)
{
const label fI = pointFaceCandidates(pointI, i);
const DynList<label, 4>& f = faceCandidates[fI];
const labelPair pk
(
patchKey_[candidatePatches[fI][0]],
patchKey_[candidatePatches[fI][1]]
);
const labelPair rpk
(
patchKey_[candidatePatches[fI][1]],
patchKey_[candidatePatches[fI][0]]
);
if(
(f[0] == pointI) && ((pk == lp) || (rpk == lp))
)
{
//- found the processor containing other face
otherFaceProc[pointOfOriginToFaceLabel[lpp]] = iter->first;
}
}
}
}
receivedMap.clear();
//- sort the points in ascending order
//- this ensures the correct order of faces at the processor boundaries
sort(pointOfOrigin);
Map<label> otherProcToProcPatch;
forAll(mesh_.procBoundaries(), patchI)
{
const processorBoundaryPatch& wp = mesh_.procBoundaries()[patchI];
otherProcToProcPatch.insert(wp.neiProcNo(), patchI);
}
//- store processor faces
VRWGraph newProcFaces;
labelLongList newProc;
forAll(pointOfOrigin, i)
{
const label fI = pointOfOriginToFaceLabel[pointOfOrigin[i]];
if( duplicateFace[fI] || (otherFaceProc[fI] == -1) )
continue;
if( !otherProcToProcPatch.found(otherFaceProc[fI]) )
{
otherProcToProcPatch.insert
(
otherFaceProc[fI],
polyMeshGenModifier(mesh_).addProcessorPatch
(
otherFaceProc[fI]
)
);
}
newProcFaces.appendList(faceCandidates[fI]);
newProc.append(otherProcToProcPatch[otherFaceProc[fI]]);
}
polyMeshGenModifier(mesh_).addProcessorFaces(newProcFaces, newProc);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,691 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "boundaryLayers.H"
#include "meshSurfaceEngine.H"
#include "demandDrivenData.H"
#include "helperFunctions.H"
#include "helperFunctionsPar.H"
#include "meshSurfaceCheckInvertedVertices.H"
#include "meshSurfacePartitioner.H"
#include "polyMeshGen2DEngine.H"
#include "labelledPoint.H"
#include <map>
#include <set>
# ifdef USE_OMP
#include <omp.h>
# endif
//#define DEBUGLayer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const meshSurfaceEngine& boundaryLayers::surfaceEngine() const
{
if( !msePtr_ )
msePtr_ = new meshSurfaceEngine(mesh_);
return *msePtr_;
}
const meshSurfacePartitioner& boundaryLayers::surfacePartitioner() const
{
if( !meshPartitionerPtr_ )
meshPartitionerPtr_ = new meshSurfacePartitioner(surfaceEngine());
return *meshPartitionerPtr_;
}
void boundaryLayers::findPatchesToBeTreatedTogether()
{
if( geometryAnalysed_ )
return;
forAll(treatPatchesWithPatch_, patchI)
treatPatchesWithPatch_[patchI].append(patchI);
const meshSurfaceEngine& mse = surfaceEngine();
const pointFieldPMG& points = mesh_.points();
const faceList::subList& bFaces = mse.boundaryFaces();
const edgeList& edges = mse.edges();
const VRWGraph& eFaces = mse.edgeFaces();
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
const meshSurfacePartitioner& mPart = surfacePartitioner();
const VRWGraph& pPatches = mPart.pointPatches();
//- patches must be treated together if there exist a corner where
//- more than three patches meet
const labelHashSet& corners = mPart.corners();
forAllConstIter(labelHashSet, corners, it)
{
const label bpI = it.key();
if( mPart.numberOfFeatureEdgesAtPoint(bpI) > 3 )
{
labelHashSet commonPatches;
DynList<label> allPatches;
forAllRow(pPatches, bpI, patchI)
{
const DynList<label>& tpwp =
treatPatchesWithPatch_[pPatches(bpI, patchI)];
forAll(tpwp, pJ)
{
if( commonPatches.found(tpwp[pJ]) )
continue;
commonPatches.insert(tpwp[pJ]);
allPatches.append(tpwp[pJ]);
}
}
forAllRow(pPatches, bpI, patchI)
treatPatchesWithPatch_[pPatches(bpI, patchI)] = allPatches;
# ifdef DEBUGLayer
Info << "Corner " << bpI << " is shared by patches "
<< pPatches[bpI] << endl;
Info << "All patches " << allPatches << endl;
# endif
}
}
//- patches must be treated together for concave geometries
//- edgeClassification map counts the number of convex and concave edges
//- for a given patch. The first counts convex edges and the second counts
//- concave ones. If the number of concave edges is of the considerable
//- percentage, it is treated as O-topology
meshSurfaceCheckInvertedVertices vertexCheck(mse);
const labelHashSet& invertedVertices = vertexCheck.invertedVertices();
std::map<std::pair<label, label>, Pair<label> > edgeClassification;
forAll(eFaces, eI)
{
if( eFaces.sizeOfRow(eI) != 2 )
continue;
//- check if the any of the face vertices is tangled
const edge& e = edges[eI];
if
(
!is2DMesh_ &&
(invertedVertices.found(e[0]) || invertedVertices.found(e[1]))
)
continue;
const label patch0 = boundaryFacePatches[eFaces(eI, 0)];
const label patch1 = boundaryFacePatches[eFaces(eI, 1)];
if( patch0 != patch1 )
{
std::pair<label, label> pp
(
Foam::min(patch0, patch1),
Foam::max(patch0, patch1)
);
if( edgeClassification.find(pp) == edgeClassification.end() )
edgeClassification.insert
(
std::make_pair(pp, Pair<label>(0, 0))
);
const face& f1 = bFaces[eFaces(eI, 0)];
const face& f2 = bFaces[eFaces(eI, 1)];
if
(
!help::isSharedEdgeConvex(points, f1, f2) ||
(help::angleBetweenFaces(points, f1, f2) > 0.75 * M_PI)
)
{
++edgeClassification[pp].second();
}
else
{
++edgeClassification[pp].first();
}
}
}
if( Pstream::parRun() )
{
const labelList& bPoints = mse.boundaryPoints();
//- check faces over processor edges
const labelList& globalEdgeLabel = mse.globalBoundaryEdgeLabel();
const Map<label>& globalToLocal = mse.globalToLocalBndEdgeAddressing();
const DynList<label>& neiProcs = mse.beNeiProcs();
const Map<label>& otherProcPatches = mse.otherEdgeFacePatch();
const Map<label>& otherFaceProc = mse.otherEdgeFaceAtProc();
//- send faces sharing processor edges to other processors
//- faces are flattened into a single contiguous array
const labelList& bp = mse.bp();
const labelList& globalPointLabel = mse.globalBoundaryPointLabel();
const Map<label>& globalPointToLocal =
mse.globalToLocalBndPointAddressing();
std::map<label, LongList<labelledPoint> > exchangePoints;
forAll(neiProcs, procI)
{
exchangePoints.insert
(
std::make_pair(neiProcs[procI], LongList<labelledPoint>())
);
}
//- store faces for sending
forAllConstIter(Map<label>, otherFaceProc, it)
{
const label beI = it.key();
if( eFaces.sizeOfRow(beI) == 0 )
continue;
const edge& e = edges[beI];
if
(
!is2DMesh_ &&
(invertedVertices.found(e[0]) || invertedVertices.found(e[1]))
)
continue;
//- do not send data if the face on other processor
//- is in the same patch
if( otherProcPatches[beI] == boundaryFacePatches[eFaces(beI, 0)] )
continue;
const face& f = bFaces[eFaces(beI, 0)];
const label neiProc = it();
//- each face is sent as follows
//- 1. global edge label
//- 2. number of face nodes
//- 3. faces nodes and vertex coordinates
LongList<labelledPoint>& dps = exchangePoints[neiProc];
dps.append(labelledPoint(globalEdgeLabel[beI], point()));
dps.append(labelledPoint(f.size(), point()));
forAll(f, pI)
{
dps.append
(
labelledPoint
(
globalPointLabel[bp[f[pI]]],
points[f[pI]]
)
);
}
}
LongList<labelledPoint> receivedData;
help::exchangeMap(exchangePoints, receivedData);
//- receive faces from other processors
Map<label> transferredPointToLocal;
label counter(0);
while( counter < receivedData.size() )
{
const label beI =
globalToLocal[receivedData[counter++].pointLabel()];
DynList<label> f(receivedData[counter++].pointLabel());
forAll(f, pI)
{
const labelledPoint& lp = receivedData[counter++];
if( globalPointToLocal.found(lp.pointLabel()) )
{
//- this point already exist on this processor
f[pI] = bPoints[globalPointToLocal[lp.pointLabel()]];
}
else
{
//- this point does not exist on this processor
//- add it to the local list of points
//- it will be deleted when this procedure is finished
if( !transferredPointToLocal.found(lp.pointLabel()) )
{
//- this point has not yet been received
transferredPointToLocal.insert
(
lp.pointLabel(),
points.size()
);
mesh_.points().append(lp.coordinates());
}
f[pI] = transferredPointToLocal[lp.pointLabel()];
}
}
const face& bf = bFaces[eFaces(beI, 0)];
const label patch0 = boundaryFacePatches[eFaces(beI, 0)];
const label patch1 = otherProcPatches[beI];
std::pair<label, label> pp
(
Foam::min(patch0, patch1),
Foam::max(patch0, patch1)
);
if( edgeClassification.find(pp) == edgeClassification.end() )
edgeClassification.insert
(
std::make_pair(pp, Pair<label>(0, 0))
);
if(
(otherFaceProc[beI] > Pstream::myProcNo()) &&
(
!help::isSharedEdgeConvex(points, bf, f) ||
(help::angleBetweenFaces(points, bf, f) > 0.75 * M_PI)
)
)
{
++edgeClassification[pp].second();
}
else if( otherFaceProc[beI] > Pstream::myProcNo() )
{
++edgeClassification[pp].first();
}
}
//- set the size of points back to their original number
mesh_.points().setSize(nPoints_);
}
std::map<std::pair<label, label>, Pair<label> >::const_iterator it;
for(it=edgeClassification.begin();it!=edgeClassification.end();++it)
{
const std::pair<label, label>& edgePair = it->first;
const Pair<label>& nConvexAndConcave = it->second;
if( nConvexAndConcave.second() != 0 )
{
//- number of concave edges is greater than the number
//- of the convex ones. Treat patches together.
const label patch0 = edgePair.first;
const label patch1 = edgePair.second;
//- avoid adding unused patches in case of 2D meshing
if( treatedPatch_[patch0] || treatedPatch_[patch1] )
continue;
treatPatchesWithPatch_[patch0].append(patch1);
treatPatchesWithPatch_[patch1].append(patch0);
}
}
if( Pstream::parRun() )
{
//- make sure that all processors have the same graph
labelLongList flattenedPatches;
forAll(treatPatchesWithPatch_, patchI)
{
if( treatPatchesWithPatch_[patchI].size() <= 1 )
continue;
flattenedPatches.append(patchI);
flattenedPatches.append(treatPatchesWithPatch_[patchI].size());
forAll(treatPatchesWithPatch_[patchI], itemI)
flattenedPatches.append(treatPatchesWithPatch_[patchI][itemI]);
}
labelListList procPatches(Pstream::nProcs());
procPatches[Pstream::myProcNo()].setSize(flattenedPatches.size());
forAll(flattenedPatches, i)
procPatches[Pstream::myProcNo()][i] = flattenedPatches[i];
Pstream::gatherList(procPatches);
Pstream::scatterList(procPatches);
forAll(procPatches, procI)
{
if( procI == Pstream::myProcNo() )
continue;
const labelList& cPatches = procPatches[procI];
label counter(0);
while( counter < cPatches.size() )
{
const label patchI = cPatches[counter++];
const label size = cPatches[counter++];
for(label i=0;i<size;++i)
treatPatchesWithPatch_[patchI].appendIfNotIn
(
cPatches[counter++]
);
}
}
}
//- final adjusting of patches which shall be treated together
boolList confirmed(treatPatchesWithPatch_.size(), false);
forAll(treatPatchesWithPatch_, patchI)
{
if( treatPatchesWithPatch_[patchI].size() <= 1 )
{
confirmed[patchI] = true;
continue;
}
if( confirmed[patchI] )
continue;
std::set<label> commonPatches;
commonPatches.insert(patchI);
DynList<label> front;
front.append(patchI);
confirmed[patchI] = true;
while( front.size() )
{
const label fPatch = front.removeLastElement();
forAll(treatPatchesWithPatch_[fPatch], i)
{
const label patchJ = treatPatchesWithPatch_[fPatch][i];
if( confirmed[patchJ] )
continue;
front.append(patchJ);
confirmed[patchJ] = true;
commonPatches.insert(patchJ);
forAll(treatPatchesWithPatch_[patchJ], j)
commonPatches.insert(treatPatchesWithPatch_[patchJ][j]);
}
}
forAllConstIter(std::set<label>, commonPatches, it)
{
const label patchJ = *it;
treatPatchesWithPatch_[patchJ].clear();
forAllConstIter(std::set<label>, commonPatches, iter)
treatPatchesWithPatch_[patchJ].append(*iter);
}
}
# ifdef DEBUGLayer
for(it=edgeClassification.begin();it!=edgeClassification.end();++it)
{
const std::pair<label, label>& edgePair = it->first;
const Pair<label>& nConvexAndConcave = it->second;
Info << "Pair of patches " << edgePair.first << " "
<< edgePair.second << " is " << nConvexAndConcave << endl;
}
Info << "Patch names " << patchNames_ << endl;
Info << "Treat patches with patch " << treatPatchesWithPatch_ << endl;
label layerI(0), subsetId;
boolList usedPatch(treatPatchesWithPatch_.size(), false);
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
forAll(treatPatchesWithPatch_, patchI)
{
if( usedPatch[patchI] || (boundaries[patchI].patchSize() == 0) )
continue;
Info << "Adding layer subset " << layerI
<< " for patch " << patchI << endl;
usedPatch[patchI] = true;
subsetId = mesh_.addFaceSubset("layer_"+help::scalarToText(layerI));
++layerI;
forAll(treatPatchesWithPatch_[patchI], i)
{
const label cPatch = treatPatchesWithPatch_[patchI][i];
usedPatch[cPatch] = true;
label start = boundaries[cPatch].patchStart();
const label size = boundaries[cPatch].patchSize();
for(label i=0;i<size;++i)
mesh_.addFaceToSubset(subsetId, start++);
}
}
mesh_.write();
# endif
geometryAnalysed_ = true;
}
void boundaryLayers::addLayerForPatch(const label patchLabel)
{
if( treatedPatch_[patchLabel] )
return;
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
if( returnReduce(boundaries[patchLabel].patchSize(), sumOp<label>()) == 0 )
return;
boolList treatPatches(boundaries.size(), false);
if( patchWiseLayers_ )
{
forAll(treatPatchesWithPatch_[patchLabel], pI)
treatPatches[treatPatchesWithPatch_[patchLabel][pI]] = true;
}
else
{
forAll(treatedPatch_, patchI)
if( !treatedPatch_[patchI] )
treatPatches[patchI] = true;
}
newLabelForVertex_.setSize(nPoints_);
newLabelForVertex_ = -1;
otherVrts_.clear();
patchKey_.clear();
createNewVertices(treatPatches);
createNewFacesAndCells(treatPatches);
forAll(treatPatches, patchI)
if( treatPatches[patchI] )
treatedPatch_[patchI] = true;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from mesh reference
boundaryLayers::boundaryLayers
(
polyMeshGen& mesh
)
:
mesh_(mesh),
msePtr_(NULL),
meshPartitionerPtr_(NULL),
patchWiseLayers_(true),
terminateLayersAtConcaveEdges_(false),
is2DMesh_(false),
patchNames_(),
treatedPatch_(),
treatPatchesWithPatch_(),
newLabelForVertex_(),
otherVrts_(),
patchKey_(),
nPoints_(mesh.points().size()),
geometryAnalysed_(false)
{
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
patchNames_.setSize(boundaries.size());
forAll(boundaries, patchI)
patchNames_[patchI] = boundaries[patchI].patchName();
treatedPatch_.setSize(boundaries.size());
treatedPatch_ = false;
treatPatchesWithPatch_.setSize(boundaries.size());
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
boundaryLayers::~boundaryLayers()
{
clearOut();
if( Pstream::parRun() )
polyMeshGenModifier(mesh_).removeUnusedVertices();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::addLayerForPatch(const word& patchName)
{
if( !geometryAnalysed_ )
findPatchesToBeTreatedTogether();
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
forAll(boundaries, patchI)
if( boundaries[patchI].patchName() == patchName )
addLayerForPatch(patchI);
}
void boundaryLayers::createOTopologyLayers()
{
patchWiseLayers_ = false;
}
void boundaryLayers::terminateLayersAtConcaveEdges()
{
terminateLayersAtConcaveEdges_ = true;
}
void boundaryLayers::activate2DMode()
{
polyMeshGen2DEngine mesh2DEngine(mesh_);
const boolList& zMinPoint = mesh2DEngine.zMinPoints();
const boolList& zMaxPoint = mesh2DEngine.zMaxPoints();
const faceList::subList& bFaces = surfaceEngine().boundaryFaces();
const labelList& facePatch = surfaceEngine().boundaryFacePatches();
boolList allZMax(mesh_.boundaries().size(), true);
boolList allZMin(mesh_.boundaries().size(), true);
# ifdef USE_OMP
# pragma omp parallel for schedule(dynamic, 50)
# endif
forAll(bFaces, bfI)
{
const face& bf = bFaces[bfI];
forAll(bf, pI)
{
if( !zMinPoint[bf[pI]] )
allZMin[facePatch[bfI]] = false;
if( !zMaxPoint[bf[pI]] )
allZMax[facePatch[bfI]] = false;
}
}
//- mark empty patches as already used
forAll(allZMin, patchI)
{
if( allZMin[patchI] ^ allZMax[patchI] )
{
treatedPatch_[patchI] = true;
}
}
forAll(treatPatchesWithPatch_, patchI)
{
DynList<label>& patches = treatPatchesWithPatch_[patchI];
for(label i=patches.size()-1;i>=0;--i)
if( treatedPatch_[patches[i]] )
patches.removeElement(i);
}
is2DMesh_ = true;
}
void boundaryLayers::addLayerForAllPatches()
{
if( !geometryAnalysed_ )
findPatchesToBeTreatedTogether();
const PtrList<boundaryPatch>& boundaries = mesh_.boundaries();
if( !patchWiseLayers_ )
{
forAll(boundaries, patchI)
addLayerForPatch(patchI);
}
else
{
newLabelForVertex_.setSize(nPoints_);
newLabelForVertex_ = -1;
otherVrts_.clear();
patchKey_.clear();
//- avoid generating bnd layer at empty patches in case of 2D meshing
label counter(0);
forAll(treatedPatch_, patchI)
if( !treatedPatch_[patchI] )
++counter;
labelList treatedPatches(counter);
counter = 0;
forAll(treatedPatch_, i)
if( !treatedPatch_[i] )
treatedPatches[counter++] = i;
//- create bnd layer vertices
createNewVertices(treatedPatches);
//- create bnd layer cells
createLayerCells(treatedPatches);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,292 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
boundaryLayers
Description
Creates boundary layers
SourceFiles
boundaryLayers.C
\*---------------------------------------------------------------------------*/
#ifndef boundaryLayers_H
#define boundaryLayers_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "meshSurfaceEngine.H"
#include "meshSurfacePartitioner.H"
#include "DynList.H"
#include "labelLongList.H"
#include "Map.H"
#include "labelPair.H"
#include <map>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
class meshSurfaceEngine;
class meshSurfacePartitioner;
/*---------------------------------------------------------------------------*\
Class boundaryLayers Declaration
\*---------------------------------------------------------------------------*/
class boundaryLayers
{
//- Reference to the mesh
polyMeshGen& mesh_;
//- pointer to mesh surface engine
mutable meshSurfaceEngine* msePtr_;
//- poiner to meshSurfacePartitioner
mutable meshSurfacePartitioner* meshPartitionerPtr_;
//- shall I create patch-wise layers (true)
//- O-topology layer (false)
bool patchWiseLayers_;
//- shall the layers be terminated at concave edges (true)
bool terminateLayersAtConcaveEdges_;
//- is it a 2D mesh
bool is2DMesh_;
//- patch names
wordList patchNames_;
//- helper which contains information if a boundary layer
//- has already been extruded for a given patch
boolList treatedPatch_;
//- extrude patches with patch
List<DynList<label> > treatPatchesWithPatch_;
//- label of a new node (helper)
labelLongList newLabelForVertex_;
//- map storing labels of new vertices created at node
//- and corner vertices
std::map<label, std::map<std::pair<label, label>, label> > otherVrts_;
//- a key assigned to each patch. It is needed to search in otherVrts_
labelList patchKey_;
//- number of vertices in the mesh
label nPoints_;
//- has the geometry been analysed
bool geometryAnalysed_;
// Private member functions
//- Return const reference to meshSurfaceEngine
const meshSurfaceEngine& surfaceEngine() const;
//- return const reference to meshSurfacePartitioner
const meshSurfacePartitioner& surfacePartitioner() const;
//- find if any other patches need to be treated together
//- with the given one
void findPatchesToBeTreatedTogether();
//- find vertices of the selected patches
void findPatchVertices
(
const boolList& treatPatches,
List<direction>& patchVertex
) const;
//- check and correct the topology of boundary faces where
//- the layers terminate
void checkTopologyOfBoundaryFaces(const labelList& patchLabels);
//- create new vertex
point createNewVertex
(
const label bpI,
const boolList& treatPatches,
const List<direction>& pVertices
) const;
//- create new vertices for the selected patches
void createNewVertices
(
const boolList& treatPatches
);
//- create new vertices such that layers for selected patches
//- are generated in a single run
void createNewVertices
(
const labelList& patchLabels
);
//- creates new vertices for vertices at parallel boundaries
void createNewPartitionVerticesParallel
(
const labelLongList& procPoints,
const List<direction>& pVertices,
const boolList& treatPatches
);
//- creates new vertices from vertices at parallel boundaries
//- which are also at the border of the treated partitions
void createNewEdgeVerticesParallel
(
const labelLongList& procPoints,
const List<direction>& pVertices,
const boolList& treatPatches
);
//- create a layer of cells
void createNewFacesAndCells
(
const boolList& treatPatches
);
//- create new faces at parallel boundaries
//- faces are extruded from edges
void createNewFacesParallel
(
const boolList& treatPatches
);
//- create new faces at parallel boundaries
//- faces are created from points at parallel boundaries
//- the function takes a reference to the faces which are the candidates
//- to create faces at parallel boundaries
void createNewFacesFromPointsParallel
(
const LongList<DynList<label, 4> >& faceCandidates,
const LongList<labelPair>& candidatePatches
);
//- create layer cells in one go
//- this is much faster than layer by layer
void createLayerCells(const labelList& patchLabels);
//- helper function finding a new face label for multiply extruded nodes
inline label findNewNodeLabel
(
const label pointI,
const label pKey
) const;
//- creating hex cells near feature edges
inline void createNewCellFromEdge
(
const edge& e,
const label pKeyI,
const label pKeyJ,
FixedList<FixedList<label, 4>, 6>& cellFaces
) const;
//- creating hex cells near corners
inline void createNewCellFromNode
(
const label pointI,
const DynList<label, 3>& pKeys,
FixedList<FixedList<label, 4>, 6>& cellFaces
) const;
//- create a bnd layer for a given patch
void addLayerForPatch(const label patchLabel);
//- delete meshSurfaceEngine
inline void clearOut()
{
deleteDemandDrivenData(msePtr_);
deleteDemandDrivenData(meshPartitionerPtr_);
}
// Enumerators
enum vertexTypes
{
NONE = 0,
PATCHNODE = 1,
EDGENODE = 2,
CORNERNODE = 4,
PARALLELBOUNDARY = 8
};
//- Disallow bitwise copy construct
boundaryLayers(const boundaryLayers&);
//- Disallow bitwise assignment
void operator=(const boundaryLayers&);
public:
// Constructors
//- Construct from mesh reference
boundaryLayers(polyMeshGen& mesh);
// Destructor
~boundaryLayers();
// Public member functions
//- adds layer for a given patch
void addLayerForPatch(const word& patchName);
//- create O-topology layers (used as flag)
void createOTopologyLayers();
//- terminate boundary layers at concave edges (used as a flag)
void terminateLayersAtConcaveEdges();
//- avoid generating layers for empty patches in case of a 2D mesh
//- used as a flag prior to addLayerForAllPatches
void activate2DMode();
//- add layers for all patches
void addLayerForAllPatches();
//- add wrapper layer
//- this function is intended for usage before surface recovery
void addWrapperLayer();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "boundaryLayersI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -36,7 +36,7 @@ SourceFiles
#define boundaryLayers_H #define boundaryLayers_H
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "meshSurfaceEngine.H" #include "meshSurfaceEngine.H"
#include "meshSurfacePartitioner.H" #include "meshSurfacePartitioner.H"

View file

@ -1,274 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "boundaryLayers.H"
#include "meshSurfaceEngine.H"
#include "decomposeCells.H"
#include "helperFunctions.H"
#include "HashSet.H"
#include <set>
//#define DEBUGLayer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::checkTopologyOfBoundaryFaces(const labelList& patchLabels)
{
if( !patchWiseLayers_ )
return;
Info << "Checking topology of boundary faces" << endl;
labelHashSet usedPatches;
forAll(patchLabels, i)
usedPatches.insert(patchLabels[i]);
//- create a set of patch pairs. These are pairs at which the layers
//- shall be terminated
std::set<std::pair<label, label> > terminatedPairs;
forAll(treatPatchesWithPatch_, patchI)
{
const DynList<label>& otherPatches = treatPatchesWithPatch_[patchI];
forAll(otherPatches, patchJ)
{
if( patchI == otherPatches[patchJ] )
continue;
terminatedPairs.insert
(
std::make_pair
(
Foam::min(patchI, otherPatches[patchJ]),
Foam::max(patchI, otherPatches[patchJ])
)
);
}
}
bool changed;
label nDecomposed(0);
boolList decomposeCell(mesh_.cells().size(), false);
do
{
changed = false;
const meshSurfaceEngine& mse = this->surfaceEngine();
const faceList::subList& bFaces = mse.boundaryFaces();
const labelList& faceOwner = mse.faceOwners();
const labelList& facePatches = mse.boundaryFacePatches();
const VRWGraph& faceEdges = mse.faceEdges();
const VRWGraph& edgeFaces = mse.edgeFaces();
const Map<label>& otherProcPatch = mse.otherEdgeFacePatch();
VRWGraph newBoundaryFaces;
labelLongList newBoundaryOwners;
labelLongList newBoundaryPatches;
forAll(bFaces, bfI)
{
const face& bf = bFaces[bfI];
const label fPatch = facePatches[bfI];
if( !usedPatches.found(fPatch) )
continue;
//- find patches of neighbour faces
labelList neiPatches(bf.size());
forAll(bf, eI)
{
const label beI = faceEdges(bfI, eI);
if( edgeFaces.sizeOfRow(beI) == 2 )
{
label neiFace = edgeFaces(beI, 0);
if( neiFace == bfI )
neiFace = edgeFaces(beI, 1);
neiPatches[eI] = facePatches[neiFace];
}
else if( edgeFaces.sizeOfRow(beI) == 1 )
{
//- edge is at a parallel boundary
neiPatches[eI] = otherProcPatch[beI];
}
}
//- find feature edges and check if the patches meeting there
//- shall be treated together.
bool storedFace(false);
forAll(neiPatches, eI)
{
if( neiPatches[eI] == fPatch )
continue;
std::pair<label, label> pp
(
Foam::min(fPatch, neiPatches[eI]),
Foam::max(fPatch, neiPatches[eI])
);
if( terminatedPairs.find(pp) == terminatedPairs.end() )
continue;
//- create a new face from this edge and the neighbouring edges
bool usePrev(false), useNext(false);
if( neiPatches[neiPatches.rcIndex(eI)] == fPatch )
{
usePrev = true;
}
else
{
std::pair<label, label> ppPrev
(
Foam::min(fPatch, neiPatches[neiPatches.rcIndex(eI)]),
Foam::max(fPatch, neiPatches[neiPatches.rcIndex(eI)])
);
if( terminatedPairs.find(ppPrev) == terminatedPairs.end() )
usePrev = true;
}
if( neiPatches[neiPatches.fcIndex(eI)] == fPatch )
{
useNext = true;
}
else
{
std::pair<label, label> ppNext
(
Foam::min(fPatch, neiPatches[neiPatches.fcIndex(eI)]),
Foam::max(fPatch, neiPatches[neiPatches.fcIndex(eI)])
);
if( terminatedPairs.find(ppNext) == terminatedPairs.end() )
useNext = true;
}
DynList<edge> removeEdges;
if( useNext && usePrev )
{
removeEdges.setSize(3);
removeEdges[0] = bf.faceEdge(neiPatches.rcIndex(eI));
removeEdges[1] = bf.faceEdge(eI);
removeEdges[2] = bf.faceEdge(neiPatches.fcIndex(eI));
}
else if( useNext )
{
removeEdges.setSize(2);
removeEdges[0] = bf.faceEdge(neiPatches.fcIndex(eI));
removeEdges[1] = bf.faceEdge(eI);
}
else if( usePrev )
{
removeEdges.setSize(2);
removeEdges[0] = bf.faceEdge(neiPatches.rcIndex(eI));
removeEdges[1] = bf.faceEdge(eI);
}
const face cutFace = help::removeEdgesFromFace(bf, removeEdges);
if( cutFace.size() > 2 )
{
newBoundaryFaces.appendList(cutFace);
newBoundaryOwners.append(faceOwner[bfI]);
newBoundaryPatches.append(fPatch);
}
const face rFace = help::createFaceFromRemovedPart(bf, cutFace);
if( rFace.size() > 2 )
{
newBoundaryFaces.appendList(rFace);
newBoundaryOwners.append(faceOwner[bfI]);
newBoundaryPatches.append(fPatch);
}
if( (cutFace.size() > 2) && (rFace.size() > 2) )
{
decomposeCell[faceOwner[bfI]] = true;
changed = true;
++nDecomposed;
}
storedFace = true;
break;
}
if( !storedFace )
{
newBoundaryFaces.appendList(bf);
newBoundaryOwners.append(faceOwner[bfI]);
newBoundaryPatches.append(fPatch);
}
}
//- Finally, replace the boundary faces
reduce(changed, maxOp<bool>());
if( changed )
{
polyMeshGenModifier(mesh_).replaceBoundary
(
patchNames_,
newBoundaryFaces,
newBoundaryOwners,
newBoundaryPatches
);
clearOut();
}
} while( changed );
//- decompose owner cells adjacent to the decomposed faces
reduce(nDecomposed, sumOp<label>());
if( nDecomposed != 0 )
{
FatalError << "Critical. Not tested" << exit(FatalError);
decomposeCells dc(mesh_);
dc.decomposeMesh(decomposeCell);
clearOut();
}
mesh_.write();
Info << "Finished checking topology" << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,328 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "boundaryLayers.H"
#include "meshSurfaceEngine.H"
#include "helperFunctions.H"
#include "demandDrivenData.H"
#include "VRWGraphList.H"
#include <map>
//#define DEBUGLayer
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::createNewFacesAndCells(const boolList& treatPatches)
{
Info << "Starting creating layer cells" << endl;
const meshSurfaceEngine& mse = surfaceEngine();
const faceList::subList& bFaces = mse.boundaryFaces();
const VRWGraph& faceEdges = mse.faceEdges();
const VRWGraph& edgeFaces = mse.edgeFaces();
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
const labelList& faceOwners = mse.faceOwners();
//- this is used for parallel runs
const Map<label>* otherProcPatchPtr(NULL);
if( Pstream::parRun() )
{
createNewFacesParallel(treatPatches);
otherProcPatchPtr = &mse.otherEdgeFacePatch();
}
//- create lists for new boundary faces
VRWGraph newBoundaryFaces;
labelLongList newBoundaryOwners;
labelLongList newBoundaryPatches;
//- create storage for new cells
VRWGraphList cellsToAdd;
//- create layer cells and store boundary faces
const label nOldCells = mesh_.cells().size();
forAll(bFaces, bfI)
if( treatPatches[boundaryFacePatches[bfI]] )
{
const face& f = bFaces[bfI];
faceList cellFaces(f.size() + 2);
label fI(0);
//- store boundary face
cellFaces[fI++] = f.reverseFace();
//- create parallel face
face newF(f.size());
forAll(f, pI)
newF[pI] = newLabelForVertex_[f[pI]];
cellFaces[fI++] = newF;
newBoundaryFaces.appendList(newF);
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
newBoundaryPatches.append(boundaryFacePatches[bfI]);
//- create quad faces
newF.setSize(4);
forAll(f, pI)
{
newF[0] = f[pI];
newF[1] = f.nextLabel(pI);
newF[2] = newLabelForVertex_[f.nextLabel(pI)];
newF[3] = newLabelForVertex_[f[pI]];
cellFaces[fI++] = newF;
//- check if the face is at the boundary
//- of the treated partitions
const label edgeI = faceEdges(bfI, pI);
if( edgeFaces.sizeOfRow(edgeI) == 2 )
{
label neiFace = edgeFaces(edgeI, 0);
if( neiFace == bfI )
neiFace = edgeFaces(edgeI, 1);
if( !treatPatches[boundaryFacePatches[neiFace]] )
{
newBoundaryFaces.appendList(newF);
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
newBoundaryPatches.append(boundaryFacePatches[neiFace]);
}
}
else if( edgeFaces.sizeOfRow(edgeI) == 1 )
{
const Map<label>& otherProcPatch = *otherProcPatchPtr;
if( !treatPatches[otherProcPatch[edgeI]] )
{
newBoundaryFaces.appendList(newF);
newBoundaryOwners.append(cellsToAdd.size() + nOldCells);
newBoundaryPatches.append(otherProcPatch[edgeI]);
}
}
}
cellsToAdd.appendGraph(cellFaces);
}
else
{
# ifdef DEBUGLayer
Info << "Storing original boundary face "
<< bfI << " into patch " << boundaryFacePatches[bfI] << endl;
# endif
newBoundaryFaces.appendList(bFaces[bfI]);
newBoundaryOwners.append(faceOwners[bfI]);
newBoundaryPatches.append(boundaryFacePatches[bfI]);
}
//- create mesh modifier
polyMeshGenModifier meshModifier(mesh_);
meshModifier.addCells(cellsToAdd);
cellsToAdd.clear();
meshModifier.reorderBoundaryFaces();
meshModifier.replaceBoundary
(
patchNames_,
newBoundaryFaces,
newBoundaryOwners,
newBoundaryPatches
);
//- delete meshSurfaceEngine
this->clearOut();
# ifdef DEBUGLayer
mesh_.addressingData().checkMesh(true);
# endif
Info << "Finished creating layer cells" << endl;
}
void boundaryLayers::createNewFacesParallel
(
const boolList& treatPatches
)
{
const meshSurfaceEngine& mse = surfaceEngine();
const faceList::subList& bFaces = mse.boundaryFaces();
const VRWGraph& faceEdges = mse.faceEdges();
const VRWGraph& edgeFaces = mse.edgeFaces();
const labelList& boundaryFacePatches = mse.boundaryFacePatches();
const labelList& globalEdgeLabel = mse.globalBoundaryEdgeLabel();
const Map<label>& globalToLocal = mse.globalToLocalBndEdgeAddressing();
const Map<label>& otherProcPatch = mse.otherEdgeFacePatch();
const Map<label>& otherFaceProc = mse.otherEdgeFaceAtProc();
//- the next stage is the generation of processor faces
//- this step can be done without any communication, but only if the faces
//- are added in the same order on both processors
//- this will be achieved by sorting edges according to their global labes
//- another difficulty here is that new processor patches may occur
//- during this procedure
Map<label> otherProcToProcPatch;
forAll(mesh_.procBoundaries(), patchI)
{
const processorBoundaryPatch& wp = mesh_.procBoundaries()[patchI];
otherProcToProcPatch.insert(wp.neiProcNo(), patchI);
}
label nTreatedEdges(0);
boolList treatEdge(edgeFaces.size(), false);
for
(
Map<label>::const_iterator iter=globalToLocal.begin();
iter!=globalToLocal.end();
++iter
)
{
const label beI = iter();
if( edgeFaces.sizeOfRow(beI) != 1 )
continue;
if(
treatPatches[boundaryFacePatches[edgeFaces(beI, 0)]] &&
treatPatches[otherProcPatch[beI]]
)
{
++nTreatedEdges;
treatEdge[beI] = true;
}
}
//- create a list of treated edges and sort the list
labelList treatedEdgeLabels(nTreatedEdges);
nTreatedEdges = 0;
forAll(treatEdge, beI)
if( treatEdge[beI] )
{
treatedEdgeLabels[nTreatedEdges++] = globalEdgeLabel[beI];
}
treatedEdgeLabels.setSize(nTreatedEdges);
sort(treatedEdgeLabels);
//- create additional processor patches if needed
forAll(treatedEdgeLabels, eI)
{
const label beI = globalToLocal[treatedEdgeLabels[eI]];
if( !otherProcToProcPatch.found(otherFaceProc[beI]) )
{
otherProcToProcPatch.insert
(
otherFaceProc[beI],
polyMeshGenModifier(mesh_).addProcessorPatch
(
otherFaceProc[beI]
)
);
}
}
//- create new processor faces
VRWGraph newProcFaces;
labelLongList faceProcPatch;
FixedList<label, 4> newF;
forAll(treatedEdgeLabels, geI)
{
const label beI = globalToLocal[treatedEdgeLabels[geI]];
if( edgeFaces.sizeOfRow(beI) == 0 )
continue;
const label bfI = edgeFaces(beI, 0);
const label pos = faceEdges.containsAtPosition(bfI, beI);
const edge e = bFaces[bfI].faceEdge(pos);
if( otherFaceProc[beI] > Pstream::myProcNo() )
{
newF[0] = e.start();
newF[1] = e.end();
if( patchKey_.size() != 0 )
{
newF[2] =
findNewNodeLabel(e.end(), patchKey_[otherProcPatch[beI]]);
newF[3] =
findNewNodeLabel(e.start(), patchKey_[otherProcPatch[beI]]);
}
else
{
newF[2] = newLabelForVertex_[e.end()];
newF[3] = newLabelForVertex_[e.start()];
}
}
else
{
newF[0] = e.end();
if( patchKey_.size() != 0 )
{
newF[1] =
findNewNodeLabel
(
e.end(),
patchKey_[boundaryFacePatches[bfI]]
);
newF[2] =
findNewNodeLabel
(
e.start(),
patchKey_[boundaryFacePatches[bfI]]
);
}
else
{
newF[1] = newLabelForVertex_[e.end()];
newF[2] = newLabelForVertex_[e.start()];
}
newF[3] = e.start();
}
newProcFaces.appendList(newF);
faceProcPatch.append(otherProcToProcPatch[otherFaceProc[beI]]);
}
//- add faces into the mesh
polyMeshGenModifier(mesh_).addProcessorFaces(newProcFaces, faceProcPatch);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,315 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
label boundaryLayers::findNewNodeLabel
(
const label pointI,
const label pKey
) const
{
const std::map
<
label, std::map<std::pair<label, label>, label>
>::const_iterator it = otherVrts_.find(pointI);
if( it != otherVrts_.end() )
{
const std::map<std::pair<label, label>, label>& m = it->second;
std::map<std::pair<label, label>, label>::const_iterator mit;
if( m.size() == 2 )
{
for(mit=m.begin();mit!=m.end();++mit)
{
if( mit->first.first != pKey )
return mit->second;
}
}
else
{
for(mit=m.begin();mit!=m.end();++mit)
{
if( mit->first.first == pKey )
continue;
if( mit->first.second == pKey )
continue;
if( mit->first.first == mit->first.second )
continue;
return mit->second;
}
}
}
return newLabelForVertex_[pointI];
}
inline void boundaryLayers::createNewCellFromEdge
(
const edge& e,
const label pKeyI,
const label pKeyJ,
FixedList<FixedList<label, 4>, 6>& cellFaces
) const
{
const std::map<std::pair<label, label>, label>& ms =
otherVrts_.find(e.start())->second;
const std::map<std::pair<label, label>, label>& me =
otherVrts_.find(e.end())->second;
# ifdef DEBUGLayer
Info << "Creating cell for edge with nodes " << e << endl;
Info << "pKeyI " << pKeyI << endl;
Info << "pKeyJ " << pKeyJ << endl;
std::map<std::pair<label, label>, label>::const_iterator iter;
for(iter=ms.begin();iter!=ms.end();++iter)
Info << "1. Pair (" << iter->first.first << ", "
<< iter->first.second << ") has value " << iter->second << endl;
for(iter=me.begin();iter!=me.end();++iter)
Info << "2. Pair (" << iter->first.first << ", "
<< iter->first.second << ") has value " << iter->second << endl;
# endif
label p0s(-1), p1s(-1), ns(-1), p0e(-1), p1e(-1), ne(-1);
if( ms.size() == 2 )
{
p0s = ms.find(std::pair<label, label>(pKeyI, pKeyI))->second;
p1s = ms.find(std::pair<label, label>(pKeyJ, pKeyJ))->second;
ns = newLabelForVertex_[e.start()];
}
else
{
std::map<std::pair<label, label>, label>::const_iterator it;
for(it=ms.begin();it!=ms.end();++it)
{
if(
(it->first.first != pKeyJ) && (it->first.second != pKeyJ)
&& (it->first.first != it->first.second)
)
{
p0s = it->second;
}
else if(
(it->first.first != pKeyI) && (it->first.second != pKeyI)
&& (it->first.first != it->first.second)
)
{
p1s = it->second;
}
else if(
(it->first.first == it->first.second) &&
(it->first.first != pKeyI) && (it->first.first != pKeyJ)
)
{
ns = it->second;
}
}
}
if( me.size() == 2 )
{
p0e = me.find(std::pair<label, label>(pKeyI, pKeyI))->second;
p1e = me.find(std::pair<label, label>(pKeyJ, pKeyJ))->second;
ne = newLabelForVertex_[e.end()];
}
else
{
std::map<std::pair<label, label>, label>::const_iterator it;
for(it=me.begin();it!=me.end();++it)
{
if(
(it->first.first != pKeyJ) && (it->first.second != pKeyJ)
&& (it->first.first != it->first.second)
)
{
p0e = it->second;
}
else if(
(it->first.first != pKeyI) && (it->first.second != pKeyI)
&& (it->first.first != it->first.second)
)
{
p1e = it->second;
}
else if(
(it->first.first == it->first.second) &&
(it->first.first != pKeyI) && (it->first.first != pKeyJ)
)
{
ne = it->second;
}
}
}
//- F0
cellFaces[0][0] = e.end();
cellFaces[0][1] = e.start();
cellFaces[0][2] = p1s;
cellFaces[0][3] = p1e;
//- F1
cellFaces[1][0] = p0e;
cellFaces[1][1] = ne;
cellFaces[1][2] = ns;
cellFaces[1][3] = p0s;
//- F2
cellFaces[2][0] = e.start();
cellFaces[2][1] = e.end();
cellFaces[2][2] = p0e;
cellFaces[2][3] = p0s;
//- F3
cellFaces[3][0] = p1s;
cellFaces[3][1] = ns;
cellFaces[3][2] = ne;
cellFaces[3][3] = p1e;
//- F4
cellFaces[4][0] = e.end();
cellFaces[4][1] = p1e;
cellFaces[4][2] = ne;
cellFaces[4][3] = p0e;
//- F5
cellFaces[5][0] = e.start();
cellFaces[5][1] = p0s;
cellFaces[5][2] = ns;
cellFaces[5][3] = p1s;
# ifdef DEBUGLayer
forAll(cellFaces, fI)
{
forAll(cellFaces[fI], pI)
{
if
(
cellFaces[fI][pI] < 0 ||
cellFaces[fI][pI] >= mesh_.points().size()
)
FatalError << "Invalid point indices found!"
<< abort(FatalError);
}
}
# endif
}
inline void boundaryLayers::createNewCellFromNode
(
const label pointI,
const DynList<label, 3>& pKeys,
FixedList<FixedList<label, 4>, 6>& cellFaces
) const
{
const std::map<std::pair<label, label>, label>& m =
otherVrts_.find(pointI)->second;
//- create labels before creating cells
const label n = newLabelForVertex_[pointI];
const label p00 =
m.find(std::pair<label, label>(pKeys[0], pKeys[0]))->second;
const label p11 =
m.find(std::pair<label, label>(pKeys[1], pKeys[1]))->second;
const label p22 =
m.find(std::pair<label, label>(pKeys[2], pKeys[2]))->second;
std::pair<label, label> pr;
pr.first = pKeys[0];
pr.second = pKeys[1];
if( m.find(pr) == m.end() )
{
pr.first = pKeys[1];
pr.second = pKeys[0];
}
const label p01 = m.find(pr)->second;
pr.first = pKeys[0];
pr.second = pKeys[2];
if( m.find(pr) == m.end() )
{
pr.first = pKeys[2];
pr.second = pKeys[0];
}
const label p02 = m.find(pr)->second;
pr.first = pKeys[1];
pr.second = pKeys[2];
if( m.find(pr) == m.end() )
{
pr.first = pKeys[2];
pr.second = pKeys[1];
}
const label p12 = m.find(pr)->second;
//- create the cell and append it
//- F0
cellFaces[0][0] = pointI;
cellFaces[0][1] = p02;
cellFaces[0][2] = p00;
cellFaces[0][3] = p01;
//- F1
cellFaces[1][0] = p12;
cellFaces[1][1] = p11;
cellFaces[1][2] = n;
cellFaces[1][3] = p22;
//- F2
cellFaces[2][0] = pointI;
cellFaces[2][1] = p01;
cellFaces[2][2] = p11;
cellFaces[2][3] = p12;
//- F3
cellFaces[3][0] = p02;
cellFaces[3][1] = p22;
cellFaces[3][2] = n;
cellFaces[3][3] = p00;
//- F4
cellFaces[4][0] = pointI;
cellFaces[4][1] = p12;
cellFaces[4][2] = p22;
cellFaces[4][3] = p02;
//- F5
cellFaces[5][0] = p01;
cellFaces[5][1] = p00;
cellFaces[5][2] = n;
cellFaces[5][3] = p11;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,75 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "boundaryLayers.H"
#include "meshSurfaceEngine.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void boundaryLayers::addWrapperLayer()
{
createOTopologyLayers();
if( treatedPatch_[0] ) return;
const meshSurfaceEngine& mse = surfaceEngine();
const labelList& bPoints = mse.boundaryPoints();
boolList treatPatches(mesh_.boundaries().size(), true);
labelLongList newLabelForVertex(nPoints_, -1);
pointFieldPMG& points = mesh_.points();
points.setSize(points.size() + bPoints.size());
forAll(bPoints, bpI)
{
points[nPoints_] = points[bPoints[bpI]];
newLabelForVertex[bPoints[bpI]] = nPoints_++;
}
createNewFacesAndCells(treatPatches);
forAll(treatPatches, patchI)
if( treatPatches[patchI] )
treatedPatch_[patchI] = true;
//- delete surface engine
clearOut();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

File diff suppressed because it is too large Load diff

View file

@ -1,219 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
extrudeLayer
Description
Creates a sheet of prismatic cells from the selected faces in
the direction of the specified cell for each face
SourceFiles
extrudeLayer.C
\*---------------------------------------------------------------------------*/
#ifndef extrudeLayer_H
#define extrudeLayer_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "VRWGraphList.H"
#include "labelPair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class extrudeLayer Declaration
\*---------------------------------------------------------------------------*/
class extrudeLayer
{
// Private data
//- Reference to the mesh
polyMeshGen& mesh_;
//- thickness
const scalar thickness_;
//- number of points in the original mesh
const label nOrigPoints_;
//- number of faces in the original mesh
const label nOrigFaces_;
//- number of cells in the original mesh
const label nOrigCells_;
//- pairs of faces making the extruded front
LongList<labelPair> extrudedFaces_;
//- store the orientation of the extruded front
//- true if the pair has the same orientation and false otherwise
LongList<bool> pairOrientation_;
//- original point label
labelLongList origPointLabel_;
// Private member functions
//- duplicate faces which will be extruded
void createDuplicateFrontFaces(const LongList<labelPair>&);
//- create new vertices and open the mesh
void createNewVertices();
//- move points to make space for the new cells
void movePoints();
//- create layer cells
void createLayerCells();
//- create new faces at parallel boundaries
void createNewFacesParallel();
//- update boundary patches
void updateBoundary();
// Nested classes
//- this class provides addressing data needed for generating
//- cells emerging as a consequence of self-intersecting layers
class addressingCalculator
{
// Private data
//- const reference to mesh faces
const faceListPMG& faces_;
//- const reference to extruded face pairs
const LongList<labelPair>& extrudedFaces_;
//- const reference telling the orientation of each face pair
LongList<bool> pairOrientation_;
//- const reference to the extruded faces at points
const VRWGraph& pointExtruded_;
public:
// Construct from faces, extruded face pairs and
// point-extrudedfaces addressing
addressingCalculator
(
const faceListPMG& faces,
const LongList<labelPair>& extrudedFaces,
const LongList<bool>& pairOrientation,
const VRWGraph& pointFaces
);
// Destructor
~addressingCalculator();
// Member functions
//- return label of the original face for the given face
inline label origFaceLabel(const label extrudedI) const;
//- return position of point in extruded face
inline label positionInFace
(
const label extrudedI,
const label pointI
) const;
//- return point label in the original face
inline label origPointLabel
(
const label extrudedI,
const label pos
) const;
inline label origPoint
(
const label extrudedI,
const label pointI
) const;
//- find face sharing an edge with the given face
inline label faceSharingEdge
(
const label extrudedI,
const label eI
) const;
//- find faces attached to both points
inline void facesSharingEdge
(
const label start,
const label end,
DynList<label>&
) const;
};
// Enumerators
enum extrudeLayerTypes_
{
NONE = 0,
FRONTVERTEX = 1,
FRONTVERTEXPROCBND = 2
};
//- Disallow bitwise copy construct
extrudeLayer(const extrudeLayer&);
//- Disallow bitwise assignment
void operator=(const extrudeLayer&);
public:
// Constructors
//- Construct from mesh, extrusion faces, thickness and number of layers
extrudeLayer
(
polyMeshGen& mesh,
const LongList<labelPair>& extrusionFront,
const scalar thickness = -1.0
);
// Destructor
~extrudeLayer();
// Public member functions
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "extrudeLayerI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -37,7 +37,7 @@ SourceFiles
#define extrudeLayer_H #define extrudeLayer_H
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "VRWGraphList.H" #include "VRWGraphList.H"
#include "labelPair.H" #include "labelPair.H"

View file

@ -1,168 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline label extrudeLayer::addressingCalculator::origFaceLabel
(
const label extrudedI
) const
{
return extrudedFaces_[extrudedI].second();
}
inline label extrudeLayer::addressingCalculator::positionInFace
(
const label extrudedI,
const label pointI
) const
{
const face& f = faces_[extrudedFaces_[extrudedI].first()];
return f.which(pointI);
}
inline label extrudeLayer::addressingCalculator::origPointLabel
(
const label extrudedI,
const label pos
) const
{
const face& of = faces_[extrudedFaces_[extrudedI].second()];
if( pairOrientation_[extrudedI] )
{
return of[pos];
}
else
{
return of[(of.size()-pos)%of.size()];
}
FatalErrorIn
(
"label extrudeLayer::addressingCalculator::origPointLabel"
"(const label, const label) const"
) << "Cannot find point for the given position" << abort(FatalError);
return -1;
}
inline label extrudeLayer::addressingCalculator::origPoint
(
const label extrudedI,
const label pointI
) const
{
const face& f = faces_[extrudedFaces_[extrudedI].first()];
const face& of = faces_[extrudedFaces_[extrudedI].second()];
const label pos = f.which(pointI);
if( pairOrientation_[extrudedI] )
{
return of[pos];
}
else
{
return of[(of.size()-pos)%of.size()];
}
FatalErrorIn
(
"label extrudeLayer::addressingCalculator::origPoint"
"(const label, const label) const"
) << "Cannot find point for the given position" << abort(FatalError);
return -1;
}
inline label extrudeLayer::addressingCalculator::faceSharingEdge
(
const label extrudedI,
const label eI
) const
{
const face& f = faces_[extrudedFaces_[extrudedI].first()];
const label pointI = f[eI];
const label nextI = f.nextLabel(eI);
label otherFace(-1);
forAllRow(pointExtruded_, pointI, pfI)
{
const label currFaceI = pointExtruded_(pointI, pfI);
if( currFaceI == extrudedI )
continue;
if( pointExtruded_.contains(nextI, currFaceI) )
{
if( otherFace != -1 )
FatalErrorIn
(
"label extrudeLayer::addressingCalculator::faceSharingEdge"
"(const label, const label) const"
) << "Expected only one such face"
<< abort(FatalError);
otherFace = currFaceI;
}
}
return otherFace;
}
inline void extrudeLayer::addressingCalculator::facesSharingEdge
(
const label start,
const label end,
DynList<label>& edgeFaces
) const
{
edgeFaces.clear();
forAllRow(pointExtruded_, start, pfI)
{
const label currFaceI = pointExtruded_(start, pfI);
if( pointExtruded_.contains(end, currFaceI) )
edgeFaces.append(currFaceI);
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -1,380 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "refineBoundaryLayers.H"
#include "meshSurfaceEngine.H"
#include "demandDrivenData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const meshSurfaceEngine& refineBoundaryLayers::surfaceEngine() const
{
if( !msePtr_ )
msePtr_ = new meshSurfaceEngine(mesh_);
return *msePtr_;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
refineBoundaryLayers::refineBoundaryLayers(polyMeshGen& mesh)
:
mesh_(mesh),
msePtr_(NULL),
globalNumLayers_(1),
globalThicknessRatio_(1.0),
globalMaxThicknessFirstLayer_(VGREAT),
numLayersForPatch_(),
thicknessRatioForPatch_(),
maxThicknessForPatch_(),
discontinuousLayersForPatch_(),
done_(false),
is2DMesh_(false),
nLayersAtBndFace_(),
splitEdges_(),
splitEdgesAtPoint_(),
newVerticesForSplitEdge_(),
facesFromFace_(),
newFaces_()
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
refineBoundaryLayers::~refineBoundaryLayers()
{
deleteDemandDrivenData(msePtr_);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void refineBoundaryLayers::avoidRefinement()
{
globalNumLayers_ = 1;
numLayersForPatch_.clear();
}
void refineBoundaryLayers::activate2DMode()
{
is2DMesh_ = true;
}
void refineBoundaryLayers::setGlobalNumberOfLayers(const label nLayers)
{
if( nLayers < 2 )
{
WarningIn
(
"void refineBoundaryLayers::setGlobalNumberOfLayers(const label)"
) << "The specified global number of boundary layers is less than 2"
<< endl;
return;
}
globalNumLayers_ = nLayers;
}
void refineBoundaryLayers::setGlobalThicknessRatio(const scalar thicknessRatio)
{
if( thicknessRatio < 1.0 )
{
WarningIn
(
"void refineBoundaryLayers::setGlobalThicknessRatio(const scalar)"
) << "The specified global thickness ratio is less than 1.0" << endl;
return;
}
globalThicknessRatio_ = thicknessRatio;
}
void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer
(
const scalar maxThickness
)
{
if( maxThickness <= 0.0 )
{
WarningIn
(
"void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
"(const scalar)"
) << "The specified global maximum thickness of the first"
<< " boundary layer is negative!!" << endl;
return;
}
globalMaxThicknessFirstLayer_ = maxThickness;
}
void refineBoundaryLayers::setNumberOfLayersForPatch
(
const word& patchName,
const label nLayers
)
{
if( nLayers < 2 )
{
WarningIn
(
"void refineBoundaryLayers::setNumberOfLayersForPatch"
"(const word&, const label)"
) << "The specified number of boundary layers for patch " << patchName
<< " is less than 2" << endl;
return;
}
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
numLayersForPatch_[mesh_.getPatchName(matchedIDs[matchI])] = nLayers;
}
}
void refineBoundaryLayers::setThicknessRatioForPatch
(
const word& patchName,
const scalar thicknessRatio
)
{
if( thicknessRatio < 1.0 )
{
WarningIn
(
"void refineBoundaryLayers::setThicknessRatioForPatch"
"(const word&, const scalar)"
) << "The specified thickness ratio for patch " << patchName
<< " is less than 1.0" << endl;
return;
}
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
const word pName = mesh_.getPatchName(matchedIDs[matchI]);
thicknessRatioForPatch_[pName] = thicknessRatio;
}
}
void refineBoundaryLayers::setMaxThicknessOfFirstLayerForPatch
(
const word& patchName,
const scalar maxThickness
)
{
if( maxThickness <= 0.0 )
{
WarningIn
(
"void refineBoundaryLayers::setGlobalMaxThicknessOfFirstLayer"
"(const word&, const scalar)"
) << "The specified maximum thickness of the first boundary layer "
<< "for patch " << patchName << " is negative!!" << endl;
return;
}
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
const word pName = mesh_.getPatchName(matchedIDs[matchI]);
maxThicknessForPatch_[pName] = maxThickness;
}
}
void refineBoundaryLayers::setInteruptForPatch(const word& patchName)
{
const labelList matchedIDs = mesh_.findPatches(patchName);
forAll(matchedIDs, matchI)
{
const word pName = mesh_.getPatchName(matchedIDs[matchI]);
discontinuousLayersForPatch_.insert(pName);
}
}
void refineBoundaryLayers::refineLayers()
{
bool refinePatch(false);
for
(
std::map<word, label>::const_iterator it=numLayersForPatch_.begin();
it!=numLayersForPatch_.end();
++it
)
if( it->second > 1 )
refinePatch = true;
if( (globalNumLayers_ < 2) && !refinePatch )
return;
Info << "Starting refining boundary layers" << endl;
if( done_ )
{
WarningIn
(
"void refineBoundaryLayers::refineLayers()"
) << "Boundary layers are already refined! Stopping refinement" << endl;
return;
}
analyseLayers();
if( !findSplitEdges() )
{
WarningIn
(
"void refineBoundaryLayers::refineLayers()"
) << "Boundary layers do not exist in the mesh! Cannot refine" << endl;
return;
}
generateNewVertices();
generateNewFaces();
generateNewCells();
done_ = true;
Info << "Finished refining boundary layers" << endl;
}
void refineBoundaryLayers::readSettings
(
const dictionary& meshDict,
refineBoundaryLayers& refLayers
)
{
if( meshDict.isDict("boundaryLayers") )
{
const dictionary& bndLayers = meshDict.subDict("boundaryLayers");
//- read global properties
if( bndLayers.found("nLayers") )
{
const label nLayers = readLabel(bndLayers.lookup("nLayers"));
refLayers.setGlobalNumberOfLayers(nLayers);
}
if( bndLayers.found("thicknessRatio") )
{
const scalar ratio = readScalar(bndLayers.lookup("thicknessRatio"));
refLayers.setGlobalThicknessRatio(ratio);
}
if( bndLayers.found("maxFirstLayerThickness") )
{
const scalar maxFirstThickness =
readScalar(bndLayers.lookup("maxFirstLayerThickness"));
refLayers.setGlobalMaxThicknessOfFirstLayer(maxFirstThickness);
}
//- patch-based properties
if( bndLayers.isDict("patchBoundaryLayers") )
{
const dictionary& patchBndLayers =
bndLayers.subDict("patchBoundaryLayers");
const wordList patchNames = patchBndLayers.toc();
forAll(patchNames, patchI)
{
const word pName = patchNames[patchI];
if( patchBndLayers.isDict(pName) )
{
const dictionary& patchDict =
patchBndLayers.subDict(pName);
if( patchDict.found("nLayers") )
{
const label nLayers =
readLabel(patchDict.lookup("nLayers"));
refLayers.setNumberOfLayersForPatch(pName, nLayers);
}
if( patchDict.found("thicknessRatio") )
{
const scalar ratio =
readScalar(patchDict.lookup("thicknessRatio"));
refLayers.setThicknessRatioForPatch(pName, ratio);
}
if( patchDict.found("maxFirstLayerThickness") )
{
const scalar maxFirstThickness =
readScalar
(
patchDict.lookup("maxFirstLayerThickness")
);
refLayers.setMaxThicknessOfFirstLayerForPatch
(
pName,
maxFirstThickness
);
}
if( patchDict.found("allowDiscontinuity") )
{
const bool allowDiscontinuity =
readBool(patchDict.lookup("allowDiscontinuity"));
if( allowDiscontinuity )
refLayers.setInteruptForPatch(pName);
}
}
else
{
Warning << "Cannot refine layer for patch "
<< patchNames[patchI] << endl;
}
}
}
}
else
{
//- the layer will not be refined
refLayers.avoidRefinement();
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,408 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
refineBoundaryLayers
Description
Refine existing boundary layers
SourceFiles
refineBoundaryLayers.C
refineBoundaryLayersFunctions.C
\*---------------------------------------------------------------------------*/
#ifndef refineBoundaryLayers_H
#define refineBoundaryLayers_H
#include "objectRegistry.H"
#include "foamTime.H"
#include "polyMeshGenModifier.H"
#include "meshSurfaceEngine.H"
#include "DynList.H"
#include "labelLongList.H"
#include "labelPair.H"
#include <map>
#include <set>
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
class meshSurfaceEngine;
/*---------------------------------------------------------------------------*\
Class refineBoundaryLayers Declaration
\*---------------------------------------------------------------------------*/
class refineBoundaryLayers
{
//- Reference to the mesh
polyMeshGen& mesh_;
//- pointer to mesh surface engine
mutable meshSurfaceEngine* msePtr_;
//- global number of boundary layers
label globalNumLayers_;
//- global thickness ratio
scalar globalThicknessRatio_;
//- global maximum thickness of the first layer
scalar globalMaxThicknessFirstLayer_;
//- number of boundary layers for user-selected patches
std::map<word, label> numLayersForPatch_;
//- local thickness ratio for selected patches
std::map<word, scalar> thicknessRatioForPatch_;
//- local maximum layer thickness for selected patches
std::map<word, scalar> maxThicknessForPatch_;
//- allow discontinuous layers for patch
std::set<word> discontinuousLayersForPatch_;
//- check whether the refinement is already executed
bool done_;
//- a flag whether a 2D mesh generation is active or not
bool is2DMesh_;
//- information about existing boundary layers at patches
//- only available layers
labelList layerAtPatch_;
//- which patches are part of a single layer
List<DynList<word> > patchesInLayer_;
//- a containing the number of layers which shall be generated above
//- a boundary face
labelList nLayersAtBndFace_;
//- a list of edges which shall be refined
LongList<edge> splitEdges_;
//- split edges at point
VRWGraph splitEdgesAtPoint_;
//- new vertices for on edges which shall be refined
VRWGraph newVerticesForSplitEdge_;
//- a graph containing information which new faces were generated
//- from an existing face
VRWGraph facesFromFace_;
//- a graph containing faces after layer refinement
VRWGraph newFaces_;
// Private member functions
//- Return reference to meshSurfaceEngine
const meshSurfaceEngine& surfaceEngine() const;
//- analyse layers to check their topology
void analyseLayers();
//- calculate addressing for a boundary cell
void calculateAddressing
(
const label bfI,
label& baseFace,
DynList<edge, 48>& edges,
DynList<DynList<label, 2>, 48>& edgeFaces,
DynList<DynList<label, 10>, 24>& faceEdges
) const;
//- find bnd layer hairs for a boundary face
bool findHairsForFace(const label, DynList<edge>&) const;
//- find edges which shall be split due to refinement
bool findSplitEdges();
//- generate new points on edges, faces and in cells
void generateNewVertices();
//- refine a given face and return the new faces
//- generates new points at cross-split faces
void refineFace
(
const face& f,
const FixedList<label, 2>& nLayersInDirection,
DynList<DynList<label, 4>, 128>& newFaces
);
//- generate a matrix of points generated by splitting a face
//- and return them in the local i, j system of the face
void sortFacePoints
(
const label faceI,
DynList<DynList<label> >& facePoints,
const label transpose = false
) const;
//- generate a matrix of faces generated by splitting a face
//- and return them in the local i, j, system of the face
void sortFaceFaces
(
const label faceI,
DynList<DynList<label> >& faceFaces,
const label transpose = false
) const;
//- map split edges onto a cell
void generateNewFaces();
//- generate new cells for a prism with one boundary face
void generateNewCellsPrism
(
const label cellI,
DynList<DynList<DynList<label, 8>, 10> >& cellsFromCell
);
//- a helper function which stores faces generated from
//- an existing face into new cells
void storeFacesIntoCells
(
const label faceI,
const bool reverseOrientation,
const label normalDirection,
const bool maxCoordinate,
const label nLayersI,
const label nLayersJ,
const label nLayersK,
DynList<DynList<DynList<label, 4>, 6>, 256>& cellsFromCell
) const;
//- generate new cells and add them to the mesh
void generateNewCells();
// Nested classes
class refineEdgeHexCell
{
// Private data
//- label of cell
const label cellI_;
//- number of cells in local direction i
label nLayersI_;
//- number of cells in locatiol direction j
label nLayersJ_;
//- container for new cells
DynList<DynList<DynList<label, 4>, 6>, 256> cellsFromCell_;
//- reference to the boundary layer class
refineBoundaryLayers& bndLayers_;
//- faces sorted into directions of a hex shape
FixedList<label, 6> faceInDirection_;
//- information about orientation of faces
//- false means the orientation as expected
//- true means wrong orientation
FixedList<bool, 6> faceOrientation_;
//- points on cross-split faces
FixedList<DynList<DynList<label> >, 2> cellPoints_;
// Private member functions
//- populate faceInDirection_nad wrongFaceOrientation_
void determineFacesInDirections();
//- populate new cells with new faces generated from already
//- existing faces
void populateExistingFaces();
//- generate new internal faces and tore them to new cells
void generateMissingFaces();
public:
// Constructor
//- construct from cell label and the refineBoundaryLayers
refineEdgeHexCell(const label cellI, refineBoundaryLayers& ref);
// Public member functions
inline const DynList<DynList<DynList<label, 4>, 6>, 256>&
newCells() const
{
return cellsFromCell_;
}
};
class refineCornerHexCell
{
// Private data
//- label of cell
const label cellI_;
//- number of cells in local direction i
label nLayersI_;
//- number of cells in local direction j
label nLayersJ_;
//- number of cells in local direction k
label nLayersK_;
//- split edge in directions
FixedList<label, 3> splitEdgeInDirection_;
//- container for new cells
DynList<DynList<DynList<label, 4>, 6>, 256> cellsFromCell_;
//- reference to the boundary layer class
refineBoundaryLayers& bndLayers_;
//- faces sorted into directions of a hex shape
FixedList<label, 6> faceInDirection_;
//- information about orientation of faces
//- false means the orientation as expected
//- true means wrong orientation
FixedList<bool, 6> faceOrientation_;
//- points on cross-split faces
FixedList<DynList<DynList<label> >, 6> facePoints_;
//- points inside the cell
DynList<DynList<DynList<label> > > cellPoints_;
// Private member functions
//- populate faceInDirection_nad wrongFaceOrientation_
void determineFacesInDirections();
//- populate new cells with new faces generated from already
//- existing faces
void populateExistingFaces();
//- generate missing points inside the cell
void generateNewPoints();
//- generate new internal faces and tore them to new cells
void generateMissingFaces();
public:
// Constructor
//- construct from cell label and the refineBoundaryLayers
refineCornerHexCell
(
const label cellI,
refineBoundaryLayers& ref
);
// Public member functions
inline const DynList<DynList<DynList<label, 4>, 6>, 256>&
newCells() const
{
return cellsFromCell_;
}
};
// Private member functions
//- Disallow bitwise copy construct
refineBoundaryLayers(const refineBoundaryLayers&);
//- Disallow bitwise assignment
void operator=(const refineBoundaryLayers&);
public:
// Constructors
//- Construct from mesh reference
refineBoundaryLayers(polyMeshGen& mesh);
// Destructor
~refineBoundaryLayers();
// Public member functions
//- set no refinement flag
void avoidRefinement();
//- activate 2D layer refinement
void activate2DMode();
//- set the global number of boundary layers
void setGlobalNumberOfLayers(const label nLayers);
//- set the global thickness ratio (default is 1)
void setGlobalThicknessRatio(const scalar thicknessRatio);
//- set the maximum thickness of the first boundary layer
void setGlobalMaxThicknessOfFirstLayer(const scalar maxThickness);
//- set the number of layers for a patch
//- the settings override the global settings
void setNumberOfLayersForPatch
(
const word& patchName,
const label nLayers
);
//- set the thickness ratio for a patch
//- it overrides the global settings
void setThicknessRatioForPatch
(
const word& patchName,
const scalar thicknessRatio
);
//- set the maximum thickness of the first layer for a patch
void setMaxThicknessOfFirstLayerForPatch
(
const word& patchName,
const scalar maxThickness
);
//- set whether the settings for a given patch are valid for the
//- patch only, or whether they extend over th whole sheet
//- the selected patch belongs to
//- the default behaviour is to apply the patch settings to the whole
//- sheet
void setInteruptForPatch(const word& patchName);
//- performs refinement based on the given settings
void refineLayers();
//- read the settings from dictionary
static void readSettings(const dictionary&, refineBoundaryLayers&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -37,7 +37,7 @@ SourceFiles
#define refineBoundaryLayers_H #define refineBoundaryLayers_H
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
#include "meshSurfaceEngine.H" #include "meshSurfaceEngine.H"
#include "DynList.H" #include "DynList.H"

View file

@ -37,7 +37,7 @@ SourceFiles
#define triangulateNonPlanarBaseFaces_H #define triangulateNonPlanarBaseFaces_H
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "polyMeshGenModifier.H" #include "polyMeshGenModifier.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -38,7 +38,7 @@ SourceFiles
#define workflowControls_H #define workflowControls_H
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "DynList.H" #include "DynList.H"

View file

@ -29,7 +29,7 @@ Description
#include "triSurf.H" #include "triSurf.H"
#include "demandDrivenData.H" #include "demandDrivenData.H"
#include "objectRegistry.H" #include "objectRegistry.H"
#include "Time.H" #include "foamTime.H"
#include "meshOctreeCreator.H" #include "meshOctreeCreator.H"
#include "voronoiMeshExtractor.H" #include "voronoiMeshExtractor.H"
#include "meshSurfaceEngine.H" #include "meshSurfaceEngine.H"