revert to previous search order - constant/polyMesh/blockMeshDict

- retain failsafe check (constant/blockMeshDict)
This commit is contained in:
Mark Olesen
2008-07-23 15:12:44 +02:00
parent b43378747a
commit eb604fdb88

View File

@ -28,12 +28,12 @@ Application
Description Description
A multi-block mesh generator. A multi-block mesh generator.
The @a constant/blockMeshDict (or @a constant/\<region\>/blockMeshDict) A @a constant/polyMesh/blockMeshDict
is used. (or @a constant/\<region\>/polyMesh/blockMeshDict) is used.
For backwards compatibility, @a constant/polyMesh/blockMeshDict For people who like to accidentally remove their entire
(or @a constant/\<region\>/polyMesh/blockMeshDict) can also be used @a constant/polyMesh/, the path @a constant/blockMeshDict
if the previous search failed. (or @a constant/\<region\>/blockMeshDict) will also be checked.
Usage Usage
@ -86,77 +86,83 @@ int main(int argc, char *argv[])
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; 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(); 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 // check constant/polyMesh or constant/polyMesh/<region>/
if (!meshDictPtr->headerOk()) meshDictPtr.reset
{ (
meshDictPtr.reset new IOobject
( (
new IOobject "blockMeshDict",
( runTime.constant(),
"blockMeshDict", polyMeshDir,
runTime.constant(), runTime,
polyMeshDir, IOobject::MUST_READ,
runTime, IOobject::NO_WRITE,
IOobject::MUST_READ, false
IOobject::NO_WRITE, )
false );
)
);
}
if (!meshDictPtr->headerOk()) if (!meshDictPtr->headerOk())
{ {
FatalErrorIn(args.executable()) // not found, failsafe checks
<< "Cannot open mesh description file " << nl if (args.options().found("region"))
<< constantDir/"blockMeshDict" << nl {
<< "or "<< nl // try constant/<region>/blockMeshDict
<< constantDir/polyMeshDir/polyMesh::meshSubDir/"blockMeshDict" meshDictPtr.reset
<< nl (
<< exit(FatalError); new IOobject
(
"blockMeshDict",
runTime.constant(),
regionName,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
else
{
// try constant/blockMeshDict
meshDictPtr.reset
(
new IOobject
(
"blockMeshDict",
runTime.constant(),
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
}
if (!meshDictPtr->headerOk())
{
FatalErrorIn(args.executable())
<< "Cannot open mesh description file\n "
<< constantDir/polyMeshDir/"blockMeshDict"
<< "\n (or " << constantDir/"blockMeshDict" << ")" << nl
<< nl
<< exit(FatalError);
}
} }
Info<< nl << "Reading mesh description file" << endl; Info<< nl << "Reading mesh description file" << endl;
IOdictionary blockMeshDict(meshDictPtr()); IOdictionary blockMeshDict(meshDictPtr());