BUGFIX - blockMeshApp should now handle paths properly
This commit is contained in:
parent
f8b2746327
commit
f1d7955e45
@ -80,57 +80,70 @@ int main(int argc, char *argv[])
|
||||
|
||||
word regionName;
|
||||
fileName polyMeshDir;
|
||||
word dictName("blockMeshDict");
|
||||
fileName dictPath(runTime.constant());
|
||||
|
||||
if (args.options().found("region"))
|
||||
{
|
||||
regionName = args.options()["region"];
|
||||
// constant/<region>/polyMesh/blockMeshDict
|
||||
regionName = args.options()["region"];
|
||||
polyMeshDir = regionName/polyMesh::meshSubDir;
|
||||
|
||||
Info<< nl << "Generating mesh for region " << regionName << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
regionName = polyMesh::defaultRegion;
|
||||
// constant/polyMesh/blockMeshDict
|
||||
regionName = polyMesh::defaultRegion;
|
||||
polyMeshDir = polyMesh::meshSubDir;
|
||||
}
|
||||
|
||||
word dictName("blockMeshDict");
|
||||
fileName dictPath(runTime.constant()/polyMeshDir);
|
||||
fileName dictLocal = polyMeshDir;
|
||||
|
||||
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();
|
||||
dictPath = userDict.path();
|
||||
if (elems.size() == 1)
|
||||
{
|
||||
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,
|
||||
dictPath,
|
||||
dictLocal,
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (!meshDescriptionIOobject.headerOk())
|
||||
if (!meshDictIo.headerOk())
|
||||
{
|
||||
FatalErrorIn(args.executable())
|
||||
<< "Cannot open mesh description file: " << nl
|
||||
<< dictPath/dictName << nl
|
||||
<< "Cannot open mesh description file\n "
|
||||
<< meshDictIo.objectPath()
|
||||
<< nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
IOdictionary meshDescription(meshDescriptionIOobject);
|
||||
Info<< nl << "Creating block mesh from\n "
|
||||
<< meshDictIo.objectPath() << endl;
|
||||
|
||||
Info<< nl << "Creating block mesh" << endl;
|
||||
|
||||
blockMesh blocks(meshDescription);
|
||||
IOdictionary meshDict(meshDictIo);
|
||||
|
||||
blockMesh blocks(meshDict);
|
||||
|
||||
if (writeTopo)
|
||||
{
|
||||
@ -187,7 +200,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
runTime,
|
||||
runTime.constant(),
|
||||
polyMeshDir, //polyMesh::meshSubDir
|
||||
polyMeshDir,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
defaultFacesName,
|
||||
@ -215,11 +228,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Read in a list of dictionaries for the merge patch pairs
|
||||
if (meshDescription.found("mergePatchPairs"))
|
||||
if (meshDict.found("mergePatchPairs"))
|
||||
{
|
||||
List<Pair<word> > mergePatchPairs
|
||||
(
|
||||
meshDescription.lookup("mergePatchPairs")
|
||||
meshDict.lookup("mergePatchPairs")
|
||||
);
|
||||
|
||||
if (mergePatchPairs.size())
|
||||
|
Loading…
Reference in New Issue
Block a user