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