functionObjects: Standardised file paths for functions applied to regions
Function objects now write to the following path when applied to a
non-default region of a multi-region case:
postProcessing/<regionName>/<functionName>/<time>/
Previously the order of <regionName> and <functionName> was not
consistent between the various function objects.
Resolves bug report https://bugs.openfoam.org/view.php?id=3907
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2015-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -364,11 +364,10 @@ void Foam::mergeAndWrite
|
||||
|
||||
fileName outputDir
|
||||
(
|
||||
set.time().path()
|
||||
/ (Pstream::parRun() ? ".." : "")
|
||||
/ "postProcessing"
|
||||
/ mesh.pointsInstance()
|
||||
/ set.name()
|
||||
set.time().globalPath()
|
||||
/functionObjects::writeFile::outputPrefix
|
||||
/mesh.pointsInstance()
|
||||
/set.name()
|
||||
);
|
||||
outputDir.clean();
|
||||
|
||||
|
||||
@ -33,6 +33,7 @@ License
|
||||
#include "polyTopoChangeMap.H"
|
||||
#include "polyMeshMap.H"
|
||||
#include "polyDistributionMap.H"
|
||||
#include "OSspecific.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -310,17 +311,18 @@ bool Foam::functionObjects::layerAverage::write()
|
||||
#undef CollapseTypeFields
|
||||
}
|
||||
|
||||
// Output directory
|
||||
fileName outputPath =
|
||||
mesh_.time().globalPath()/writeFile::outputPrefix/name();
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
outputPath = outputPath/mesh_.name();
|
||||
}
|
||||
|
||||
// Write
|
||||
if (Pstream::master() && layerCentre_.size())
|
||||
{
|
||||
// Make output directory
|
||||
const fileName outputPath =
|
||||
mesh_.time().globalPath()
|
||||
/writeFile::outputPrefix
|
||||
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
|
||||
/name()
|
||||
/mesh_.time().timeName();
|
||||
mkDir(outputPath);
|
||||
|
||||
scalarField layerDistance(layerCentre_.size(), 0);
|
||||
for (label i = 1; i < layerCentre_.size(); ++ i)
|
||||
{
|
||||
@ -330,7 +332,7 @@ bool Foam::functionObjects::layerAverage::write()
|
||||
|
||||
formatter_->write
|
||||
(
|
||||
outputPath/mesh_.time().timeName(),
|
||||
outputPath,
|
||||
typeName,
|
||||
coordSet
|
||||
(
|
||||
|
||||
@ -533,15 +533,12 @@ bool Foam::functionObjects::streamlines::write()
|
||||
if (Pstream::master() && allPositions.size())
|
||||
{
|
||||
// Make output directory
|
||||
fileName outputPath
|
||||
(
|
||||
mesh_.time().globalPath()/writeFile::outputPrefix/name()
|
||||
);
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
outputPath = outputPath/mesh_.name();
|
||||
}
|
||||
outputPath = outputPath/mesh_.time().timeName();
|
||||
const fileName outputPath =
|
||||
mesh_.time().globalPath()
|
||||
/writeFile::outputPrefix
|
||||
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
|
||||
/name()
|
||||
/mesh_.time().timeName();
|
||||
mkDir(outputPath);
|
||||
|
||||
// Pass data to the formatter to write
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CloudFunctionObject.H"
|
||||
#include "writeFile.H"
|
||||
|
||||
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -57,7 +58,10 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
|
||||
outputDir_()
|
||||
{
|
||||
const fileName relPath =
|
||||
"postProcessing"/cloud::prefix/owner.name()/this->modelName();
|
||||
functionObjects::writeFile::outputPrefix
|
||||
/cloud::prefix
|
||||
/owner.name()
|
||||
/this->modelName();
|
||||
|
||||
outputDir_ = owner.mesh().time().globalPath()/relPath;
|
||||
}
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "volFields.H"
|
||||
#include "polyTopoChangeMap.H"
|
||||
#include "OSspecific.H"
|
||||
#include "writeFile.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
@ -191,17 +192,12 @@ Foam::label Foam::probes::prepare()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
fileName probeDir;
|
||||
fileName probeSubDir = name();
|
||||
|
||||
if (mesh_.name() != polyMesh::defaultRegion)
|
||||
{
|
||||
probeSubDir = probeSubDir/mesh_.name();
|
||||
}
|
||||
probeSubDir = "postProcessing"/probeSubDir/mesh_.time().timeName();
|
||||
|
||||
probeDir = mesh_.time().globalPath()/probeSubDir;
|
||||
const fileName probeDir =
|
||||
mesh_.time().globalPath()
|
||||
/functionObjects::writeFile::outputPrefix
|
||||
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
|
||||
/name()
|
||||
/mesh_.time().timeName();
|
||||
|
||||
// ignore known fields, close streams for fields that no longer exist
|
||||
forAllIter(HashPtrTable<OFstream>, probeFilePtrs_, iter)
|
||||
|
||||
@ -111,19 +111,17 @@ Foam::functionObjects::sampledSets::sampledSets
|
||||
:
|
||||
fvMeshFunctionObject(name, t, dict),
|
||||
PtrList<sampledSet>(),
|
||||
outputPath_(fileName::null),
|
||||
outputPath_
|
||||
(
|
||||
mesh_.time().globalPath()
|
||||
/writeFile::outputPrefix
|
||||
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
|
||||
/name
|
||||
),
|
||||
searchEngine_(mesh_),
|
||||
interpolationScheme_(word::null),
|
||||
formatter_(nullptr)
|
||||
{
|
||||
outputPath_ =
|
||||
mesh_.time().globalPath()/functionObjects::writeFile::outputPrefix/name;
|
||||
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
outputPath_ = outputPath_/mesh_.name();
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
@ -165,21 +165,19 @@ Foam::functionObjects::sampledSurfaces::sampledSurfaces
|
||||
:
|
||||
fvMeshFunctionObject(name, t, dict),
|
||||
PtrList<sampledSurface>(),
|
||||
outputPath_(fileName::null),
|
||||
outputPath_
|
||||
(
|
||||
mesh_.time().globalPath()
|
||||
/writeFile::outputPrefix
|
||||
/(mesh_.name() != polyMesh::defaultRegion ? mesh_.name() : word())
|
||||
/name
|
||||
),
|
||||
fields_(),
|
||||
interpolationScheme_(word::null),
|
||||
writeEmpty_(false),
|
||||
mergeList_(),
|
||||
formatter_(nullptr)
|
||||
{
|
||||
outputPath_ =
|
||||
mesh_.time().globalPath()/functionObjects::writeFile::outputPrefix/name;
|
||||
|
||||
if (mesh_.name() != fvMesh::defaultRegion)
|
||||
{
|
||||
outputPath_ = outputPath_/mesh_.name();
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user