diff --git a/bin/tools/CleanFunctions b/bin/tools/CleanFunctions index 7390c3640..7be55f059 100644 --- a/bin/tools/CleanFunctions +++ b/bin/tools/CleanFunctions @@ -2,7 +2,7 @@ # ========= | # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | -# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation +# \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation # \\/ M anipulation | #------------------------------------------------------------------------------ # License @@ -56,6 +56,7 @@ cleanCase() cleanDynamicCode rm -rf processor* > /dev/null 2>&1 + rm -rf jobInfo > /dev/null 2>&1 rm -rf postProcessing > /dev/null 2>&1 rm -rf TDAC > /dev/null 2>&1 rm -rf probes* > /dev/null 2>&1 diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 22d09ec22..ce45118c4 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -895,7 +895,7 @@ void Foam::argList::parse { jobInfo_.add("roots", roots); } - jobInfo_.write(rootPath_/globalCase_); + jobInfo_.write(executable_, rootPath_/globalCase_); // Switch on signal trapping. We have to wait until after Pstream::init // since this sets up its own ones. diff --git a/src/OpenFOAM/global/jobInfo/jobInfo.C b/src/OpenFOAM/global/jobInfo/jobInfo.C index 3838c12f0..353c384b3 100644 --- a/src/OpenFOAM/global/jobInfo/jobInfo.C +++ b/src/OpenFOAM/global/jobInfo/jobInfo.C @@ -90,13 +90,6 @@ Foam::jobInfo::jobInfo() writeJobInfo = true; } - else if (writeJobInfo) - { - string jobFile = name() + '.' + Foam::name(pid()); - - runningJobPath_ = jobFile; - finishedJobPath_ = jobFile; - } } constructed = true; @@ -139,14 +132,29 @@ bool Foam::jobInfo::write(Ostream& os) const } -void Foam::jobInfo::write(const fileName& casePath) const +void Foam::jobInfo::write +( + const word& executable, + const fileName& casePath +) const { if (writeJobInfo && Pstream::master()) { if (!writeJobControl) { - runningJobPath_ = casePath/runningJobPath_; - finishedJobPath_ = casePath/finishedJobPath_; + const fileName jobInfoPath(casePath/"jobInfo"); + + if (!isDir(jobInfoPath) && !mkDir(jobInfoPath)) + { + FatalErrorInFunction + << "Cannot make jobInfo directory " << jobInfoPath + << Foam::exit(FatalError); + } + + const word jobFile = executable + '.' + Foam::name(pid()); + + runningJobPath_ = jobInfoPath/jobFile; + finishedJobPath_ = jobInfoPath/jobFile; } if (!write(OFstream(runningJobPath_)())) diff --git a/src/OpenFOAM/global/jobInfo/jobInfo.H b/src/OpenFOAM/global/jobInfo/jobInfo.H index be1f56e95..e6819aad5 100644 --- a/src/OpenFOAM/global/jobInfo/jobInfo.H +++ b/src/OpenFOAM/global/jobInfo/jobInfo.H @@ -86,7 +86,7 @@ public: // Member Functions - void write(const fileName& casePath) const; + void write(const word& executable, const fileName& casePath) const; void end();