mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make "file" property in functionObjects a relative path (issue #1125)
- partial solution for issue #1091 This generates file properties that are case-relative, Eg, plane0 { p { file "<case>/postProcessing/plane0/1/p_plane0.vtk"; } U { file "<case>/postProcessing/plane0/1/U_plane0.vtk"; } } This allows the case to be moved elsewhere and still find its files. This functionality was previously added for vtkCloud, but now also applies to streamLine, sampledSets and sampledSurfaces
This commit is contained in:
@ -338,10 +338,18 @@ 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
|
||||
|
||||
forAll(masterFields, fieldi)
|
||||
{
|
||||
dictionary propsDict;
|
||||
propsDict.add("file", sampleFile);
|
||||
propsDict.add
|
||||
(
|
||||
"file",
|
||||
sampleFile.relative(time_.globalPath(), true)
|
||||
);
|
||||
|
||||
const word& fieldName = masterFields[fieldi].name();
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
|
||||
@ -95,8 +95,15 @@ 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
|
||||
|
||||
dictionary propsDict;
|
||||
propsDict.add("file", sampleFile);
|
||||
propsDict.add
|
||||
(
|
||||
"file",
|
||||
sampleFile.relative(time_.globalPath(), true)
|
||||
);
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
}
|
||||
@ -116,8 +123,15 @@ void Foam::sampledSurfaces::writeSurface
|
||||
s.interpolate()
|
||||
);
|
||||
|
||||
// Case-local filename and "<case>" shortcut for readable output
|
||||
// and for possibly relocation of files
|
||||
|
||||
dictionary propsDict;
|
||||
propsDict.add("file", fName);
|
||||
propsDict.add
|
||||
(
|
||||
"file",
|
||||
fName.relative(time_.globalPath(), true)
|
||||
);
|
||||
setProperty(fieldName, propsDict);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user