Commit b4ee75c4 authored by franjo's avatar franjo
Browse files

Switched to in-house surface mesh suitable for modification


git-svn-id: https://pl5.projectlocker.com/igui/meshGeneration/svn@6 fdcce57e-7e00-11e2-b579-49867b4cea03
parent e435aa61
......@@ -25,6 +25,9 @@ hexHelpers = utilities/hexahedra/hexHelpers
intersectionTools = utilities/intersectionTools
findCellsIntersectingSurface = $(intersectionTools)/findCellsIntersectingSurface
nonManifoldMeshing = utilities/nonManifoldMeshing
findNonManifoldInterfaces = $(nonManifoldMeshing)/findNonManifoldInterfaces
meshOptimizer = utilities/smoothers/geometry/meshOptimizer
tetMeshOptimisation = $(meshOptimizer)/tetMeshOptimisation
simplexSmoother = $(tetMeshOptimisation)/advancedSmoothers/simplexSmoother
......@@ -182,11 +185,17 @@ $(partTetMesh)/partTetMeshParallelAddressing.C
$(partTetMesh)/partTetMeshSimplex.C
$(triSurf)/triSurf.C
$(triSurf)/triSurfPoints.C
$(triSurf)/triSurfFacets.C
$(triSurf)/triSurfAddressing.C
$(triSurf)/triSurfModifier.C
$(hexHelpers)/hexHelpers.C
$(findCellsIntersectingSurface)/findCellsIntersectingSurface.C
$(findNonManifoldInterfaces)/findNonManifoldInterfaces.C
$(tetrahedra)/tessellationElement.C
$(tetrahedra)/tetTessellation.C
$(tetrahedra)/tetTessellationFunctions.C
......
EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude -g -ggdb -DFULLDEBUG -O0
/* EXE_LIBS = -lcfdTools */
......@@ -62,20 +62,20 @@ namespace Foam
{
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
void cartesianMeshGenerator::createCartesianMesh()
{
//- create polyMesh from octree boxes
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
if( meshDict_.found("decomposePolyhedraIntoTetsAndPyrs") )
{
if( readBool(meshDict_.lookup("decomposePolyhedraIntoTetsAndPyrs")) )
cme.decomposeSplitHexes();
}
cme.createMesh();
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -86,7 +86,7 @@ void cartesianMeshGenerator::createCartesianMesh()
//::exit(EXIT_FAILURE);
# endif
}
void cartesianMeshGenerator::surfacePreparation()
{
//- removes unnecessary cells and morph the boundary
......@@ -99,7 +99,7 @@ void cartesianMeshGenerator::surfacePreparation()
deleteDemandDrivenData(cmPtr);
} while( topologicalCleaner(mesh_).cleanTopology() );
*/
bool changed;
do
{
......@@ -108,16 +108,16 @@ void cartesianMeshGenerator::surfacePreparation()
checkIrregularSurfaceConnections checkConnections(mesh_);
if( checkConnections.checkAndFixIrregularConnections() )
changed = true;
if( checkNonMappableCellConnections(mesh_).removeCells() )
changed = true;
if( checkCellConnectionsOverFaces(mesh_).checkCellGroups() )
changed = true;
} while( changed );
checkBoundaryFacesSharingTwoEdges(mesh_).improveTopology();
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -128,16 +128,16 @@ void cartesianMeshGenerator::surfacePreparation()
//::exit(EXIT_FAILURE);
# endif
}
void cartesianMeshGenerator::mapMeshToSurface()
{
//- calculate mesh surface
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
//- pre-map mesh surface
meshSurfaceMapper mapper(*msePtr, *octreePtr_);
mapper.preMapVertices();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_, "preMappedMesh");
......@@ -147,10 +147,10 @@ void cartesianMeshGenerator::mapMeshToSurface()
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
//- map mesh surface on the geometry surface
//- map mesh surface on the geometry surface
mapper.mapVerticesOntoSurface();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_, "afterMapping");
......@@ -160,10 +160,10 @@ void cartesianMeshGenerator::mapMeshToSurface()
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
//- untangle surface faces
meshSurfaceOptimizer(*msePtr, *octreePtr_).preOptimizeSurface();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_, "afterSurfaceSmoothing");
......@@ -173,14 +173,14 @@ void cartesianMeshGenerator::mapMeshToSurface()
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
deleteDemandDrivenData(msePtr);
}
void cartesianMeshGenerator::mapEdgesAndCorners()
{
meshSurfaceEdgeExtractorNonTopo(mesh_, *octreePtr_);
# ifdef DEBUG
mesh_.write();
//meshOptimizer(*octreePtr_, mesh_).preOptimize();
......@@ -197,7 +197,7 @@ void cartesianMeshGenerator::optimiseMeshSurface()
{
meshSurfaceEngine mse(mesh_);
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -208,15 +208,15 @@ void cartesianMeshGenerator::optimiseMeshSurface()
//::exit(EXIT_FAILURE);
# endif
}
void cartesianMeshGenerator::generateBoudaryLayers()
{
boundaryLayers bl(mesh_);
if( meshDict_.found("boundaryLayers") )
{
wordList createLayers(meshDict_.lookup("boundaryLayers"));
forAll(createLayers, patchI)
bl.addLayerForPatch(createLayers[patchI]);
}
......@@ -225,29 +225,29 @@ void cartesianMeshGenerator::generateBoudaryLayers()
//bl.createOTopologyLayers();
bl.addLayerForAllPatches();
}
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_, "meshWithBndLayer");
# else
# else
writeMeshEnsight(mesh_, "meshWithBndLayer");
# endif
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
}
void cartesianMeshGenerator::optimiseFinalMesh()
{
//- final optimisation
meshOptimizer optimizer(mesh_);
optimizer.optimizeSurface(*octreePtr_);
deleteDemandDrivenData(octreePtr_);
optimizer.optimizeMeshFV();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_,"optimisedMesh");
......@@ -260,7 +260,7 @@ void cartesianMeshGenerator::optimiseFinalMesh()
void cartesianMeshGenerator::replaceBoundaries()
{
renameBoundaryPatches rbp(mesh_, meshDict_);
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_,"renamedPatchesMesh");
......@@ -273,7 +273,7 @@ void cartesianMeshGenerator::replaceBoundaries()
void cartesianMeshGenerator::renumberMesh()
{
polyMeshGenModifier(mesh_).renumberMesh();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_,"renumberedMesh");
......@@ -282,25 +282,25 @@ void cartesianMeshGenerator::renumberMesh()
#endif
# endif
}
void cartesianMeshGenerator::generateMesh()
{
createCartesianMesh();
surfacePreparation();
mapMeshToSurface();
mapEdgesAndCorners();
optimiseMeshSurface();
generateBoudaryLayers();
optimiseFinalMesh();
renumberMesh();
replaceBoundaries();
}
......@@ -329,23 +329,23 @@ cartesianMeshGenerator::cartesianMeshGenerator(const Time& time)
{
checkMeshDict cmd(meshDict_);
}
fileName surfaceFile = meshDict_.lookup("surfaceFile");
if( Pstream::parRun() )
surfaceFile = ".."/surfaceFile;
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
if( meshDict_.found("subsetFileName") )
{
fileName subsetFileName = meshDict_.lookup("subsetFileName");
if( Pstream::parRun() )
subsetFileName = ".."/subsetFileName;
surfacePtr_->readFaceSubsets(db_.path()/subsetFileName);
}
// if( meshDict_.found("subsetFileName") )
// {
// fileName subsetFileName = meshDict_.lookup("subsetFileName");
// if( Pstream::parRun() )
// subsetFileName = ".."/subsetFileName;
// surfacePtr_->readFaceSubsets(db_.path()/subsetFileName);
// }
octreePtr_ = new meshOctree(*surfacePtr_);
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
......@@ -395,7 +395,7 @@ cartesianMeshGenerator::~cartesianMeshGenerator()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesianMeshGenerator::writeMesh() const
{
{
mesh_.write();
}
......
......@@ -64,7 +64,7 @@ void dualMeshGenerator::generateDualMesh()
//- create polyMesh from octree boxes
dualMeshExtractor dme(*octreePtr_, meshDict_, mesh_);
dme.createMesh();
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -87,7 +87,7 @@ void dualMeshGenerator::surfacePreparation()
cmPtr->morphMesh();
deleteDemandDrivenData(cmPtr);
} while( topologicalCleaner(mesh_).cleanTopology() );
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -98,7 +98,7 @@ void dualMeshGenerator::surfacePreparation()
//::exit(EXIT_FAILURE);
# endif
}
void dualMeshGenerator::mapMeshToSurface()
{
//- calculate mesh surface
......@@ -106,7 +106,7 @@ void dualMeshGenerator::mapMeshToSurface()
//- map mesh surface on the geometry surface
meshSurfaceMapper(*msePtr, *octreePtr_).mapVerticesOntoSurface();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_, "afterMapping");
......@@ -116,10 +116,10 @@ void dualMeshGenerator::mapMeshToSurface()
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
//- untangle surface faces
meshSurfaceOptimizer(*msePtr, *octreePtr_).preOptimizeSurface();
# ifdef DEBUG
//meshOptimizer(*octreePtr_, mesh_).preOptimize();
# ifdef DEBUGfpma
......@@ -130,12 +130,12 @@ void dualMeshGenerator::mapMeshToSurface()
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
deleteDemandDrivenData(msePtr);
//- extract edges and corners
meshSurfaceEdgeExtractorNonTopo(mesh_, *octreePtr_);
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -151,7 +151,7 @@ void dualMeshGenerator::optimiseMeshSurface()
{
meshSurfaceEngine mse(mesh_);
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGfpma
......@@ -169,10 +169,10 @@ void dualMeshGenerator::checkConcaveEdges()
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
meshSurfaceOptimizer(*msePtr, *octreePtr_).optimizeSurface();
deleteDemandDrivenData(msePtr);
//- repair mesh near concave edges
dualUnfoldConcaveCells(mesh_, *octreePtr_).unfoldInvalidCells();
# ifdef DEBUG
mesh_.write();
//meshOptimizer(*octreePtr_, mesh_).preOptimize();
......@@ -184,15 +184,15 @@ void dualMeshGenerator::checkConcaveEdges()
//::exit(EXIT_FAILURE);
# endif
}
void dualMeshGenerator::generateBoudaryLayers()
{
boundaryLayers bl(mesh_);
if( meshDict_.found("boundaryLayers") )
{
wordList createLayers(meshDict_.lookup("boundaryLayers"));
forAll(createLayers, patchI)
bl.addLayerForPatch(createLayers[patchI]);
}
......@@ -201,7 +201,7 @@ void dualMeshGenerator::generateBoudaryLayers()
//bl.createOTopologyLayers();
bl.addLayerForAllPatches();
}
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_, "meshWithBndLayer");
......@@ -212,18 +212,18 @@ void dualMeshGenerator::generateBoudaryLayers()
//::exit(EXIT_FAILURE);
# endif
}
void dualMeshGenerator::optimiseFinalMesh()
{
//- final optimisation
meshOptimizer optimizer(mesh_);
optimizer.optimizeSurface(*octreePtr_);
deleteDemandDrivenData(octreePtr_);
optimizer.optimizeMeshFV();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_,"optimisedMesh");
......@@ -236,7 +236,7 @@ void dualMeshGenerator::optimiseFinalMesh()
void dualMeshGenerator::replaceBoundaries()
{
renameBoundaryPatches rbp(mesh_, meshDict_);
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_,"renamedPatchesMesh");
......@@ -249,7 +249,7 @@ void dualMeshGenerator::replaceBoundaries()
void dualMeshGenerator::renumberMesh()
{
polyMeshGenModifier(mesh_).renumberMesh();
# ifdef DEBUG
# ifdef DEBUGfpma
writeMeshFPMA(mesh_,"renumberedMesh");
......@@ -262,21 +262,21 @@ void dualMeshGenerator::renumberMesh()
void dualMeshGenerator::generateMesh()
{
generateDualMesh();
surfacePreparation();
mapMeshToSurface();
optimiseMeshSurface();
checkConcaveEdges();
generateBoudaryLayers();
optimiseFinalMesh();
renumberMesh();
replaceBoundaries();
}
......@@ -306,19 +306,19 @@ dualMeshGenerator::dualMeshGenerator
{
if( true )
checkMeshDict cmd(meshDict_);
const fileName surfaceFile = meshDict_.lookup("surfaceFile");
surfacePtr_ = new triSurf(runTime_.path()/surfaceFile);
if( meshDict_.found("subsetFileName") )
{
const fileName subsetFileName = meshDict_.lookup("subsetFileName");
surfacePtr_->readFaceSubsets(runTime_.path()/subsetFileName);
}
// if( meshDict_.found("subsetFileName") )
// {
// const fileName subsetFileName = meshDict_.lookup("subsetFileName");
// surfacePtr_->readFaceSubsets(runTime_.path()/subsetFileName);
// }
octreePtr_ = new meshOctree(*surfacePtr_);
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
......@@ -352,7 +352,7 @@ dualMeshGenerator::dualMeshGenerator
surfacePtr_ = new triSurface(db_.path()/surfaceFile);
octreePtr_ = new meshOctree(*surfacePtr_);
meshOctreeCreator(*octreePtr_, meshDict_).createOctreeBoxes();
generateMesh();
......@@ -375,7 +375,7 @@ void dualMeshGenerator::writeMesh() const
mesh_.addressingData().checkCellsZipUp(true);
mesh_.addressingData().checkCellVolumes(true);
# endif
mesh_.write();
}
......
......@@ -64,7 +64,7 @@ void hexMeshGenerator::generateOctree()
{
if( !octreePtr_ )
octreePtr_ = new meshOctree(*surfacePtr_);
meshOctreeCreator creator(*octreePtr_, meshDict_);
creator.activateHexRefinement();
creator.createOctreeBoxes();
......@@ -100,10 +100,10 @@ void hexMeshGenerator::surfacePreparation()
checkIrregularSurfaceConnections checkConnections(mesh_);
if( checkConnections.checkAndFixIrregularConnections() )
changed = true;
if( checkNonMappableCellConnections(mesh_).removeCells() )
changed = true;
if( checkCellConnectionsOverFaces(mesh_).checkCellGroups() )
changed = true;
} while( changed );
......@@ -118,7 +118,7 @@ void hexMeshGenerator::surfacePreparation()
//::exit(EXIT_FAILURE);
# endif
}
void hexMeshGenerator::mapMeshToSurface()
{
//- calculate mesh surface
......@@ -152,12 +152,12 @@ void hexMeshGenerator::mapMeshToSurface()
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
deleteDemandDrivenData(msePtr);
//- extract edges and corners
meshSurfaceEdgeExtractorFUN(mesh_, *octreePtr_);
# ifdef DEBUG
mesh_.write();
# ifdef DEBUGflma
......@@ -173,7 +173,7 @@ void hexMeshGenerator::optimiseMeshSurface()
{
meshSurfaceEngine mse(mesh_);