jobInfo.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 
61  mutable fileName runningJobPath_;
62  mutable fileName finishedJobPath_;
63  cpuTime cpuTime_;
64 
65  // Private Member Functions
66 
67  bool write(Ostream&) const;
68  void end(const word& terminationType);
69 
70 
71 public:
72 
73  static bool constructed;
74  static bool writeJobControl;
75  static bool writeJobInfo;
76 
77  // Constructors
78 
79  //- Construct null
80  jobInfo();
81 
82 
83  //- Destructor
84  ~jobInfo();
85 
86 
87  // Member Functions
88 
89  void write(const word& executable, const fileName& casePath) 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 // ************************************************************************* //
Helper class for recording information about run/finished jobs.
Definition: jobInfo.H:54
static bool constructed
Definition: jobInfo.H:72
A class for handling file names.
Definition: fileName.H:79
void exit()
Definition: jobInfo.C:198
jobInfo()
Construct null.
Definition: jobInfo.C:49
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
void signalEnd() const
Definition: jobInfo.C:210
static bool writeJobControl
Definition: jobInfo.H:73
jobInfo jobInfo_
Definition: jobInfo.C:44
void end()
Definition: jobInfo.C:192
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
~jobInfo()
Destructor.
Definition: jobInfo.C:101
Starts timing CPU usage and return elapsed time from start.
Definition: cpuTime.H:52
static bool writeJobInfo
Definition: jobInfo.H:74
Namespace for OpenFOAM.
void abort()
Definition: jobInfo.C:204