Commit 4ab43afb authored by Mark Olesen's avatar Mark Olesen

STYLE: place code into generic Foam::Module namespace

- avoids potential collisions and allows easier migration of classes
  into OpenFOAM itself

- use fully-qualified names in implementation
parent d7a80eba
......@@ -40,13 +40,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
// 2d cartesian mesher cannot be run in parallel
argList::noParallel();
cartesian2DMeshGenerator cmg(runTime);
Module::cartesian2DMeshGenerator cmg(runTime);
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
<< "ClockTime = " << runTime.elapsedClockTime() << " s" << endl;
......
......@@ -40,10 +40,10 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
cartesianMeshGenerator cmg(runTime);
Module::cartesianMeshGenerator cmg(runTime);
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
<< "ClockTime = " << runTime.elapsedClockTime() << " s" << endl;
......
......@@ -38,13 +38,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
// Polyhedral mesher cannot be run in parallel yet
argList::noParallel();
voronoiMeshGenerator pmg(runTime);
Module::voronoiMeshGenerator pmg(runTime);
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
<< "ClockTime = " << runTime.elapsedClockTime() << endl;
......
......@@ -40,13 +40,13 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
// tetrahedral mesher cannot be run in parallel yet
argList::noParallel();
tetMeshGenerator tmg(runTime);
Module::tetMeshGenerator tmg(runTime);
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s\n"
<< "ClockTime = " << runTime.elapsedClockTime() << endl;
......
......@@ -49,15 +49,9 @@ License
#include "polyMeshGenGeometryModification.H"
#include "surfaceMeshGeometryModification.H"
//#define DEBUG
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
void cartesian2DMeshGenerator::createCartesianMesh()
void Foam::Module::cartesian2DMeshGenerator::createCartesianMesh()
{
// create polyMesh from octree boxes
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
......@@ -78,7 +72,7 @@ void cartesian2DMeshGenerator::createCartesianMesh()
}
void cartesian2DMeshGenerator::surfacePreparation()
void Foam::Module::cartesian2DMeshGenerator::surfacePreparation()
{
// removes unnecessary cells and morph the boundary
// such that there is only one boundary face per cell
......@@ -104,7 +98,7 @@ void cartesian2DMeshGenerator::surfacePreparation()
}
void cartesian2DMeshGenerator::mapMeshToSurface()
void Foam::Module::cartesian2DMeshGenerator::mapMeshToSurface()
{
// calculate mesh surface
meshSurfaceEngine* msePtr = new meshSurfaceEngine(mesh_);
......@@ -123,19 +117,19 @@ void cartesian2DMeshGenerator::mapMeshToSurface()
}
void cartesian2DMeshGenerator::extractPatches()
void Foam::Module::cartesian2DMeshGenerator::extractPatches()
{
meshSurfaceEdgeExtractor2D(mesh_, *octreePtr_).distributeBoundaryFaces();
}
void cartesian2DMeshGenerator::mapEdgesAndCorners()
void Foam::Module::cartesian2DMeshGenerator::mapEdgesAndCorners()
{
meshSurfaceEdgeExtractor2D(mesh_, *octreePtr_).remapBoundaryPoints();
}
void cartesian2DMeshGenerator::optimiseMeshSurface()
void Foam::Module::cartesian2DMeshGenerator::optimiseMeshSurface()
{
meshSurfaceEngine mse(mesh_);
meshSurfaceOptimizer optimizer(mse, *octreePtr_);
......@@ -144,7 +138,7 @@ void cartesian2DMeshGenerator::optimiseMeshSurface()
}
void cartesian2DMeshGenerator::generateBoundaryLayers()
void Foam::Module::cartesian2DMeshGenerator::generateBoundaryLayers()
{
boundaryLayers bl(mesh_);
......@@ -176,7 +170,7 @@ void cartesian2DMeshGenerator::generateBoundaryLayers()
}
void cartesian2DMeshGenerator::refBoundaryLayers()
void Foam::Module::cartesian2DMeshGenerator::refBoundaryLayers()
{
if (meshDict_.isDict("boundaryLayers"))
{
......@@ -196,19 +190,19 @@ void cartesian2DMeshGenerator::refBoundaryLayers()
}
void cartesian2DMeshGenerator::replaceBoundaries()
void Foam::Module::cartesian2DMeshGenerator::replaceBoundaries()
{
renameBoundaryPatches rbp(mesh_, meshDict_, true);
}
void cartesian2DMeshGenerator::renumberMesh()
void Foam::Module::cartesian2DMeshGenerator::renumberMesh()
{
polyMeshGenModifier(mesh_).renumberMesh();
}
void cartesian2DMeshGenerator::generateMesh()
void Foam::Module::cartesian2DMeshGenerator::generateMesh()
{
if (controller_.runCurrentStep("templateGeneration"))
{
......@@ -262,7 +256,10 @@ void cartesian2DMeshGenerator::generateMesh()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
Foam::Module::cartesian2DMeshGenerator::cartesian2DMeshGenerator
(
const Time& time
)
:
db_(time),
surfacePtr_(nullptr),
......@@ -291,7 +288,9 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
fileName surfaceFile = meshDict_.lookup("surfaceFile");
if (Pstream::parRun())
{
surfaceFile = ".."/surfaceFile;
}
surfacePtr_ = new triSurf(db_.path()/surfaceFile);
......@@ -367,7 +366,7 @@ cartesian2DMeshGenerator::cartesian2DMeshGenerator(const Time& time)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
cartesian2DMeshGenerator::~cartesian2DMeshGenerator()
Foam::Module::cartesian2DMeshGenerator::~cartesian2DMeshGenerator()
{
deleteDemandDrivenData(surfacePtr_);
deleteDemandDrivenData(modSurfacePtr_);
......@@ -377,14 +376,10 @@ cartesian2DMeshGenerator::~cartesian2DMeshGenerator()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesian2DMeshGenerator::writeMesh() const
void Foam::Module::cartesian2DMeshGenerator::writeMesh() const
{
mesh_.write();
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::cartesian2DMeshGenerator
Foam::Module::cartesian2DMeshGenerator
Description
Creates a 2D cartesian mesh from the quadtree
......@@ -44,10 +44,13 @@ SourceFiles
namespace Foam
{
// Forward declarations
class triSurf;
class meshOctree;
class Time;
namespace Module
{
class meshOctree;
class triSurf;
/*---------------------------------------------------------------------------*\
Class cartesian2DMeshGenerator Declaration
\*---------------------------------------------------------------------------*/
......@@ -138,6 +141,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Module
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -26,15 +26,9 @@ License
#include "cartesianMeshExtractor.H"
#include "meshOctree.H"
// #define DEBUGSearch
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesianMeshExtractor::clearOut()
void Foam::Module::cartesianMeshExtractor::clearOut()
{
deleteDemandDrivenData(leafCellLabelPtr_);
}
......@@ -42,7 +36,7 @@ void cartesianMeshExtractor::clearOut()
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
cartesianMeshExtractor::cartesianMeshExtractor
Foam::Module::cartesianMeshExtractor::cartesianMeshExtractor
(
meshOctree& octree,
const IOdictionary& meshDict,
......@@ -58,7 +52,7 @@ cartesianMeshExtractor::cartesianMeshExtractor
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
cartesianMeshExtractor::~cartesianMeshExtractor()
Foam::Module::cartesianMeshExtractor::~cartesianMeshExtractor()
{
clearOut();
}
......@@ -66,13 +60,13 @@ cartesianMeshExtractor::~cartesianMeshExtractor()
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesianMeshExtractor::decomposeSplitHexes()
void Foam::Module::cartesianMeshExtractor::decomposeSplitHexes()
{
decomposeSplitHexes_ = true;
}
void cartesianMeshExtractor::createMesh()
void Foam::Module::cartesianMeshExtractor::createMesh()
{
Info<< "Extracting polyMesh" << endl;
......@@ -114,8 +108,4 @@ void cartesianMeshExtractor::createMesh()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::cartesianMeshExtractor
Foam::Module::cartesianMeshExtractor
Description
Generates the cartesian mesh template from the octree
......@@ -44,6 +44,9 @@ namespace Foam
{
class IOdictionary;
namespace Module
{
/*---------------------------------------------------------------------------*\
Class cartesianMeshExtractor Declaration
\*---------------------------------------------------------------------------*/
......@@ -115,6 +118,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Module
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
......@@ -33,12 +33,8 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
void Foam::Module::cartesianMeshExtractor::
decomposeSplitHexesIntoTetsAndPyramids()
{
if (!decomposeSplitHexes_) return;
......@@ -102,8 +98,4 @@ void cartesianMeshExtractor::decomposeSplitHexesIntoTetsAndPyramids()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -28,12 +28,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesianMeshExtractor::createPointsAndAddressing()
void Foam::Module::cartesianMeshExtractor::createPointsAndAddressing()
{
Info<< "Creating octree vertices" << endl;
......@@ -53,8 +48,4 @@ void cartesianMeshExtractor::createPointsAndAddressing()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -41,12 +41,7 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
void cartesianMeshExtractor::createPolyMesh()
void Foam::Module::cartesianMeshExtractor::createPolyMesh()
{
Info<< "Creating polyMesh from octree" << endl;
......@@ -411,8 +406,4 @@ void cartesianMeshExtractor::createPolyMesh()
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
......@@ -50,13 +50,9 @@ License
//#define DEBUG
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * Private member functions * * * * * * * * * * * * //
void cartesianMeshGenerator::createCartesianMesh()
void Foam::Module::cartesianMeshGenerator::createCartesianMesh()
{
// create polyMesh from octree boxes
cartesianMeshExtractor cme(*octreePtr_, meshDict_, mesh_);
......@@ -77,7 +73,7 @@ void cartesianMeshGenerator::createCartesianMesh()
}
void cartesianMeshGenerator::surfacePreparation()
void Foam::Module::cartesianMeshGenerator::surfacePreparation()
{
// removes unnecessary cells and morph the boundary
// such that there is only one boundary face per cell
......@@ -103,7 +99,7 @@ void cartesianMeshGenerator::surfacePreparation()
}
void cartesianMeshGenerator::mapMeshToSurface()
void Foam::Module::cartesianMeshGenerator::mapMeshToSurface()
{
// calculate mesh surface
meshSurfaceEngine mse(mesh_);
......@@ -120,7 +116,7 @@ void cartesianMeshGenerator::mapMeshToSurface()
}
void cartesianMeshGenerator::extractPatches()
void Foam::Module::cartesianMeshGenerator::extractPatches()
{
edgeExtractor extractor(mesh_, *octreePtr_);
......@@ -131,20 +127,20 @@ void cartesianMeshGenerator::extractPatches()
}
void cartesianMeshGenerator::mapEdgesAndCorners()
void Foam::Module::cartesianMeshGenerator::mapEdgesAndCorners()
{
meshSurfaceEdgeExtractorNonTopo(mesh_, *octreePtr_);
}
void cartesianMeshGenerator::optimiseMeshSurface()
void Foam::Module::cartesianMeshGenerator::optimiseMeshSurface()
{
meshSurfaceEngine mse(mesh_);
meshSurfaceOptimizer(mse, *octreePtr_).optimizeSurface();
}
void cartesianMeshGenerator::generateBoundaryLayers()
void Foam::Module::cartesianMeshGenerator::generateBoundaryLayers()
{
// add boundary layers
boundaryLayers bl(mesh_);
......@@ -152,7 +148,7 @@ void cartesianMeshGenerator::generateBoundaryLayers()
}
void cartesianMeshGenerator::refBoundaryLayers()
void Foam::Module::cartesianMeshGenerator::refBoundaryLayers()
{
if (meshDict_.isDict("boundaryLayers"))
{
......@@ -172,7 +168,7 @@ void cartesianMeshGenerator::refBoundaryLayers()
}