diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C index e182adaacf..6c37d71fa4 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkTools.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkTools.C @@ -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(); diff --git a/src/functionObjects/field/layerAverage/layerAverage.C b/src/functionObjects/field/layerAverage/layerAverage.C index 0055b9cdc0..0076d941e8 100644 --- a/src/functionObjects/field/layerAverage/layerAverage.C +++ b/src/functionObjects/field/layerAverage/layerAverage.C @@ -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 ( diff --git a/src/functionObjects/field/streamlines/streamlines.C b/src/functionObjects/field/streamlines/streamlines.C index c870ed8c23..123e0765ae 100644 --- a/src/functionObjects/field/streamlines/streamlines.C +++ b/src/functionObjects/field/streamlines/streamlines.C @@ -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 diff --git a/src/lagrangian/parcel/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C b/src/lagrangian/parcel/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C index 4519dc785b..83ba356283 100644 --- a/src/lagrangian/parcel/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C +++ b/src/lagrangian/parcel/submodels/CloudFunctionObjects/CloudFunctionObject/CloudFunctionObject.C @@ -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::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; } diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index 28057672a4..36e1aaf5f9 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -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, probeFilePtrs_, iter) diff --git a/src/sampling/sampledSet/sampledSets/sampledSets.C b/src/sampling/sampledSet/sampledSets/sampledSets.C index bbf9f73c1a..fbf763e760 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSets.C +++ b/src/sampling/sampledSet/sampledSets/sampledSets.C @@ -111,19 +111,17 @@ Foam::functionObjects::sampledSets::sampledSets : fvMeshFunctionObject(name, t, dict), PtrList(), - 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); } diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 498addb005..e05970846a 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -165,21 +165,19 @@ Foam::functionObjects::sampledSurfaces::sampledSurfaces : fvMeshFunctionObject(name, t, dict), PtrList(), - 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); }