ENH: Consistency improvement for setting postProcessing directory name

This commit is contained in:
Andrew Heather
2018-02-27 14:37:05 +00:00
parent 853b9abb79
commit aec949d7cc
16 changed files with 71 additions and 40 deletions

View File

@ -10,6 +10,7 @@
#include "polyMeshTetDecomposition.H" #include "polyMeshTetDecomposition.H"
#include "surfaceWriter.H" #include "surfaceWriter.H"
#include "checkTools.H" #include "checkTools.H"
#include "functionObject.H"
#include "vtkSurfaceWriter.H" #include "vtkSurfaceWriter.H"
#include "writer.H" #include "writer.H"
@ -1020,7 +1021,7 @@ Foam::label Foam::checkGeometry
{ {
wr.write wr.write
( (
"postProcessing", functionObject::outputPrefix,
"src_" + tmName, "src_" + tmName,
meshedSurfRef meshedSurfRef
( (
@ -1074,7 +1075,7 @@ Foam::label Foam::checkGeometry
{ {
wr.write wr.write
( (
"postProcessing", functionObject::outputPrefix,
"tgt_" + tmName, "tgt_" + tmName,
meshedSurfRef meshedSurfRef
( (

View File

@ -41,6 +41,7 @@ License
#include "syncTools.H" #include "syncTools.H"
#include "globalIndex.H" #include "globalIndex.H"
#include "PatchTools.H" #include "PatchTools.H"
#include "functionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -285,7 +286,7 @@ void Foam::mergeAndWrite
( (
set.time().path() set.time().path()
/ (Pstream::parRun() ? ".." : "") / (Pstream::parRun() ? ".." : "")
/ "postProcessing" / functionObject::outputPrefix
/ mesh.pointsInstance() / mesh.pointsInstance()
/ set.name() / set.name()
); );
@ -379,7 +380,7 @@ void Foam::mergeAndWrite
( (
set.time().path() set.time().path()
/ (Pstream::parRun() ? ".." : "") / (Pstream::parRun() ? ".." : "")
/ "postProcessing" / functionObject::outputPrefix
/ mesh.pointsInstance() / mesh.pointsInstance()
/ set.name() / set.name()
); );
@ -483,7 +484,7 @@ void Foam::mergeAndWrite
( (
set.time().path() set.time().path()
/ (Pstream::parRun() ? ".." : "") / (Pstream::parRun() ? ".." : "")
/ "postProcessing" / functionObject::outputPrefix
/ mesh.pointsInstance() / mesh.pointsInstance()
// set.name() // set.name()
); );

View File

@ -39,6 +39,7 @@ Description
#include "vtkSurfaceWriter.H" #include "vtkSurfaceWriter.H"
#include "cyclicAMIPolyPatch.H" #include "cyclicAMIPolyPatch.H"
#include "PatchTools.H" #include "PatchTools.H"
#include "functionObject.H"
using namespace Foam; using namespace Foam;
@ -139,7 +140,7 @@ void writeWeights(const polyMesh& mesh)
mesh, mesh,
ami.tgtWeightsSum(), ami.tgtWeightsSum(),
cpp.neighbPatch(), cpp.neighbPatch(),
"postProcessing", functionObject::outputPrefix,
"tgt", "tgt",
tmName tmName
); );
@ -148,7 +149,7 @@ void writeWeights(const polyMesh& mesh)
mesh, mesh,
ami.srcWeightsSum(), ami.srcWeightsSum(),
cpp, cpp,
"postProcessing", functionObject::outputPrefix,
"src", "src",
tmName tmName
); );

View File

@ -44,6 +44,7 @@ Description
#include "stringOps.H" #include "stringOps.H"
#include "timeSelector.H" #include "timeSelector.H"
#include "IOobjectList.H" #include "IOobjectList.H"
#include "functionObject.H"
using namespace Foam; using namespace Foam;
@ -149,7 +150,7 @@ int main(int argc, char *argv[])
// Name/location for the output summary // Name/location for the output summary
const fileName outputName const fileName outputName
{ {
"postProcessing", functionObject::outputPrefix,
"profiling", "profiling",
runTime.timeName(), runTime.timeName(),
profilingFileName profilingFileName

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -38,6 +38,7 @@ namespace Foam
bool Foam::functionObject::postProcess(false); bool Foam::functionObject::postProcess(false);
Foam::word Foam::functionObject::outputPrefix("postProcessing");
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -172,6 +172,9 @@ public:
//- Global post-processing mode switch //- Global post-processing mode switch
static bool postProcess; static bool postProcess;
//- Directory prefix
static word outputPrefix;
//- Switch write log to Info //- Switch write log to Info
Switch log; Switch log;

View File

@ -27,14 +27,10 @@ License
#include "Time.H" #include "Time.H"
#include "polyMesh.H" #include "polyMesh.H"
#include "IFstream.H" #include "IFstream.H"
#include "functionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::word Foam::functionObjects::writeFile::outputPrefix
(
"postProcessing"
);
Foam::label Foam::functionObjects::writeFile::addChars = 8; Foam::label Foam::functionObjects::writeFile::addChars = 8;
@ -56,11 +52,11 @@ Foam::fileName Foam::functionObjects::writeFile::baseFileDir() const
{ {
// Put in undecomposed case (Note: gives problems for // Put in undecomposed case (Note: gives problems for
// distributed data running) // distributed data running)
baseDir = baseDir/".."/outputPrefix; baseDir = baseDir/".."/functionObject::outputPrefix;
} }
else else
{ {
baseDir = baseDir/outputPrefix; baseDir = baseDir/functionObject::outputPrefix;
} }
// Append mesh name if not default region // Append mesh name if not default region

View File

@ -117,9 +117,6 @@ private:
public: public:
//- Directory prefix
static const word outputPrefix;
//- Additional characters for writing //- Additional characters for writing
static label addChars; static label addChars;

View File

@ -63,11 +63,11 @@ Foam::functionObjects::extractEulerianParticles::dictBaseFileDir() const
{ {
// Put in undecomposed case (Note: gives problems for // Put in undecomposed case (Note: gives problems for
// distributed data running) // distributed data running)
baseDir = baseDir/".."/"postProcessing"; baseDir = baseDir/".."/functionObject::outputPrefix;
} }
else else
{ {
baseDir = baseDir/"postProcessing"; baseDir = baseDir/functionObject::outputPrefix;
} }
return baseDir; return baseDir;

View File

@ -647,8 +647,8 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
fileName vtkPath fileName vtkPath
( (
Pstream::parRun() Pstream::parRun()
? time_.path()/".."/"postProcessing"/"sets"/name() ? time_.path()/".."/functionObject::outputPrefix/"sets"/name()
: time_.path()/"postProcessing"/"sets"/name() : time_.path()/functionObject::outputPrefix/"sets"/name()
); );
if (mesh_.name() != fvMesh::defaultRegion) if (mesh_.name() != fvMesh::defaultRegion)
{ {

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -389,9 +389,17 @@ void Foam::functionObjects::runTimePostPro::scene::saveImage
const Time& runTime = obr_.time(); const Time& runTime = obr_.time();
fileName prefix(Pstream::parRun() ? const fileName relPath
runTime.path()/".."/"postProcessing"/name_/obr_.time().timeName() : (
runTime.path()/"postProcessing"/name_/obr_.time().timeName()); functionObject::outputPrefix/name_/obr_.time().timeName()
);
fileName prefix
(
Pstream::parRun() ?
runTime.path()/".."/relPath
: runTime.path()/relPath
);
mkDir(prefix); mkDir(prefix);

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "CloudFunctionObject.H" #include "CloudFunctionObject.H"
#include "functionObject.H"
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
@ -56,8 +57,13 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
CloudSubModelBase<CloudType>(modelName, owner, dict, typeName, objectType), CloudSubModelBase<CloudType>(modelName, owner, dict, typeName, objectType),
outputDir_(owner.mesh().time().path()) outputDir_(owner.mesh().time().path())
{ {
const fileName relPath = const fileName relPath
"postProcessing"/cloud::prefix/owner.name()/this->modelName(); (
functionObject::outputPrefix
/cloud::prefix
/owner.name()
/this->modelName()
);
if (Pstream::parRun()) if (Pstream::parRun())

View File

@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "noiseModel.H" #include "noiseModel.H"
#include "functionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -143,7 +144,7 @@ Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const
word datasetName("input" + Foam::name(dataseti)); word datasetName("input" + Foam::name(dataseti));
baseDir = baseDir =
baseDir.expand() baseDir.expand()
/"postProcessing" /functionObject::outputPrefix
/"noise" /"noise"
/outputPrefix_ /outputPrefix_
/type() /type()

View File

@ -202,7 +202,8 @@ Foam::label Foam::probes::prepare()
{ {
probeSubDir = probeSubDir/mesh_.name(); probeSubDir = probeSubDir/mesh_.name();
} }
probeSubDir = "postProcessing"/probeSubDir/mesh_.time().timeName(); probeSubDir =
functionObject::outputPrefix/probeSubDir/mesh_.time().timeName();
if (Pstream::parRun()) if (Pstream::parRun())
{ {

View File

@ -97,18 +97,22 @@ Foam::sampledSets::sampledSets
interpolationScheme_(word::null), interpolationScheme_(word::null),
writeFormat_(word::null) writeFormat_(word::null)
{ {
const fileName relPath(functionObject::outputPrefix/name);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
outputPath_ = mesh_.time().path()/".."/"postProcessing"/name; outputPath_ = mesh_.time().path()/".."/relPath;
} }
else else
{ {
outputPath_ = mesh_.time().path()/"postProcessing"/name; outputPath_ = mesh_.time().path()/relPath;
} }
if (mesh_.name() != fvMesh::defaultRegion) if (mesh_.name() != fvMesh::defaultRegion)
{ {
outputPath_ = outputPath_/mesh_.name(); outputPath_ = outputPath_/mesh_.name();
} }
outputPath_.clean(); // Remove unneeded ".." outputPath_.clean(); // Remove unneeded ".."
read(dict); read(dict);
@ -132,18 +136,22 @@ Foam::sampledSets::sampledSets
interpolationScheme_(word::null), interpolationScheme_(word::null),
writeFormat_(word::null) writeFormat_(word::null)
{ {
const fileName relPath(functionObject::outputPrefix/name);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
outputPath_ = mesh_.time().path()/".."/"postProcessing"/name; outputPath_ = mesh_.time().path()/".."/relPath;
} }
else else
{ {
outputPath_ = mesh_.time().path()/"postProcessing"/name; outputPath_ = mesh_.time().path()/relPath;
} }
if (mesh_.name() != fvMesh::defaultRegion) if (mesh_.name() != fvMesh::defaultRegion)
{ {
outputPath_ = outputPath_/mesh_.name(); outputPath_ = outputPath_/mesh_.name();
} }
outputPath_.clean(); // Remove unneeded ".." outputPath_.clean(); // Remove unneeded ".."
read(dict); read(dict);

View File

@ -138,14 +138,17 @@ Foam::sampledSurfaces::sampledSurfaces
changedGeom_(), changedGeom_(),
formatter_(nullptr) formatter_(nullptr)
{ {
const fileName relPath(functionObject::outputPrefix/name);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
outputPath_ = mesh_.time().path()/".."/"postProcessing"/name; outputPath_ = mesh_.time().path()/".."/relPath;
} }
else else
{ {
outputPath_ = mesh_.time().path()/"postProcessing"/name; outputPath_ = mesh_.time().path()/relPath;
} }
outputPath_.clean(); // Remove unneeded ".." outputPath_.clean(); // Remove unneeded ".."
read(dict); read(dict);
@ -174,14 +177,17 @@ Foam::sampledSurfaces::sampledSurfaces
{ {
read(dict); read(dict);
const fileName relPath(functionObject::outputPrefix/name);
if (Pstream::parRun()) if (Pstream::parRun())
{ {
outputPath_ = time_.path()/".."/"postProcessing"/name; outputPath_ = time_.path()/".."/relPath;
} }
else else
{ {
outputPath_ = time_.path()/"postProcessing"/name; outputPath_ = time_.path()/relPath;
} }
outputPath_.clean(); // Remove unneeded ".." outputPath_.clean(); // Remove unneeded ".."
read(dict); read(dict);