FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

JobInfo.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::JobInfo
00026 
00027 Description
00028     Helper class for recording information about run/finished jobs.
00029 
00030     Writes the following files:
00031       - FOAM_JOB_DIR/runningJobs
00032       - FOAM_JOB_DIR/finishedJobs
00033     where FOAM_JOB_DIR is the first of the following options that applies:
00034       - $FREEFOAM_JOB_DIR if the environment variable is defined
00035       - $FOAM_JOB_DIR if the environment variable is defined (for backward compatibility)
00036       - The value of the entry "foamJobDir" in the global controlDict if the entry is present
00037       - $HOME/.FreeFOAM/jobControl
00038 
00039 SourceFiles
00040     JobInfo.C
00041 
00042 \*---------------------------------------------------------------------------*/
00043 
00044 #ifndef JobInfo_H
00045 #define JobInfo_H
00046 
00047 #include <OpenFOAM/dictionary.H>
00048 #include <OpenFOAM/fileName.H>
00049 #include <OSspecific/cpuTime.H>
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 /*---------------------------------------------------------------------------*\
00057                            Class JobInfo Declaration
00058 \*---------------------------------------------------------------------------*/
00059 
00060 class JobInfo
00061 :
00062     public dictionary
00063 {
00064     // Private data
00065         fileName runningJobPath_;
00066         fileName finishedJobPath_;
00067         cpuTime  cpuTime_;
00068 
00069     // Private member functions
00070 
00071         bool write(Ostream&) const;
00072         void end(const word& terminationType);
00073 
00074 
00075 public:
00076 
00077     static bool constructed;
00078     static bool writeJobInfo;
00079 
00080     // Constructors
00081 
00082         //- Construct null
00083         JobInfo();
00084 
00085 
00086     // Destructor
00087 
00088         ~JobInfo();
00089 
00090 
00091     // Member Functions
00092 
00093         // Write
00094 
00095             void write() const;
00096 
00097             void end();
00098 
00099             void exit();
00100 
00101             void abort();
00102 
00103             void signalEnd() const;
00104 };
00105 
00106 
00107 extern JobInfo jobInfo;
00108 
00109 
00110 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00111 
00112 } // End namespace Foam
00113 
00114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00115 
00116 #endif
00117 
00118 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines