mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
@ -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();
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user