Commit 905f7b89 authored by Franjo's avatar Franjo

Removed unnecessary stuff for the first release

parent 1a79ee2a
This diff is collapsed.
......@@ -46,7 +46,6 @@ Description
#include "checkIrregularSurfaceConnections.H"
#include "checkNonMappableCellConnections.H"
#include "checkBoundaryFacesSharingTwoEdges.H"
#include "removeCellsInSelectedDomains.H"
//#define DEBUG
......@@ -78,37 +77,6 @@ void cartesianMeshGenerator::createCartesianMesh()
void cartesianMeshGenerator::surfacePreparation()
{
//- remove cells inside the domains specified by the user
if( meshDict_.found("removeDomains") )
{
if( Pstream::parRun() )
{
WarningIn
(
"void cartesianMeshGenerator::surfacePreparation()"
) << "The feature removeDomains is not availabel for MPI runs"
<< exit(FatalError);
}
const dictionary& dict = meshDict_.subDict("removeDomains");
const wordList domainNames = dict.toc();
mesh_.clearAddressingData();
removeCellsInSelectedDomains rCells(mesh_, *octreePtr_);
//- read the patches/subsets forming this domain
forAll(domainNames, domainI)
{
wordList domainParts(dict.lookup(domainNames[domainI]));
rCells.selectCellsInDomain(domainParts);
}
rCells.removeCells();
}
//- removes unnecessary cells and morph the boundary
//- such that there is only one boundary face per cell
//- It also checks topology of cells after morphing is performed
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "hexMeshExtractor.H"
#include "meshOctree.H"
//#define DEBUGDual
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void hexMeshExtractor::clearOut()
{
deleteDemandDrivenData(centreNodeLabelPtr_);
deleteDemandDrivenData(subVerticesPtr_);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from octree and mesh data
hexMeshExtractor::hexMeshExtractor
(
const meshOctree& octree,
const IOdictionary& dict,
polyMeshGen& mesh
)
:
octreeAddressing_(octree, dict),
mesh_(mesh),
centreNodeLabelPtr_(NULL),
subVerticesPtr_(NULL),
octreeVertexType_()
{
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
hexMeshExtractor::~hexMeshExtractor()
{
clearOut();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void hexMeshExtractor::createMesh()
{
Info << "Extracting hex mesh" << endl;
classifyOctreePoints();
createPoints();
createHexMesh();
polyMeshGenModifier(mesh_).removeUnusedVertices();
polyMeshGenModifier(mesh_).reorderBoundaryFaces();
Info << "Mesh has :" << nl
<< mesh_.points().size() << " vertices " << nl
<< mesh_.faces().size() << " faces" << nl
<< mesh_.cells().size() << " cells" << endl;
Info << "Finished extracting hex template" << endl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Class
hexMeshExtractor
Description
Extracts hex mesh from the octree
SourceFiles
hexMeshExtractor.C
\*---------------------------------------------------------------------------*/
#ifndef hexMeshExtractor_H
#define hexMeshExtractor_H
#include "polyMeshGenModifier.H"
#include "meshOctreeAddressing.H"
#include "polyMeshGenModifierAddCellByCell.H"
#include "meshOctree.H"
#include "DynList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class hexMeshExtractor Declaration
\*---------------------------------------------------------------------------*/
class hexMeshExtractor
{
// Private data
//- octree and addressing
meshOctreeAddressing octreeAddressing_;
//- reference to the mesh
polyMeshGen& mesh_;
//- centre node labels
labelLongList* centreNodeLabelPtr_;
//- subvertices generated inside octree leaves
VRWGraph* subVerticesPtr_;
//- vertex type and its orientation
List<direction> octreeVertexType_;
// Private member functions
//- delete freestore data
void clearOut();
//- classify octree points (CORNER, EDGECENTRE, FACECENTRE)
void classifyOctreePoints();
//- create mesh points and pointLeaves addressing
void createPoints();
//- create mesh data
void createHexMesh();
//- create hexes from FACECENTRE points
//void createFaceCentreHexes();
//- create hexes which are dual of octree points
//void createHexesAtOctreePoints();
//- create hexes from octree edges which contains octree cubes
//- at the same level, and a point at a greater level than the cubes
//void createEdgeHexes();
// Nested classes
class createHexCells
{
// Private data
//- mesh modifier
polyMeshGenModifierAddCellByCell meshModifier_;
//- const reference to the octree
const meshOctree& octree_;
//- centre node labels
const labelLongList& centreNodeLabel_;
//- subvertices generated inside octree leaves
const VRWGraph& subVertices_;
//- vertex type and its orientation
const List<direction>& octreeVertexType_;
//- node labels of octree cubes
const VRWGraph& nodeLabels_;
//- leaves at octree nodes
const FRWGraph<label, 8>& nodeLeaves_;
//- mapping between Z-order and cylic order of points in face
FixedList<label, 4> mapping_;
// Private member functions
//- create hexes from FACECENTRE points
inline void createFaceCentreHexes(const label pointI);
//- create hexes which are dual of octree points
inline void createHexesAtOctreePoints(const label pointI);
//- create hexes from octree edges which is contained in
//- octree cubes at the same level, and a point
//- at a greater level than the cubes
inline void createEdgeHexes(const label pointI);
//- create cell faces and add it to the mesh
inline void addHexCell(const FixedList<label, 8>& cellPoints);
// Private copy constructor
//- Disallow default bitwise copy construct
createHexCells(const createHexCells&);
//- Disallow default bitwise assignment
void operator=(const createHexCells&);
public:
// Constructors
createHexCells
(
polyMeshGen& mesh,
const meshOctree& octree,
const labelLongList& centreNodeLabel,
const VRWGraph& subVertices,
const List<direction>& octreeVertexType,
const VRWGraph& nodeLabels,
const FRWGraph<label, 8>& nodeLeaves
);
// Destructor
~createHexCells();
// Public member functions
//- create hex cells which are the dual of the octree points
void generateCells();
};
// Enumerators
enum typeOfVertex_
{
NONE = 0,
CORNER = 1,
NOSUBVERTICES = 2,
FACECENTRE = 4,
BOUNDARY = 8,
MIXED = 16
};
// Private copy constructor
//- Disallow default bitwise copy construct
hexMeshExtractor(const hexMeshExtractor&);
//- Disallow default bitwise assignment
void operator=(const hexMeshExtractor&);
public:
// Constructors
//- Construct from octree and mesh data
hexMeshExtractor
(
const meshOctree& octree,
const IOdictionary& dict,
polyMeshGen& mesh
);
// Destructor
~hexMeshExtractor();
// Member Functions
void createMesh();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "hexMeshExtractorI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh 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.
cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "hexMeshGenerator.H"
#include "triSurf.H"
#include "demandDrivenData.H"
#include "Time.H"
#include "meshOctreeCreator.H"
#include "hexMeshExtractor.H"
#include "meshSurfaceEngine.H"
#include "meshSurfaceMapper.H"
#include "meshSurfaceEdgeExtractorFUN.H"
#include "checkCellConnectionsOverFaces.H"
#include "checkIrregularSurfaceConnections.H"
#include "checkNonMappableCellConnections.H"
#include "meshOptimizer.H"
#include "meshSurfaceOptimizer.H"
#include "topologicalCleaner.H"
#include "boundaryLayers.H"
#include "renameBoundaryPatches.H"
#include "checkMeshDict.H"
#include "triSurfacePatchManipulator.H"
#include "refineBoundaryLayers.H"
//#define DEBUG
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
void hexMeshGenerator::generateOctree()
{
if( !octreePtr_ )
octreePtr_ = new meshOctree(*surfacePtr_);
meshOctreeCreator creator(*octreePtr_, meshDict_);
creator.activateHexRefinement();
creator.createOctreeBoxes();
}
void hexMeshGenerator::generateDualMesh()
{
//- create polyMesh from octree boxes
hexMeshExtractor dme(*octreePtr_, meshDict_, mesh_);
dme.createMesh();
# ifdef DEBUG
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
}
void hexMeshGenerator::surfacePreparation()
{
//- removes unnecessary cells which create non-manifold surfaces
//- and the cells which connect two clusters of cells
//- and make sure all cells make a single cluster of cells
bool changed;
do
{
changed = false;
checkIrregularSurfaceConnections checkConnections(mesh_);
if( checkConnections.checkAndFixIrregularConnections() )
changed = true;
if( checkNonMappableCellConnections(mesh_).removeCells() )
changed = true;
if( checkCellConnectionsOverFaces(mesh_).checkCellGroups() )
changed = true;
} while( changed );
# ifdef DEBUG
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
}
void hexMeshGenerator::mapMeshToSurface()
{
//- calculate mesh surface
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
//- map mesh surface on the geometry surface
meshSurfaceMapper mapper(*msePtr, *octreePtr_);
mapper.preMapVertices();
mapper.mapVerticesOntoSurface();
# ifdef DEBUG
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
//- untangle surface faces
meshSurfaceOptimizer(*msePtr, *octreePtr_).untangleSurface();
# ifdef DEBUG
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
deleteDemandDrivenData(msePtr);
//- extract edges and corners
meshSurfaceEdgeExtractorFUN(mesh_, *octreePtr_);
# ifdef DEBUG
mesh_.write();
//::exit(EXIT_FAILURE);
# endif
}
void hexMeshGenerator::optimiseMeshSurface()
{
meshSurfaceEngine mse(mesh_);
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
# ifdef DEBUG
mesh_.write();
//::exit(0);
# endif
}
void hexMeshGenerator::generateBoundaryLayers()
{
boundaryLayers bl(mesh_);
bl.addLayerForAllPatches();
# ifdef DEBUG
mesh_.write();
//::exit(0);
# endif
}
void hexMeshGenerator::refBoundaryLayers()
{
if( meshDict_.isDict("boundaryLayers") )
{
refineBoundaryLayers refLayers(mesh_);
refineBoundaryLayers::readSettings(meshDict_, refLayers);
refLayers.refineLayers();
meshOptimizer optimizer(mesh_);
optimizer.untangleMeshFV();
}
}
void hexMeshGenerator::optimiseFinalMesh()
{
//- final optimisation
meshOptimizer optimizer(mesh_);
optimizer.optimizeSurface(*octreePtr_);
deleteDemandDrivenData(octreePtr_);
optimizer.optimizeMeshFV();
# ifdef DEBUG
mesh_.write();
//::exit(0);
# endif
}
void hexMeshGenerator::replaceBoundaries()
{
renameBoundaryPatches rbp(mesh_, meshDict_);
# ifdef DEBUG
mesh_.write();
//::exit(0);
# endif
}
void hexMeshGenerator::renumberMesh()
{
polyMeshGenModifier(mesh_).renumberMesh();
# ifdef DEBUG
mesh_.write();
//::exit(0);
# endif
}
void hexMeshGenerator::generateMesh()
{
generateDualMesh();