decomposePar was failing for -case ./name : fixed relative directories

This commit is contained in:
Mark Olesen
2008-05-23 14:08:32 +02:00
parent d03b912538
commit 39838b6df2

View File

@ -26,8 +26,8 @@ Application
decomposePar decomposePar
Description Description
Automatically decomposes a mesh and fields of a case for parallel execution Automatically decomposes a mesh and fields of a case for parallel
of FOAM. execution of OpenFOAM.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -62,11 +62,8 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
bool decomposeFieldsOnly(args.options().found("fields")); bool decomposeFieldsOnly(args.options().found("fields"));
bool writeCellDist(args.options().found("cellDist")); bool writeCellDist(args.options().found("cellDist"));
bool filterPatches(args.options().found("filterPatches")); bool filterPatches(args.options().found("filterPatches"));
bool copyUniform(args.options().found("copyUniform")); bool copyUniform(args.options().found("copyUniform"));
# include "createTime.H" # include "createTime.H"
@ -368,21 +365,21 @@ int main(int argc, char *argv[])
// Any uniform data to copy/link? // Any uniform data to copy/link?
fileName uniformDir("uniform");
fileName uniformDir; if (dir(runTime.timePath()/uniformDir))
if (dir(runTime.timePath()/"uniform"))
{ {
uniformDir = runTime.timePath()/"uniform"; Info<< "Detected additional non-decomposed files in "
<< runTime.timePath()/uniformDir
Info<< "Detected additional non-decomposed files in " << uniformDir
<< endl; << endl;
} }
else
{
uniformDir.clear();
}
Info<< endl; Info<< endl;
// split the fields over processors // split the fields over processors
for (label procI = 0; procI < mesh.nProcs(); procI++) for (label procI = 0; procI < mesh.nProcs(); procI++)
{ {
@ -581,29 +578,31 @@ int main(int argc, char *argv[])
// Any non-decomposed data to copy? // Any non-decomposed data to copy?
if (uniformDir.size() > 0) if (uniformDir.size())
{ {
const fileName timePath = processorDb.timePath();
if (copyUniform || mesh.distributed()) if (copyUniform || mesh.distributed())
{ {
cp(uniformDir, processorDb.timePath()/"uniform"); cp
(
runTime.timePath()/uniformDir,
timePath/uniformDir
);
} }
else else
{ {
fileName timePath = processorDb.timePath(); // link with relative paths
const string parentPath = string("..")/"..";
if (timePath[0] != '/') fileName currentDir(cwd());
{ chDir(timePath);
// Adapt uniformDir and timePath to be relative paths. ln
string parentPath(string("..")/".."); (
fileName currentDir(cwd()); parentPath/runTime.timeName()/uniformDir,
chDir(timePath); uniformDir
ln(parentPath/uniformDir, parentPath/timePath/"uniform"); );
chDir(currentDir); chDir(currentDir);
}
else
{
ln(uniformDir, timePath/"uniform");
}
} }
} }
} }