From aec949d7cc7972182d0262593357f0a27394d318 Mon Sep 17 00:00:00 2001 From: Andrew Heather Date: Tue, 27 Feb 2018 14:37:05 +0000 Subject: [PATCH] ENH: Consistency improvement for setting postProcessing directory name --- .../mesh/manipulation/checkMesh/checkGeometry.C | 5 +++-- .../mesh/manipulation/checkMesh/checkTools.C | 7 ++++--- .../moveDynamicMesh/moveDynamicMesh.C | 5 +++-- .../profilingSummary/profilingSummary.C | 3 ++- .../functionObject/functionObject.C | 3 ++- .../functionObject/functionObject.H | 5 ++++- .../db/functionObjects/writeFile/writeFile.C | 10 +++------- .../db/functionObjects/writeFile/writeFile.H | 3 --- .../extractEulerianParticles.C | 4 ++-- .../field/streamLine/streamLineBase.C | 4 ++-- .../graphics/runTimePostProcessing/scene.C | 16 ++++++++++++---- .../CloudFunctionObject/CloudFunctionObject.C | 10 ++++++++-- .../noise/noiseModels/noiseModel/noiseModel.C | 3 ++- src/sampling/probes/probes.C | 3 ++- .../sampledSet/sampledSets/sampledSets.C | 16 ++++++++++++---- .../sampledSurfaces/sampledSurfaces.C | 14 ++++++++++---- 16 files changed, 71 insertions(+), 40 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index 42c6966161..a64e84e3bc 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -10,6 +10,7 @@ #include "polyMeshTetDecomposition.H" #include "surfaceWriter.H" #include "checkTools.H" +#include "functionObject.H" #include "vtkSurfaceWriter.H" #include "writer.H" @@ -1020,7 +1021,7 @@ Foam::label Foam::checkGeometry { wr.write ( - "postProcessing", + functionObject::outputPrefix, "src_" + tmName, meshedSurfRef ( @@ -1074,7 +1075,7 @@ Foam::label Foam::checkGeometry { wr.write ( - "postProcessing", + functionObject::outputPrefix, "tgt_" + tmName, meshedSurfRef ( diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index 27e6ff25f2..d3d7853436 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -41,6 +41,7 @@ License #include "syncTools.H" #include "globalIndex.H" #include "PatchTools.H" +#include "functionObject.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -285,7 +286,7 @@ void Foam::mergeAndWrite ( set.time().path() / (Pstream::parRun() ? ".." : "") - / "postProcessing" + / functionObject::outputPrefix / mesh.pointsInstance() / set.name() ); @@ -379,7 +380,7 @@ void Foam::mergeAndWrite ( set.time().path() / (Pstream::parRun() ? ".." : "") - / "postProcessing" + / functionObject::outputPrefix / mesh.pointsInstance() / set.name() ); @@ -483,7 +484,7 @@ void Foam::mergeAndWrite ( set.time().path() / (Pstream::parRun() ? ".." : "") - / "postProcessing" + / functionObject::outputPrefix / mesh.pointsInstance() // set.name() ); diff --git a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C index 09e8f35868..aa5403a641 100644 --- a/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C +++ b/applications/utilities/mesh/manipulation/moveDynamicMesh/moveDynamicMesh.C @@ -39,6 +39,7 @@ Description #include "vtkSurfaceWriter.H" #include "cyclicAMIPolyPatch.H" #include "PatchTools.H" +#include "functionObject.H" using namespace Foam; @@ -139,7 +140,7 @@ void writeWeights(const polyMesh& mesh) mesh, ami.tgtWeightsSum(), cpp.neighbPatch(), - "postProcessing", + functionObject::outputPrefix, "tgt", tmName ); @@ -148,7 +149,7 @@ void writeWeights(const polyMesh& mesh) mesh, ami.srcWeightsSum(), cpp, - "postProcessing", + functionObject::outputPrefix, "src", tmName ); diff --git a/applications/utilities/postProcessing/miscellaneous/profilingSummary/profilingSummary.C b/applications/utilities/postProcessing/miscellaneous/profilingSummary/profilingSummary.C index 2f5e508cc3..fd3b83558b 100644 --- a/applications/utilities/postProcessing/miscellaneous/profilingSummary/profilingSummary.C +++ b/applications/utilities/postProcessing/miscellaneous/profilingSummary/profilingSummary.C @@ -44,6 +44,7 @@ Description #include "stringOps.H" #include "timeSelector.H" #include "IOobjectList.H" +#include "functionObject.H" using namespace Foam; @@ -149,7 +150,7 @@ int main(int argc, char *argv[]) // Name/location for the output summary const fileName outputName { - "postProcessing", + functionObject::outputPrefix, "profiling", runTime.timeName(), profilingFileName diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C index a13a044157..da90401515 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -38,6 +38,7 @@ namespace Foam bool Foam::functionObject::postProcess(false); +Foam::word Foam::functionObject::outputPrefix("postProcessing"); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // diff --git a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H index 9f042bd231..6bd43b8c9e 100644 --- a/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H +++ b/src/OpenFOAM/db/functionObjects/functionObject/functionObject.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -172,6 +172,9 @@ public: //- Global post-processing mode switch static bool postProcess; + //- Directory prefix + static word outputPrefix; + //- Switch write log to Info Switch log; diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C index 07944fad3e..48f4e217bc 100644 --- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C +++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.C @@ -27,14 +27,10 @@ License #include "Time.H" #include "polyMesh.H" #include "IFstream.H" +#include "functionObject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -const Foam::word Foam::functionObjects::writeFile::outputPrefix -( - "postProcessing" -); - 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 // distributed data running) - baseDir = baseDir/".."/outputPrefix; + baseDir = baseDir/".."/functionObject::outputPrefix; } else { - baseDir = baseDir/outputPrefix; + baseDir = baseDir/functionObject::outputPrefix; } // Append mesh name if not default region diff --git a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H index 75160c7d8d..6d58cb29fc 100644 --- a/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H +++ b/src/OpenFOAM/db/functionObjects/writeFile/writeFile.H @@ -117,9 +117,6 @@ private: public: - //- Directory prefix - static const word outputPrefix; - //- Additional characters for writing static label addChars; diff --git a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C index ad40fcf5f7..3614fb336a 100644 --- a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C +++ b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C @@ -63,11 +63,11 @@ Foam::functionObjects::extractEulerianParticles::dictBaseFileDir() const { // Put in undecomposed case (Note: gives problems for // distributed data running) - baseDir = baseDir/".."/"postProcessing"; + baseDir = baseDir/".."/functionObject::outputPrefix; } else { - baseDir = baseDir/"postProcessing"; + baseDir = baseDir/functionObject::outputPrefix; } return baseDir; diff --git a/src/functionObjects/field/streamLine/streamLineBase.C b/src/functionObjects/field/streamLine/streamLineBase.C index 002ee2716c..8b9728b8ba 100644 --- a/src/functionObjects/field/streamLine/streamLineBase.C +++ b/src/functionObjects/field/streamLine/streamLineBase.C @@ -647,8 +647,8 @@ bool Foam::functionObjects::streamLineBase::writeToFile() fileName vtkPath ( Pstream::parRun() - ? time_.path()/".."/"postProcessing"/"sets"/name() - : time_.path()/"postProcessing"/"sets"/name() + ? time_.path()/".."/functionObject::outputPrefix/"sets"/name() + : time_.path()/functionObject::outputPrefix/"sets"/name() ); if (mesh_.name() != fvMesh::defaultRegion) { diff --git a/src/functionObjects/graphics/runTimePostProcessing/scene.C b/src/functionObjects/graphics/runTimePostProcessing/scene.C index e39f3010e5..2cdb11df5e 100644 --- a/src/functionObjects/graphics/runTimePostProcessing/scene.C +++ b/src/functionObjects/graphics/runTimePostProcessing/scene.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -389,9 +389,17 @@ void Foam::functionObjects::runTimePostPro::scene::saveImage const Time& runTime = obr_.time(); - fileName prefix(Pstream::parRun() ? - runTime.path()/".."/"postProcessing"/name_/obr_.time().timeName() : - runTime.path()/"postProcessing"/name_/obr_.time().timeName()); + const fileName relPath + ( + functionObject::outputPrefix/name_/obr_.time().timeName() + ); + + fileName prefix + ( + Pstream::parRun() ? + runTime.path()/".."/relPath + : runTime.path()/relPath + ); mkDir(prefix); diff --git a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C index 716845fc67..11edced4d8 100644 --- a/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C +++ b/src/lagrangian/intermediate/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "CloudFunctionObject.H" +#include "functionObject.H" // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -56,8 +57,13 @@ Foam::CloudFunctionObject::CloudFunctionObject CloudSubModelBase(modelName, owner, dict, typeName, objectType), outputDir_(owner.mesh().time().path()) { - const fileName relPath = - "postProcessing"/cloud::prefix/owner.name()/this->modelName(); + const fileName relPath + ( + functionObject::outputPrefix + /cloud::prefix + /owner.name() + /this->modelName() + ); if (Pstream::parRun()) diff --git a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C index a6292ae193..26d08d2354 100644 --- a/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C +++ b/src/randomProcesses/noise/noiseModels/noiseModel/noiseModel.C @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "noiseModel.H" +#include "functionObject.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -143,7 +144,7 @@ Foam::fileName Foam::noiseModel::baseFileDir(const label dataseti) const word datasetName("input" + Foam::name(dataseti)); baseDir = baseDir.expand() - /"postProcessing" + /functionObject::outputPrefix /"noise" /outputPrefix_ /type() diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index a41839cade..8da9d44538 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -202,7 +202,8 @@ Foam::label Foam::probes::prepare() { probeSubDir = probeSubDir/mesh_.name(); } - probeSubDir = "postProcessing"/probeSubDir/mesh_.time().timeName(); + probeSubDir = + functionObject::outputPrefix/probeSubDir/mesh_.time().timeName(); if (Pstream::parRun()) { diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index 014a30a8c2..567aed5112 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -97,18 +97,22 @@ Foam::sampledSets::sampledSets interpolationScheme_(word::null), writeFormat_(word::null) { + const fileName relPath(functionObject::outputPrefix/name); + if (Pstream::parRun()) { - outputPath_ = mesh_.time().path()/".."/"postProcessing"/name; + outputPath_ = mesh_.time().path()/".."/relPath; } else { - outputPath_ = mesh_.time().path()/"postProcessing"/name; + outputPath_ = mesh_.time().path()/relPath; } + if (mesh_.name() != fvMesh::defaultRegion) { outputPath_ = outputPath_/mesh_.name(); } + outputPath_.clean(); // Remove unneeded ".." read(dict); @@ -132,18 +136,22 @@ Foam::sampledSets::sampledSets interpolationScheme_(word::null), writeFormat_(word::null) { + const fileName relPath(functionObject::outputPrefix/name); + if (Pstream::parRun()) { - outputPath_ = mesh_.time().path()/".."/"postProcessing"/name; + outputPath_ = mesh_.time().path()/".."/relPath; } else { - outputPath_ = mesh_.time().path()/"postProcessing"/name; + outputPath_ = mesh_.time().path()/relPath; } + if (mesh_.name() != fvMesh::defaultRegion) { outputPath_ = outputPath_/mesh_.name(); } + outputPath_.clean(); // Remove unneeded ".." read(dict); diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 721b684b6c..1955a83315 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -138,14 +138,17 @@ Foam::sampledSurfaces::sampledSurfaces changedGeom_(), formatter_(nullptr) { + const fileName relPath(functionObject::outputPrefix/name); + if (Pstream::parRun()) { - outputPath_ = mesh_.time().path()/".."/"postProcessing"/name; + outputPath_ = mesh_.time().path()/".."/relPath; } else { - outputPath_ = mesh_.time().path()/"postProcessing"/name; + outputPath_ = mesh_.time().path()/relPath; } + outputPath_.clean(); // Remove unneeded ".." read(dict); @@ -174,14 +177,17 @@ Foam::sampledSurfaces::sampledSurfaces { read(dict); + const fileName relPath(functionObject::outputPrefix/name); + if (Pstream::parRun()) { - outputPath_ = time_.path()/".."/"postProcessing"/name; + outputPath_ = time_.path()/".."/relPath; } else { - outputPath_ = time_.path()/"postProcessing"/name; + outputPath_ = time_.path()/relPath; } + outputPath_.clean(); // Remove unneeded ".." read(dict);