diff --git a/applications/test/argList/Test-argList.C b/applications/test/argList/Test-argList.C index adb36e383515157da60659557da3db51520ba60b..c882b855207631ab83a841607f11af9c266b6670 100644 --- a/applications/test/argList/Test-argList.C +++ b/applications/test/argList/Test-argList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2017 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2017-2018 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,11 +38,13 @@ using namespace Foam; int main(int argc, char *argv[]) { argList::noBanner(); - argList::noParallel(); + argList::noCheckProcessorDirectories(); // parallel OK, but without checks + // argList::noFunctionObjects(); argList::addOption("label", "value", "Test parsing of label"); argList::addOption("scalar", "value", "Test parsing of scalar"); argList::addOption("string", "value", "Test string lookup"); + argList::addOption("relative", "PATH", "Test relativePath"); // These are actually lies (never had -parseLabel, -parseScalar etc), // but good for testing... @@ -70,20 +72,27 @@ int main(int argc, char *argv[]) argList::addArgument("label"); argList::noMandatoryArgs(); - argList args(argc, argv); + #include "setRootCase.H" - Info<< "command-line (" + Pout<< "command-line (" << args.options().size() << " options, " << args.args().size() << " args)" << nl << " " << args.commandLine().c_str() << nl << nl; - Info<< "rootPath: " << args.rootPath() << nl + Pout<< "rootPath: " << args.rootPath() << nl << "globalCase: " << args.globalCaseName() << nl << "globalPath: " << args.globalPath() << nl << nl; - Info<<"have: " - <<args.count({"label", "scalar"}) << " options" << nl; + if (args.found("relative")) + { + Pout<< "input path: " << args["relative"] << nl + << "relative : " << args.relativePath(args["relative"], true) << nl + << nl; + } + + Info<< "have: " + << args.count({"label", "scalar"}) << " options" << nl; label ival; scalar sval; diff --git a/applications/test/timeSelector/Test-timeSelector.C b/applications/test/timeSelector/Test-timeSelector.C index dd025fa952c1938737b2fb493c25610a1c665504..b901908a68c5e151b0a218116c45324d6a51f978 100644 --- a/applications/test/timeSelector/Test-timeSelector.C +++ b/applications/test/timeSelector/Test-timeSelector.C @@ -27,7 +27,7 @@ Description #include "argList.H" #include "IOstreams.H" -#include "TimePaths.H" +#include "Time.H" #include "timeSelector.H" using namespace Foam; @@ -58,13 +58,31 @@ bool print(const instantList& instants) int main(int argc, char *argv[]) { - argList::addNote("Test timeSelector"); + argList::addNote("Test timeSelector and TimePaths"); timeSelector::addOptions(true, true); argList::noLibs(); argList::noFunctionObjects(); + argList::addOption("relative", "PATH", "Test relativePath"); + #include "setRootCase.H" + #include "createTime.H" + + Pout<< "Time" << nl + << "rootPath: " << runTime.rootPath() << nl + << "path: " << runTime.path() << nl + << "globalCase: " << runTime.globalCaseName() << nl + << "globalPath: " << runTime.globalPath() << nl + << nl; + + if (args.found("relative")) + { + Pout<< "input path: " << args["relative"] << nl + << "relative : " << runTime.relativePath(args["relative"], true) + << nl + << nl; + } autoPtr<TimePaths> timePaths; diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H index 9a2596b826182c16ed77432c14d1736e49091455..2719ccc85a4442365ea886b13af5f6159f13ce6e 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertLagrangian.H @@ -94,7 +94,7 @@ if (doLagrangian) ); Info<< " Lagrangian: " - << writer.output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer.output()) << nl; writer.writeTimeValue(mesh.time().value()); writer.writeGeometry(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H index 75c7fb171e8fd35159124548faa83179201e6110..5ab48ff99d95b685f0dd41c44dc71e77bfbc72de 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertSurfaceFields.H @@ -107,7 +107,7 @@ Description ); Info<< " Surface : " - << writer.output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer.output()) << nl; writer.writeTimeValue(timeValue); @@ -211,7 +211,7 @@ Description ); Info<< " FaceZone : " - << writer.output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer.output()) << nl; writer.beginFile(fz.name()); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H index 49111ea890cbe4ba603e9086527a92ce7900eda0..e2a96e898f7a2f9dd11169b4cba419d5dd0406bc 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertTopoSet.H @@ -42,7 +42,7 @@ if (faceSetName.size()) ); Info<< " faceSet : " - << outputName.relative(runTime.globalPath()) << nl; + << runTime.relativePath(outputName) << nl; vtk::writeFaceSet ( @@ -70,7 +70,7 @@ if (pointSetName.size()) ); Info<< " pointSet : " - << outputName.relative(runTime.globalPath()) << nl; + << runTime.relativePath(outputName) << nl; vtk::writePointSet ( diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H index ad8802f6a6f88b6a83e70a4924a02f757fee5e95..763b3fa3d9fd93b77690ca57492e5ed4e540d5d2 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/convertVolumeFields.H @@ -113,7 +113,7 @@ Description ); Info<< " Internal : " - << internalWriter->output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(internalWriter->output()) << nl; internalWriter->writeTimeValue(mesh.time().value()); internalWriter->writeGeometry(); @@ -163,7 +163,7 @@ Description ); Info<< " Boundaries: " - << writer->output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer->output()) << nl; writer->writeTimeValue(timeValue); writer->writeGeometry(); @@ -229,7 +229,7 @@ Description ); Info<< " Boundary : " - << writer->output().relative(runTime.globalPath()) << nl; + << runTime.relativePath(writer->output()) << nl; writer->writeTimeValue(timeValue); writer->writeGeometry(); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 7c743c1619280ffd63b1f8c0e17ad33c8726de68..b584822c211b3401b55cde5bd2aaa891a63bb6de 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -650,7 +650,7 @@ int main(int argc, char *argv[]) if (args.found("overwrite") && isDir(regionDir)) { Info<< "Removing old directory " - << regionDir.relative(runTime.globalPath()) + << runTime.relativePath(regionDir) << nl << endl; rmDir(regionDir); } diff --git a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C index 0c2f9c06fb5b061a064d517573bb3fbddb836ee9..344bd2a58dad0b1ea0cdb483fa7afbf0a586687a 100644 --- a/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C +++ b/applications/utilities/surface/surfaceFeatureExtract/surfaceFeatureExtract.C @@ -693,8 +693,7 @@ int main(int argc, char *argv[]) vtkWriter->writeGeometry(); Info<< "Writing VTK to " - << ((vtkOutputDir/outputName).ext(vtkWriter->ext())) - .relative(runTime.globalPath()) << nl; + << runTime.relativePath(vtkWriter->output()) << nl; } } else diff --git a/src/OpenFOAM/db/IOobject/IOobjectIO.C b/src/OpenFOAM/db/IOobject/IOobjectIO.C index d1a51dddb5a973a32953adf3a2547baa66875017..217ca84fff36e66fd1bc298279e62b8a1e7f2e15 100644 --- a/src/OpenFOAM/db/IOobject/IOobjectIO.C +++ b/src/OpenFOAM/db/IOobject/IOobjectIO.C @@ -35,11 +35,12 @@ Foam::Ostream& Foam::operator<<(Ostream& os, const InfoProxy<IOobject>& ip) os << "IOobject: " << io.type() << token::SPACE - << io.name() << token::SPACE - << "readOpt:" << token::SPACE << io.readOpt() << token::SPACE - << "writeOpt:" << token::SPACE << io.writeOpt() << token::SPACE - << "globalObject:" << token::SPACE << io.globalObject() << token::SPACE - << io.path() << endl; + << io.name() + << " local: " << io.local() + << " readOpt: " << io.readOpt() + << " writeOpt: " << io.writeOpt() + << " globalObject: " << io.globalObject() + << token::SPACE << io.path() << endl; return os; } diff --git a/src/OpenFOAM/db/Time/TimePaths.C b/src/OpenFOAM/db/Time/TimePaths.C index 78378463ab052471b423fa6128e1bdc8525d3c10..4ef6c8d4485778a9236669e272a869e222cda848 100644 --- a/src/OpenFOAM/db/Time/TimePaths.C +++ b/src/OpenFOAM/db/Time/TimePaths.C @@ -133,28 +133,6 @@ Foam::TimePaths::TimePaths // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::fileName Foam::TimePaths::caseSystem() const -{ - if (processorCase_) - { - return ".."/system(); - } - - return system(); -} - - -Foam::fileName Foam::TimePaths::caseConstant() const -{ - if (processorCase_) - { - return ".."/constant(); - } - - return constant(); -} - - Foam::instantList Foam::TimePaths::findTimes ( const fileName& directory, diff --git a/src/OpenFOAM/db/Time/TimePaths.H b/src/OpenFOAM/db/Time/TimePaths.H index 55b6901d243d553d1457b1bb34fa7518039d35b9..94036dfcc4d67848e290e57e8ac30901258056c4 100644 --- a/src/OpenFOAM/db/Time/TimePaths.H +++ b/src/OpenFOAM/db/Time/TimePaths.H @@ -108,86 +108,64 @@ public: // Member Functions + //- True if case running with parallel distributed directories + //- (ie. not NFS mounted) + inline bool distributed() const; + //- Return true if this is a processor case - bool processorCase() const - { - return processorCase_; - } + inline bool processorCase() const; //- Return root path - const fileName& rootPath() const - { - return rootPath_; - } + inline const fileName& rootPath() const; //- Return global case name - const fileName& globalCaseName() const - { - return globalCaseName_; - } + inline const fileName& globalCaseName() const; //- Return case name - const fileName& caseName() const - { - return case_; - } + inline const fileName& caseName() const; - //- Return case name - fileName& caseName() - { - return case_; - } + //- The case name for modification (use with caution) + inline fileName& caseName(); - //- Return system name - const word& system() const - { - return system_; - } + //- Return path for the case + inline fileName path() const; + + //- Return global path for the case + inline fileName globalPath() const; + + //- Return the input relative to the globalPath by stripping off + //- a leading value of the globalPath + // + // \param input the directory or filename to make case-relative + // \param caseTag replace globalPath with \<case\> for later + // use with expand(), or prefix \<case\> if the file name was + // not an absolute location + inline fileName relativePath + ( + const fileName& input, + const bool caseTag = false + ) const; - //- Return the system name for the case, which is - //- \c ../system() for parallel runs. - fileName caseSystem() const; //- Return constant name - const word& constant() const - { - return constant_; - } - - //- Is case running with parallel distributed directories - // (i.e. not NFS mounted) - bool distributed() const - { - return distributed_; - } + inline const word& constant() const; + + //- Return system name + inline const word& system() const; //- Return the constant name for the case, which is //- \c ../constant() for parallel runs. - fileName caseConstant() const; + inline fileName caseConstant() const; - //- Return path for the case - fileName path() const - { - return rootPath()/caseName(); - } + //- Return the system name for the case, which is + //- \c ../system() for parallel runs. + inline fileName caseSystem() const; - //- Return global path for the case - fileName globalPath() const - { - return rootPath()/globalCaseName(); - } + //- Return constant path + inline fileName constantPath() const; //- Return system path - fileName systemPath() const - { - return path()/system(); - } - - //- Return constant path - fileName constantPath() const - { - return path()/constant(); - } + inline fileName systemPath() const; // Searching @@ -223,6 +201,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "TimePathsI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/TimePathsI.H b/src/OpenFOAM/db/Time/TimePathsI.H new file mode 100644 index 0000000000000000000000000000000000000000..d6f5b3f69a4074b34ee2e04119158f2cd55f5204 --- /dev/null +++ b/src/OpenFOAM/db/Time/TimePathsI.H @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2018 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline bool Foam::TimePaths::distributed() const +{ + return distributed_; +} + + +inline bool Foam::TimePaths::processorCase() const +{ + return processorCase_; +} + + +inline const Foam::fileName& Foam::TimePaths::rootPath() const +{ + return rootPath_; +} + + +inline const Foam::fileName& Foam::TimePaths::globalCaseName() const +{ + return globalCaseName_; +} + + +inline const Foam::fileName& Foam::TimePaths::caseName() const +{ + return case_; +} + + +inline Foam::fileName& Foam::TimePaths::caseName() +{ + return case_; +} + + +inline Foam::fileName Foam::TimePaths::path() const +{ + return rootPath()/caseName(); +} + + +inline Foam::fileName Foam::TimePaths::globalPath() const +{ + return rootPath()/globalCaseName(); +} + + +inline Foam::fileName Foam::TimePaths::relativePath +( + const fileName& input, + const bool caseTag +) const +{ + return input.relative(globalPath(), caseTag); +} + + +inline const Foam::word& Foam::TimePaths::constant() const +{ + return constant_; +} + + +inline const Foam::word& Foam::TimePaths::system() const +{ + return system_; +} + + +inline Foam::fileName Foam::TimePaths::caseConstant() const +{ + if (processorCase_) + { + return ".."/constant(); + } + + return constant(); +} + + +inline Foam::fileName Foam::TimePaths::caseSystem() const +{ + if (processorCase_) + { + return ".."/system(); + } + + return system(); +} + + +inline Foam::fileName Foam::TimePaths::constantPath() const +{ + return path()/constant(); +} + + +inline Foam::fileName Foam::TimePaths::systemPath() const +{ + return path()/system(); +} + + +// ************************************************************************* // diff --git a/src/OpenFOAM/db/Time/TimeStateI.H b/src/OpenFOAM/db/Time/TimeStateI.H index bb572c776a10f905febe966ca8f60494a91ba2f5..39fb8b331a6dd0aa864b2261c3feda6a797f2ed5 100644 --- a/src/OpenFOAM/db/Time/TimeStateI.H +++ b/src/OpenFOAM/db/Time/TimeStateI.H @@ -25,7 +25,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - inline Foam::scalar Foam::TimeState::timeOutputValue() const { return timeToUserTime(value()); diff --git a/src/OpenFOAM/global/argList/argList.H b/src/OpenFOAM/global/argList/argList.H index 9c6637ee3ea1384c320397c03f17ac236a9d34ba..379c6617d2d3547dd1c86322aa734def9531fb7c 100644 --- a/src/OpenFOAM/global/argList/argList.H +++ b/src/OpenFOAM/global/argList/argList.H @@ -304,6 +304,19 @@ public: // \note This is guaranteed to be an absolute path inline fileName globalPath() const; + //- Return the input relative to the globalPath by stripping off + //- a leading value of the globalPath + // + // \param input the directory or filename to make case-relative + // \param caseTag replace globalPath with \<case\> for later + // use with expand(), or prefix \<case\> if the file name was + // not an absolute location + inline fileName relativePath + ( + const fileName& input, + const bool caseTag = false + ) const; + //- Return distributed flag //- (i.e. are rootPaths different on different machines) inline bool distributed() const; diff --git a/src/OpenFOAM/global/argList/argListI.H b/src/OpenFOAM/global/argList/argListI.H index b7e3915b47594bb78fc0866160d84e2a552168fe..a01e7a4413cde243a4a4198ffb0430341f2a9fd3 100644 --- a/src/OpenFOAM/global/argList/argListI.H +++ b/src/OpenFOAM/global/argList/argListI.H @@ -87,6 +87,16 @@ inline Foam::fileName Foam::argList::globalPath() const } +inline Foam::fileName Foam::argList::relativePath +( + const fileName& input, + const bool caseTag +) const +{ + return input.relative(globalPath(), caseTag); +} + + inline bool Foam::argList::distributed() const { return parRunControl_.distributed(); diff --git a/src/OpenFOAM/include/foamVersion.H b/src/OpenFOAM/include/foamVersion.H index 5f521bebb03801fbaa18d52ba412a958ee13bccc..21265e36ee3d186b826348f66bd9ad735bb0547f 100644 --- a/src/OpenFOAM/include/foamVersion.H +++ b/src/OpenFOAM/include/foamVersion.H @@ -96,7 +96,7 @@ namespace Foam //- OpenFOAM version (name or stringified number) as a std::string extern const std::string version; - //- Test if the patch string appeared to be in use, + //- Test if the patch string appears to be in use, //- which is when it is defined (non-zero). bool patched(); diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.C b/src/OpenFOAM/primitives/strings/fileName/fileName.C index 1ef148b3e76f0e569159bb6ff0c1b4ac3df0d33c..f7154ea106ee92e0f7d04453f1cf027e6c2f78ef 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.C +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.C @@ -367,7 +367,7 @@ std::string Foam::fileName::nameLessExt(const std::string& str) Foam::fileName Foam::fileName::relative ( const fileName& parent, - const bool caseRelative + const bool caseTag ) const { const auto top = parent.size(); @@ -383,7 +383,7 @@ Foam::fileName Foam::fileName::relative && f.startsWith(parent) ) { - if (caseRelative) + if (caseTag) { return "<case>"/f.substr(top+1); } @@ -392,7 +392,7 @@ Foam::fileName Foam::fileName::relative return f.substr(top+1); } } - else if (caseRelative && f.size() && !f.isAbsolute()) + else if (caseTag && f.size() && !f.isAbsolute()) { return "<case>"/f; } diff --git a/src/OpenFOAM/primitives/strings/fileName/fileName.H b/src/OpenFOAM/primitives/strings/fileName/fileName.H index c760d1956f0dcd8f681ab6adbd839116f1a374d0..f082a8bbc572517929ff8eaab0304462a9d913f0 100644 --- a/src/OpenFOAM/primitives/strings/fileName/fileName.H +++ b/src/OpenFOAM/primitives/strings/fileName/fileName.H @@ -294,13 +294,13 @@ public: //- where possible. // // \param parent the parent directory - // \param caseRelative replace the parent with \<case\> for later + // \param caseTag replace the parent with \<case\> for later // use with expand(), or prefix \<case\> if the file name was // not an absolute location fileName relative ( const fileName& parent, - const bool caseRelative = false + const bool caseTag = false ) const; //- Return file name without extension (part before last .) diff --git a/src/functionObjects/field/streamLine/streamLineBase.C b/src/functionObjects/field/streamLine/streamLineBase.C index 8806a14ee726fa33f9bbf9129948ac3929cb650b..470c37b7872c72adf486f11042aef8c9537a79d4 100644 --- a/src/functionObjects/field/streamLine/streamLineBase.C +++ b/src/functionObjects/field/streamLine/streamLineBase.C @@ -786,7 +786,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile() propsDict.add ( "file", - scalarVtkFile.relative(time_.globalPath(), true) + time_.relativePath(scalarVtkFile, true) ); setProperty(fieldName, propsDict); } @@ -798,7 +798,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile() propsDict.add ( "file", - vectorVtkFile.relative(time_.globalPath(), true) + time_.relativePath(vectorVtkFile, true) ); setProperty(fieldName, propsDict); } diff --git a/src/functionObjects/lagrangian/dataCloud/dataCloud.C b/src/functionObjects/lagrangian/dataCloud/dataCloud.C index bf303c92a30f104f4e3324620931bfe053b80ec7..f7327c91652cb2d48b53ccdb3837ffe846293c58 100644 --- a/src/functionObjects/lagrangian/dataCloud/dataCloud.C +++ b/src/functionObjects/lagrangian/dataCloud/dataCloud.C @@ -238,7 +238,7 @@ bool Foam::functionObjects::dataCloud::write() if (writeCloud(outputName, cloudName)) { Log << " cloud : " - << outputName.relative(time_.globalPath()) << endl; + << time_.relativePath(outputName) << endl; } } diff --git a/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C b/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C index 6bec0a8aa40ba32086325e0b33bb7377a29936de..40887680c31f90741ad4a77c531f443dbd58ed7c 100644 --- a/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C +++ b/src/functionObjects/lagrangian/vtkCloud/vtkCloud.C @@ -318,13 +318,12 @@ bool Foam::functionObjects::vtkCloud::writeCloud // } // } - // Shorten file name to be case-local and use "<case>" shortcut - // to make the content relocatable + // Case-local file name with "<case>" to make relocatable dictionary propsDict; propsDict.add ( "file", - file.relative(time_.globalPath(), true) + time_.relativePath(file, true) ); propsDict.add("fields", written); @@ -503,7 +502,7 @@ bool Foam::functionObjects::vtkCloud::write() if (writeCloud(outputName, cloudName)) { Log << " cloud : " - << outputName.relative(time_.globalPath()) << endl; + << time_.relativePath(outputName) << endl; if (Pstream::master()) { diff --git a/src/functionObjects/utilities/vtkWrite/vtkWrite.C b/src/functionObjects/utilities/vtkWrite/vtkWrite.C index dfc6ad1fb084768dfe40c8606ebb79722272ce5d..11aed863545c74ae1da905f1d405880f4270ade7 100644 --- a/src/functionObjects/utilities/vtkWrite/vtkWrite.C +++ b/src/functionObjects/utilities/vtkWrite/vtkWrite.C @@ -380,7 +380,7 @@ bool Foam::functionObjects::vtkWrite::write() ); Info<< " Internal : " - << internalWriter->output().relative(time_.globalPath()) + << time_.relativePath(internalWriter->output()) << endl; // No sub-block for internal @@ -432,7 +432,7 @@ bool Foam::functionObjects::vtkWrite::write() ); Info<< " Boundaries: " - << writer->output().relative(time_.globalPath()) << nl; + << time_.relativePath(writer->output()) << nl; writer->writeTimeValue(timeValue); @@ -497,7 +497,7 @@ bool Foam::functionObjects::vtkWrite::write() ); Info<< " Boundary : " - << writer->output().relative(time_.globalPath()) << nl; + << time_.relativePath(writer->output()) << nl; writer->writeTimeValue(timeValue); writer->writeGeometry(); diff --git a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C index 9fef162add63c237abafb5248fa0579ef8172872..c8855bf828462dd24bef882481c1915ec63f97da 100644 --- a/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C +++ b/src/sampling/sampledSet/sampledSets/sampledSetsTemplates.C @@ -338,8 +338,7 @@ 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 + // Case-local file name with "<case>" to make relocatable forAll(masterFields, fieldi) { @@ -347,7 +346,7 @@ void Foam::sampledSets::sampleAndWrite(fieldGroup<Type>& fields) propsDict.add ( "file", - sampleFile.relative(time_.globalPath(), true) + time_.relativePath(sampleFile, true) ); const word& fieldName = masterFields[fieldi].name(); diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 3976bde6f73c90b43fcd0b5caed77d2f7a7268e3..5a028345afeb0547c18845c5f04fd75654f6d51b 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -95,14 +95,13 @@ 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 + // Case-local file name with "<case>" to make relocatable dictionary propsDict; propsDict.add ( "file", - sampleFile.relative(time_.globalPath(), true) + time_.relativePath(sampleFile, true) ); setProperty(fieldName, propsDict); } @@ -123,14 +122,13 @@ void Foam::sampledSurfaces::writeSurface s.interpolate() ); - // Case-local filename and "<case>" shortcut for readable output - // and for possibly relocation of files + // Case-local file name with "<case>" to make relocatable dictionary propsDict; propsDict.add ( "file", - fName.relative(time_.globalPath(), true) + time_.relativePath(fName, true) ); setProperty(fieldName, propsDict); }