diff --git a/src/OSspecific/MSwindows/MSwindows.C b/src/OSspecific/MSwindows/MSwindows.C index 099ee6e3f1..fb6f9111ab 100644 --- a/src/OSspecific/MSwindows/MSwindows.C +++ b/src/OSspecific/MSwindows/MSwindows.C @@ -940,13 +940,24 @@ bool Foam::ln(const fileName& src, const fileName& dst) if (MSwindows::debug) { - Info<< "MSwindows does not support ln - softlinking" << endl; + Info<< "MSwindows does not support softlinks" << endl; } return false; } +Foam::fileName Foam::readLink(const fileName& link) +{ + if (MSwindows::debug) + { + Info<< "MSwindows does not support softlinks" << endl; + } + + return fileName(); +} + + bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink) { if (MSwindows::debug) @@ -954,7 +965,7 @@ bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink) Info<< "Move : " << src << " to " << dst << endl; } - // Ignore an empty names => always false + // Ignore empty names => always false if (src.empty() || dst.empty()) { return false; diff --git a/src/OSspecific/POSIX/POSIX.C b/src/OSspecific/POSIX/POSIX.C index 84223aebc7..93c4709119 100644 --- a/src/OSspecific/POSIX/POSIX.C +++ b/src/OSspecific/POSIX/POSIX.C @@ -1169,7 +1169,7 @@ bool Foam::ln(const fileName& src, const fileName& dst) { //InfoInFunction Pout<< FUNCTION_NAME - << " : Create softlink from : " << src << " to " << dst << endl; + << " : Create symlink from : " << src << " to " << dst << endl; if ((POSIX::debug & 2) && !Pstream::master()) { error::printStack(Pout); @@ -1216,6 +1216,40 @@ bool Foam::ln(const fileName& src, const fileName& dst) } +Foam::fileName Foam::readLink(const fileName& link) +{ + if (POSIX::debug) + { + //InfoInFunction + Pout<< FUNCTION_NAME + << " : Returning symlink destination for : " << link << endl; + if ((POSIX::debug & 2) && !Pstream::master()) + { + error::printStack(Pout); + } + } + + if (link.empty()) + { + // Treat an empty path as a no-op. + return fileName(); + } + + fileName result; + result.resize(1024); // Should be large enough (mostly relative anyhow) + + ssize_t len = ::readlink(link.c_str(), &(result.front()), result.size()); + if (len > 0) + { + result.resize(len); + return result; + } + + // Failure: return empty result + return fileName(); +} + + bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink) { if (POSIX::debug) @@ -1228,7 +1262,7 @@ bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink) } } - // Ignore an empty names => always false + // Ignore empty names => always false if (src.empty() || dst.empty()) { return false; diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index defc0a8b4e..42143444dc 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -195,13 +195,14 @@ void Foam::Time::setControls() // Check if time directory exists // If not increase time precision to see if it is formatted differently. - // Note: do not use raw fileHandler().exists(...) since does not check + // Note: - do not use raw fileHandler().exists(...) since does not check // alternative processorsDDD directories naming - if (fileHandler().filePath(timePath()).empty()) + // - do not look for compressed (is directory) + + if (fileHandler().filePath(timePath(), false).empty()) { - int oldPrecision = precision_; + const int oldPrecision = precision_; int requiredPrecision = -1; - bool found = false; word oldTime(timeName()); for ( @@ -218,14 +219,10 @@ void Foam::Time::setControls() { break; } - oldTime = newTime; + oldTime = std::move(newTime); - // Check the existence of the time directory with the new format - //found = fileHandler().exists(timePath(), false); - const fileName dirName(fileHandler().filePath(timePath())); - found = !dirName.empty(); - - if (found) + // Does a time directory exist with the new format? + if (!fileHandler().filePath(timePath(), false).empty()) { requiredPrecision = precision_; } diff --git a/src/OpenFOAM/db/Time/Time.H b/src/OpenFOAM/db/Time/Time.H index da2d6c9731..ec329333e7 100644 --- a/src/OpenFOAM/db/Time/Time.H +++ b/src/OpenFOAM/db/Time/Time.H @@ -414,6 +414,15 @@ public: return runTimeModifiable_; } + //- Set re-reading support on/off (use with caution). + // \return the previous value + Switch runTimeModifiable(const Switch sw) noexcept + { + Switch old(runTimeModifiable_); + runTimeModifiable_ = sw; + return old; + } + //- Read control dictionary, update controls and time virtual bool read(); diff --git a/src/OpenFOAM/db/Time/TimeIO.C b/src/OpenFOAM/db/Time/TimeIO.C index cb7afcb785..a111245528 100644 --- a/src/OpenFOAM/db/Time/TimeIO.C +++ b/src/OpenFOAM/db/Time/TimeIO.C @@ -579,7 +579,8 @@ bool Foam::Time::writeObject ( fileHandler().filePath ( - objectRegistry::path(previousWriteTimes_.pop()) + objectRegistry::path(previousWriteTimes_.pop()), + false // No .gz check (is directory) ) ); } diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 19e739f569..9d7b3b648a 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -241,6 +241,51 @@ static void printHostsSubscription(const UList& hostProcs) Info<< ')' << nl; } + +static bool printRootsSubscription +( + const UList& hostProcs, + const UList& roots +) +{ + if (hostProcs.size() == roots.size()+1) + { + // Sort roots according to hostProc + DynamicList sortedProcs; + DynamicList