JobInfo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::JobInfo
26 
27 Description
28  Helper class for recording information about run/finished jobs.
29 
30  Writes the following files:
31  - $FOAM_JOB_DIR/runningJobs
32  - $FOAM_JOB_DIR/finishedJobs
33 
34 SourceFiles
35  JobInfo.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef JobInfo_H
40 #define JobInfo_H
41 
42 #include "dictionary.H"
43 #include "fileName.H"
44 #include "cpuTime.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class JobInfo Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class JobInfo
56 :
57  public dictionary
58 {
59  // Private data
60  fileName runningJobPath_;
61  fileName finishedJobPath_;
62  cpuTime cpuTime_;
63 
64  // Private Member Functions
65 
66  bool write(Ostream&) const;
67  void end(const word& terminationType);
68 
69 
70 public:
71 
72  static bool constructed;
73  static bool writeJobInfo;
74 
75  // Constructors
76 
77  //- Construct null
78  JobInfo();
79 
80 
81  //- Destructor
82  ~JobInfo();
83 
84 
85  // Member Functions
86 
87  // Write
88 
89  void write() const;
90 
91  void end();
92 
93  void exit();
94 
95  void abort();
96 
97  void signalEnd() const;
98 };
99 
100 
101 extern JobInfo jobInfo;
102 
103 
104 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105 
106 } // End namespace Foam
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 #endif
111 
112 // ************************************************************************* //
JobInfo()
Construct null.
Definition: JobInfo.C:40
A class for handling file names.
Definition: fileName.H:69
Helper class for recording information about run/finished jobs.
Definition: JobInfo.H:54
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
~JobInfo()
Destructor.
Definition: JobInfo.C:87
void write() const
Definition: JobInfo.C:121
A class for handling words, derived from string.
Definition: word.H:59
void end()
Definition: JobInfo.C:157
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void signalEnd() const
Definition: JobInfo.C:175
JobInfo jobInfo
Definition: JobInfo.C:35
static bool writeJobInfo
Definition: JobInfo.H:72
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTime.H:52
void abort()
Definition: JobInfo.C:169
static bool constructed
Definition: JobInfo.H:71
Namespace for OpenFOAM.
void exit()
Definition: JobInfo.C:163