timeFunctionObject.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) 2018-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::functionObjects::time
26 
27 Description
28  Writes run time, CPU time and clock time
29  and optionally the CPU and clock times per time step.
30 
31  Example of function object specification:
32  \verbatim
33  time
34  {
35  type time;
36 
37  libs ("libutilityFunctionObjects.so");
38 
39  writeControl timeStep;
40  writeInterval 1;
41 
42  perTimeStep no;
43  }
44  \endverbatim
45 
46 See also
47  Foam::functionObject
48  Foam::regionFunctionObject
49  Foam::functionObjects::logFiles
50 
51 SourceFiles
52  time.C
53 
54 \*---------------------------------------------------------------------------*/
55 
56 #ifndef timeFunctionObject_H
57 #define timeFunctionObject_H
58 
59 #include "regionFunctionObject.H"
60 #include "logFiles.H"
61 
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63 
64 namespace Foam
65 {
66 namespace functionObjects
67 {
68 
69 /*---------------------------------------------------------------------------*\
70  Class time Declaration
71 \*---------------------------------------------------------------------------*/
72 
73 class time
74 :
75  public regionFunctionObject,
76  public logFiles
77 {
78  // Private member data
79 
80  //- Switch to write CPU and clock times per time-step
81  Switch perTimeStep_;
82 
83  //- Previous time-step CPU time
84  scalar cpuTime0_;
85 
86  //- Previous time-step clock time
87  scalar clockTime0_;
88 
89 
90 protected:
91 
92  // Protected Member Functions
93 
94  //- Output file header information
95  virtual void writeFileHeader(const label i);
96 
97 
98 public:
99 
100  //- Runtime type information
101  TypeName("time");
102 
103 
104  // Constructors
105 
106  //- Construct from Time and dictionary
107  time
108  (
109  const word& name,
110  const Time& runTime,
111  const dictionary& dict
112  );
113 
114  //- Disallow default bitwise copy construction
115  time(const time&) = delete;
116 
117 
118  //- Destructor
119  virtual ~time();
120 
121 
122  // Member Functions
123 
124  //- Read the controls
125  virtual bool read(const dictionary&);
126 
127  //- Execute, currently does nothing
128  virtual bool execute();
129 
130  //- Write the time
131  virtual bool write();
132 
133 
134  // Member Operators
135 
136  //- Disallow default bitwise assignment
137  void operator=(const time&) = delete;
138 };
139 
140 
141 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 
143 } // End namespace functionObjects
144 } // End namespace Foam
145 
146 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
147 
148 #endif
149 
150 // ************************************************************************* //
Specialization of Foam::functionObject for a region and providing a reference to the region Foam::obj...
dictionary dict
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
virtual void writeFileHeader(const label i)
Output file header information.
const word & name() const
Return the name of this functionObject.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
engineTime & runTime
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
virtual ~time()
Destructor.
void operator=(const time &)=delete
Disallow default bitwise assignment.
TypeName("time")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
time(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
virtual bool write()
Write the time.
Writes run time, CPU time and clock time and optionally the CPU and clock times per time step...
virtual bool execute()
Execute, currently does nothing.
Namespace for OpenFOAM.
functionObject base class for creating, maintaining and writing log files e.g. integrated of averaged...
Definition: logFiles.H:57
virtual bool read(const dictionary &)
Read the controls.