blockMesh:

renamed genBlockMesh.C -> blockMeshApp.C for the -doc option

  Followed Eugene's suggestions and moved blockMeshDict out of polyMesh/.

  Rationale:
  blockMeshDict is not a polyMesh or part of a polyMesh, thus it doesn't
  really belong in the polyMesh/ dir anyhow. Moving it to constant/ or
  constant/<region>/ improves the overview and eases cleanup of polyMesh/ as
  well. For compatibility, constant/polyMesh/ or constant/<region>/polyMesh/
  will be searched if the new locations fail.
This commit is contained in:
Mark Olesen
2008-07-18 10:23:09 +02:00
parent d0ee873946
commit 3ae1a49119
2 changed files with 84 additions and 22 deletions

View File

@ -26,6 +26,6 @@ blockPoints.C
blockCells.C blockCells.C
blockBoundary.C blockBoundary.C
genBlockMesh.C blockMeshApp.C
EXE = $(FOAM_APPBIN)/blockMesh EXE = $(FOAM_APPBIN)/blockMesh

View File

@ -22,14 +22,35 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
blockMesh
Description Description
A multi-block mesh generator. A multi-block mesh generator.
The @a constant/blockMeshDict (or @a constant/\<region\>/blockMeshDict)
is used.
For backwards compatibility, @a constant/polyMesh/blockMeshDict
(or @a constant/\<region\>/polyMesh/blockMeshDict) can also be used
if the previous search failed.
Usage
- blockMesh [OPTION]
@param -blockTopology \n
Write the topology as a set of edges in OBJ format.
@param -region \<name\>\n
Specify an alternative mesh region
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Time.H" #include "Time.H"
#include "IOdictionary.H" #include "IOdictionary.H"
#include "IOPtrList.H" #include "IOPtrList.H"
#include "autoPtr.H"
#include "blockMesh.H" #include "blockMesh.H"
#include "attachPolyTopoChanger.H" #include "attachPolyTopoChanger.H"
@ -60,24 +81,59 @@ int main(int argc, char *argv[])
word regionName; word regionName;
fileName polyMeshDir; fileName polyMeshDir;
fileName constantDir;
autoPtr<IOobject> meshDictPtr;
if (args.options().found("region")) if (args.options().found("region"))
{ {
regionName = args.options()["region"]; regionName = args.options()["region"];
polyMeshDir = regionName/polyMesh::meshSubDir; polyMeshDir = regionName/polyMesh::meshSubDir;
constantDir = runTime.constant()/regionName;
Info<< nl << "Generating mesh for region " << regionName << endl; Info<< nl << "Generating mesh for region " << regionName << endl;
// try constant/<region>/blockMeshDict
meshDictPtr.reset
(
new IOobject
(
"blockMeshDict",
runTime.constant(),
regionName,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
} }
else else
{ {
regionName = polyMesh::defaultRegion; regionName = polyMesh::defaultRegion;
polyMeshDir = polyMesh::meshSubDir; polyMeshDir = polyMesh::meshSubDir;
constantDir = runTime.constant();
// try constant/blockMeshDict
meshDictPtr.reset
(
new IOobject
(
"blockMeshDict",
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
} }
// not found, fallback to polyMesh directory
Info<< nl << "Reading block mesh description dictionary" << endl; if (!meshDictPtr->headerOk())
{
IOobject meshDescriptionIOobject meshDictPtr.reset
(
new IOobject
( (
"blockMeshDict", "blockMeshDict",
runTime.constant(), runTime.constant(),
@ -86,21 +142,28 @@ int main(int argc, char *argv[])
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
)
); );
}
if (!meshDescriptionIOobject.headerOk()) if (!meshDictPtr->headerOk())
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Cannot open mesh description file " << nl << "Cannot open mesh description file " << nl
<< runTime.constant()/polyMeshDir/"blockMeshDict" << nl << constantDir/"blockMeshDict" << nl
<< "or "<< nl
<< constantDir/polyMeshDir/polyMesh::meshSubDir/"blockMeshDict"
<< nl
<< exit(FatalError); << exit(FatalError);
} }
IOdictionary meshDescription(meshDescriptionIOobject); Info<< nl << "Reading mesh description file" << endl;
IOdictionary blockMeshDict(meshDictPtr());
Info<< nl << "Creating block mesh" << endl; Info<< nl << "Creating block mesh" << endl;
blockMesh blocks(meshDescription); blockMesh blocks(blockMeshDict);
if (writeTopo) if (writeTopo)
@ -145,7 +208,6 @@ int main(int argc, char *argv[])
} }
Info<< nl << "Creating mesh from block mesh" << endl; Info<< nl << "Creating mesh from block mesh" << endl;
wordList patchNames = blocks.patchNames(); wordList patchNames = blocks.patchNames();
@ -186,11 +248,11 @@ int main(int argc, char *argv[])
// Read in a list of dictionaries for the merge patch pairs // Read in a list of dictionaries for the merge patch pairs
if (meshDescription.found("mergePatchPairs")) if (blockMeshDict.found("mergePatchPairs"))
{ {
List<Pair<word> > mergePatchPairs List<Pair<word> > mergePatchPairs
( (
meshDescription.lookup("mergePatchPairs") blockMeshDict.lookup("mergePatchPairs")
); );
if (mergePatchPairs.size()) if (mergePatchPairs.size())