ENH: simplify use of case-relative paths

- provide relativePath() for argList and for Time.
  These are relative to the case globalPath().
  Eg,

     Info<< "output: " << runTime.relativePath(outputFile) << nl;
This commit is contained in:
Mark Olesen
2018-12-15 13:26:55 +01:00
parent ce6cd338a8
commit 455c8ef540
24 changed files with 271 additions and 134 deletions

View File

@ -338,8 +338,7 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
Pstream::scatter(sampleFile);
if (sampleFile.size())
{
// Shorten file name to be case-local and use "<case>" shortcut
// to make the content relocatable
// Case-local file name with "<case>" to make relocatable
forAll(masterFields, fieldi)
{
@ -347,7 +346,7 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields)
propsDict.add
(
"file",
sampleFile.relative(time_.globalPath(), true)
time_.relativePath(sampleFile, true)
);
const word& fieldName = masterFields[fieldi].name();

View File

@ -95,14 +95,13 @@ void Foam::sampledSurfaces::writeSurface
Pstream::scatter(sampleFile);
if (sampleFile.size())
{
// Shorten file name to be case-local and use "<case>" shortcut
// to make the content relocatable
// Case-local file name with "<case>" to make relocatable
dictionary propsDict;
propsDict.add
(
"file",
sampleFile.relative(time_.globalPath(), true)
time_.relativePath(sampleFile, true)
);
setProperty(fieldName, propsDict);
}
@ -123,14 +122,13 @@ void Foam::sampledSurfaces::writeSurface
s.interpolate()
);
// Case-local filename and "<case>" shortcut for readable output
// and for possibly relocation of files
// Case-local file name with "<case>" to make relocatable
dictionary propsDict;
propsDict.add
(
"file",
fName.relative(time_.globalPath(), true)
time_.relativePath(fName, true)
);
setProperty(fieldName, propsDict);
}