diff --git a/applications/utilities/mesh/generation/blockMesh/addOptions.H b/applications/utilities/mesh/generation/blockMesh/addOptions.H deleted file mode 100644 index c9e07df5a6..0000000000 --- a/applications/utilities/mesh/generation/blockMesh/addOptions.H +++ /dev/null @@ -1,4 +0,0 @@ - argList::noParallel(); - argList::validOptions.insert("blockTopology", ""); - argList::validOptions.insert("dict", "dictionary"); -# include "addRegionOption.H" diff --git a/applications/utilities/mesh/generation/blockMesh/block.C b/applications/utilities/mesh/generation/blockMesh/block.C index 7ee15c4a6e..d2f0d67ab9 100644 --- a/applications/utilities/mesh/generation/blockMesh/block.C +++ b/applications/utilities/mesh/generation/blockMesh/block.C @@ -27,7 +27,6 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "block.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/mesh/generation/blockMesh/blockBoundary.C b/applications/utilities/mesh/generation/blockMesh/blockBoundary.C index 39b45912df..ef176206fd 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockBoundary.C +++ b/applications/utilities/mesh/generation/blockMesh/blockBoundary.C @@ -28,18 +28,12 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "block.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void block::blockBoundary() +void Foam::block::blockBoundary() { label ni = blockDef_.n().x(); label nj = blockDef_.n().y(); @@ -212,9 +206,4 @@ void block::blockBoundary() } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockCells.C b/applications/utilities/mesh/generation/blockMesh/blockCells.C index 95d3d1a700..7968d0c381 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockCells.C +++ b/applications/utilities/mesh/generation/blockMesh/blockCells.C @@ -28,18 +28,11 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "block.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -void block::blockCells() +void Foam::block::blockCells() { label ni = blockDef_.n().x(); label nj = blockDef_.n().y(); @@ -69,9 +62,4 @@ void block::blockCells() } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.C b/applications/utilities/mesh/generation/blockMesh/blockMesh.C index ebd8db02f2..c2a69b5475 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.C @@ -32,21 +32,16 @@ Description #include "blockMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from IOdictionary -blockMesh::blockMesh(IOdictionary& meshDescription) +Foam::blockMesh::blockMesh(IOdictionary& meshDescription) : topologyPtr_(createTopology(meshDescription)), - scale_(readScalar(meshDescription.lookup("convertToMeters"))), blockOffsets_(createBlockOffsets()), mergeList_(createMergeList()), - points_(createPoints()), + points_(createPoints(meshDescription)), cells_(createCells()), patches_(createPatches()) {} @@ -54,7 +49,7 @@ blockMesh::blockMesh(IOdictionary& meshDescription) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -blockMesh::~blockMesh() +Foam::blockMesh::~blockMesh() { delete topologyPtr_; } @@ -62,7 +57,7 @@ blockMesh::~blockMesh() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -const polyMesh& blockMesh::topology() const +const Foam::polyMesh& Foam::blockMesh::topology() const { if (!topologyPtr_) { @@ -75,13 +70,7 @@ const polyMesh& blockMesh::topology() const } -const curvedEdgeList& blockMesh::edges() const -{ - return edges_; -} - - -wordList blockMesh::patchNames() const +Foam::wordList Foam::blockMesh::patchNames() const { const polyPatchList& patchTopologies = topology().boundaryMesh(); wordList names(patchTopologies.size()); @@ -95,7 +84,7 @@ wordList blockMesh::patchNames() const } -wordList blockMesh::patchTypes() const +Foam::wordList Foam::blockMesh::patchTypes() const { const polyPatchList& patchTopologies = topology().boundaryMesh(); wordList types(patchTopologies.size()); @@ -109,7 +98,7 @@ wordList blockMesh::patchTypes() const } -wordList blockMesh::patchPhysicalTypes() const +Foam::wordList Foam::blockMesh::patchPhysicalTypes() const { const polyPatchList& patchTopologies = topology().boundaryMesh(); wordList physicalTypes(patchTopologies.size()); @@ -123,7 +112,7 @@ wordList blockMesh::patchPhysicalTypes() const } -label blockMesh::numZonedBlocks() const +Foam::label Foam::blockMesh::numZonedBlocks() const { label num = 0; @@ -139,7 +128,7 @@ label blockMesh::numZonedBlocks() const } -void blockMesh::writeTopology(Ostream& os) const +void Foam::blockMesh::writeTopology(Ostream& os) const { const pointField& pts = topology().points(); @@ -160,9 +149,4 @@ void blockMesh::writeTopology(Ostream& os) const } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/blockMesh.H b/applications/utilities/mesh/generation/blockMesh/blockMesh.H index 808e93dad5..4114cb9619 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMesh.H +++ b/applications/utilities/mesh/generation/blockMesh/blockMesh.H @@ -62,8 +62,6 @@ class blockMesh polyMesh* topologyPtr_; - scalar scale_; - labelList blockOffsets_; labelList mergeList_; @@ -94,7 +92,7 @@ class blockMesh labelList createBlockOffsets(); labelList createMergeList(); - pointField createPoints(); + pointField createPoints(const dictionary&); cellShapeList createCells(); faceList createPatchFaces(const polyPatch& patchTopologyFaces); @@ -123,7 +121,10 @@ public: const polyMesh& topology() const; - const curvedEdgeList& edges() const; + const curvedEdgeList& edges() const + { + return edges_; + } const pointField& points() const { diff --git a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C index e73a5262b9..3b3b1f8ed5 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C +++ b/applications/utilities/mesh/generation/blockMesh/blockMeshApp.C @@ -72,11 +72,11 @@ using namespace Foam; int main(int argc, char *argv[]) { argList::noParallel(); - -# include "addOptions.H" + argList::validOptions.insert("blockTopology", ""); + argList::validOptions.insert("dict", "dictionary"); +# include "addRegionOption.H" # include "setRootCase.H" # include "createTime.H" -# include "checkOptions.H" word regionName; fileName polyMeshDir; @@ -117,6 +117,7 @@ int main(int argc, char *argv[]) } } + bool writeTopo = args.options().found("blockTopology"); IOobject meshDictIo ( @@ -139,7 +140,7 @@ int main(int argc, char *argv[]) } Info<< nl << "Creating block mesh from\n " - << meshDictIo.objectPath() << endl; + << meshDictIo.objectPath() << nl << endl; IOdictionary meshDict(meshDictIo); @@ -242,7 +243,7 @@ int main(int argc, char *argv[]) << exit(FatalError); } - //#include "mergePatchPairs.H" + //// #include "mergePatchPairs.H" } else { @@ -316,7 +317,7 @@ int main(int argc, char *argv[]) { label zoneI = iter(); - cz[zoneI]= new cellZone + cz[zoneI] = new cellZone ( iter.key(), zoneCells[zoneI].shrink(), @@ -339,7 +340,7 @@ int main(int argc, char *argv[]) IOstream::defaultPrecision(10); Info << nl << "Writing polyMesh" << endl; - mesh.removeFiles(mesh.instance()); + mesh.removeFiles(); if (!mesh.write()) { FatalErrorIn(args.executable()) diff --git a/applications/utilities/mesh/generation/blockMesh/blockPoints.C b/applications/utilities/mesh/generation/blockMesh/blockPoints.C index 0cb024215d..8f4993150c 100644 --- a/applications/utilities/mesh/generation/blockMesh/blockPoints.C +++ b/applications/utilities/mesh/generation/blockMesh/blockPoints.C @@ -28,17 +28,11 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "block.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -void block::blockPoints() +void Foam::block::blockPoints() { // set local variables for mesh specification label ni = blockDef_.n().x(); @@ -291,9 +285,4 @@ void block::blockPoints() } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C b/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C index 3d093a46dc..ad78b6686c 100644 --- a/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C +++ b/applications/utilities/mesh/generation/blockMesh/checkBlockMesh.C @@ -28,16 +28,10 @@ Description #include "blockMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // Check the blockMesh topology - -void blockMesh::checkBlockMesh(const polyMesh& bm) +void Foam::blockMesh::checkBlockMesh(const polyMesh& bm) { Info<< nl << "Check block mesh topology" << endl; @@ -148,9 +142,4 @@ void blockMesh::checkBlockMesh(const polyMesh& bm) } } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/checkOptions.H b/applications/utilities/mesh/generation/blockMesh/checkOptions.H deleted file mode 100644 index 902d96966f..0000000000 --- a/applications/utilities/mesh/generation/blockMesh/checkOptions.H +++ /dev/null @@ -1 +0,0 @@ - bool writeTopo = args.options().found("blockTopology"); diff --git a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C b/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C index dbe62491ad..f394b18c16 100644 --- a/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C +++ b/applications/utilities/mesh/generation/blockMesh/createBlockOffsets.C @@ -27,17 +27,11 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "blockMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -labelList blockMesh::createBlockOffsets() +Foam::labelList Foam::blockMesh::createBlockOffsets() { Info<< nl << "Creating block offsets" << endl; @@ -63,10 +57,4 @@ labelList blockMesh::createBlockOffsets() return BlockOffsets; } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/blockMesh/createCells.C b/applications/utilities/mesh/generation/blockMesh/createCells.C index ef6bb82891..e4792e416a 100644 --- a/applications/utilities/mesh/generation/blockMesh/createCells.C +++ b/applications/utilities/mesh/generation/blockMesh/createCells.C @@ -29,14 +29,9 @@ License #include "blockMesh.H" #include "cellModeller.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -cellShapeList blockMesh::createCells() +Foam::cellShapeList Foam::blockMesh::createCells() { Info<< nl << "Creating cells" << endl; @@ -76,10 +71,4 @@ cellShapeList blockMesh::createCells() return cells; } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/blockMesh/createMergeList.C b/applications/utilities/mesh/generation/blockMesh/createMergeList.C index f799905d63..b6e91a3ca0 100644 --- a/applications/utilities/mesh/generation/blockMesh/createMergeList.C +++ b/applications/utilities/mesh/generation/blockMesh/createMergeList.C @@ -26,14 +26,9 @@ License #include "blockMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -labelList blockMesh::createMergeList() +Foam::labelList Foam::blockMesh::createMergeList() { Info<< nl << "Creating merge list " << flush; @@ -277,7 +272,7 @@ labelList blockMesh::createMergeList() if (cp[blockPfaceFacePointLabel] == -1) { FatalErrorIn("blockMesh::createMergeList()") - << "Inconsistent point locations between block pair " + << "Inconsistent point locations between block pair " << blockPlabel << " and " << blockNlabel << nl << " probably due to inconsistent grading." << exit(FatalError); @@ -561,9 +556,4 @@ labelList blockMesh::createMergeList() return MergeList; } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createPatches.C b/applications/utilities/mesh/generation/blockMesh/createPatches.C index fddd51aa22..1594e1042e 100644 --- a/applications/utilities/mesh/generation/blockMesh/createPatches.C +++ b/applications/utilities/mesh/generation/blockMesh/createPatches.C @@ -29,14 +29,9 @@ Description #include "blockMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -faceList blockMesh::createPatchFaces +Foam::faceList Foam::blockMesh::createPatchFaces ( const polyPatch& patchTopologyFaces ) @@ -157,7 +152,7 @@ faceList blockMesh::createPatchFaces } -faceListList blockMesh::createPatches() +Foam::faceListList Foam::blockMesh::createPatches() { Info<< "\nCreating patches\n"; @@ -173,9 +168,4 @@ faceListList blockMesh::createPatches() return patches; } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // diff --git a/applications/utilities/mesh/generation/blockMesh/createPoints.C b/applications/utilities/mesh/generation/blockMesh/createPoints.C index 6f33edb435..01bb9a27f2 100644 --- a/applications/utilities/mesh/generation/blockMesh/createPoints.C +++ b/applications/utilities/mesh/generation/blockMesh/createPoints.C @@ -28,24 +28,26 @@ Description \*---------------------------------------------------------------------------*/ #include "error.H" - #include "blockMesh.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -pointField blockMesh::createPoints() +Foam::pointField Foam::blockMesh::createPoints(const dictionary& dict) { - Info<< nl << "Creating points" << endl; + blockMesh& blocks = *this; + + scalar scaleFactor = 1.0; + + // optional 'convertToMeters' (or 'scale'?) + if (!dict.readIfPresent("convertToMeters", scaleFactor)) + { + dict.readIfPresent("scale", scaleFactor); + } + + Info<< nl << "Creating points with scale " << scaleFactor << endl; pointField points(nPoints_); - blockMesh& blocks = *this; - forAll(blocks, blockLabel) { const pointField& blockPoints = blocks[blockLabel].points(); @@ -59,17 +61,11 @@ pointField blockMesh::createPoints() blockPointLabel + blockOffsets_[blockLabel] ] - ] = scale_*blockPoints[blockPointLabel]; + ] = scaleFactor * blockPoints[blockPointLabel]; } } return points; } - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - // ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/blockMesh/createTopology.C b/applications/utilities/mesh/generation/blockMesh/createTopology.C index 6b74db8b0a..2b722c5fde 100644 --- a/applications/utilities/mesh/generation/blockMesh/createTopology.C +++ b/applications/utilities/mesh/generation/blockMesh/createTopology.C @@ -40,9 +40,9 @@ bool Foam::blockMesh::blockLabelsOK { bool ok = true; - for (int i=0; i= points.size()) + else if (blockShape[blockI] >= points.size()) { ok = false; @@ -65,7 +65,7 @@ bool Foam::blockMesh::blockLabelsOK "(const label blockLabel, const pointField& points, " "const cellShape& blockShape)" ) << "block " << blockLabel - << " point label " << blockShape[i] + << " point label " << blockShape[blockI] << " larger than " << points.size() - 1 << " the largest defined point label" << endl; } @@ -84,38 +84,34 @@ bool Foam::blockMesh::patchLabelsOK { bool ok = true; - for (label facei=0; facei= points.size()) + else if (f[fp] >= points.size()) { ok = false; WarningIn ( - "bool Foam::blockMesh::patchLabelsOK" - "(const label patchLabel, const pointField& points, " - "const faceList& patchFaces)" + "bool Foam::blockMesh::patchLabelsOK(...)" ) << "patch " << patchLabel - << " face " << facei - << " point label " << labels[i] + << " face " << faceI + << " point label " << f[fp] << " larger than " << points.size() - 1 << " the largest defined point label" << endl; } @@ -137,23 +133,13 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) word defaultPatchName = "defaultFaces"; word defaultPatchType = emptyPolyPatch::typeName; - // get names and types for the unassigned patch faces - if (meshDescription.found("defaultPatch")) + // get names/types for the unassigned patch faces + // this is a bit heavy handed (and ugly), but there is currently + // no easy way to rename polyMesh patches subsequently + if (const dictionary* dictPtr = meshDescription.subDictPtr("defaultPatch")) { - const dictionary& defaultPatch = - meshDescription.subDict("defaultPatch"); - - // this is a bit heavy handed (and ugly), but there is currently - // no easy way to rename polyMesh patches subsequently - if (defaultPatch.found("name")) - { - defaultPatch.lookup("name") >> defaultPatchName; - } - - if (defaultPatch.found("type")) - { - defaultPatch.lookup("type") >> defaultPatchType; - } + dictPtr->readIfPresent("name", defaultPatchName); + dictPtr->readIfPresent("type", defaultPatchType); } Info<< nl << "Creating blockCorners" << endl; @@ -456,4 +442,3 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription) // ************************************************************************* // - diff --git a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C index 2efd9b1839..6d7e80d74e 100644 --- a/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C +++ b/applications/utilities/mesh/generation/blockMesh/mergePatchPairs.C @@ -1,4 +1,4 @@ - Info<< nl << "Creating merge patch pairs" << nl << endl; + Info<< "Creating merge patch pairs" << nl << endl; if (mergePatchPairs.size() > 0) {