BUGFIX - blockMeshApp should now handle paths properly

This commit is contained in:
Mark Olesen
2008-07-29 09:11:11 +02:00
parent f8b2746327
commit f1d7955e45

View File

@ -80,9 +80,12 @@ int main(int argc, char *argv[])
word regionName; word regionName;
fileName polyMeshDir; fileName polyMeshDir;
word dictName("blockMeshDict");
fileName dictPath(runTime.constant());
if (args.options().found("region")) if (args.options().found("region"))
{ {
// constant/<region>/polyMesh/blockMeshDict
regionName = args.options()["region"]; regionName = args.options()["region"];
polyMeshDir = regionName/polyMesh::meshSubDir; polyMeshDir = regionName/polyMesh::meshSubDir;
@ -90,47 +93,57 @@ int main(int argc, char *argv[])
} }
else else
{ {
// constant/polyMesh/blockMeshDict
regionName = polyMesh::defaultRegion; regionName = polyMesh::defaultRegion;
polyMeshDir = polyMesh::meshSubDir; polyMeshDir = polyMesh::meshSubDir;
} }
word dictName("blockMeshDict"); fileName dictLocal = polyMeshDir;
fileName dictPath(runTime.constant()/polyMeshDir);
if (args.options().found("dict")) if (args.options().found("dict"))
{ {
fileName userDict(args.options()["dict"]); wordList elems(fileName(args.options()["dict"]).components());
dictName = elems[elems.size()-1];
dictPath = elems[0];
dictLocal = "";
dictName = userDict.name(); if (elems.size() == 1)
dictPath = userDict.path(); {
dictPath = ".";
}
else if (elems.size() > 2)
{
dictLocal = fileName(SubList<word>(elems, elems.size()-2, 1));
}
} }
Info<< nl << "Reading block mesh description dictionary" << endl;
IOobject meshDescriptionIOobject IOobject meshDictIo
( (
dictName, dictName,
dictPath, dictPath,
dictLocal,
runTime, runTime,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE, IOobject::NO_WRITE,
false false
); );
if (!meshDescriptionIOobject.headerOk()) if (!meshDictIo.headerOk())
{ {
FatalErrorIn(args.executable()) FatalErrorIn(args.executable())
<< "Cannot open mesh description file: " << nl << "Cannot open mesh description file\n "
<< dictPath/dictName << nl << meshDictIo.objectPath()
<< nl
<< exit(FatalError); << exit(FatalError);
} }
IOdictionary meshDescription(meshDescriptionIOobject); Info<< nl << "Creating block mesh from\n "
<< meshDictIo.objectPath() << endl;
Info<< nl << "Creating block mesh" << endl; IOdictionary meshDict(meshDictIo);
blockMesh blocks(meshDescription);
blockMesh blocks(meshDict);
if (writeTopo) if (writeTopo)
{ {
@ -187,7 +200,7 @@ int main(int argc, char *argv[])
( (
runTime, runTime,
runTime.constant(), runTime.constant(),
polyMeshDir, //polyMesh::meshSubDir polyMeshDir,
patchNames, patchNames,
patchTypes, patchTypes,
defaultFacesName, defaultFacesName,
@ -215,11 +228,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 (meshDict.found("mergePatchPairs"))
{ {
List<Pair<word> > mergePatchPairs List<Pair<word> > mergePatchPairs
( (
meshDescription.lookup("mergePatchPairs") meshDict.lookup("mergePatchPairs")
); );
if (mergePatchPairs.size()) if (mergePatchPairs.size())