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