All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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  // Private member functions
91 
92  //- Disallow default bitwise copy construct
93  time(const time&);
94 
95  //- Disallow default bitwise assignment
96  void operator=(const time&);
97 
98 
99 protected:
100 
101  // Protected Member Functions
102 
103  //- Output file header information
104  virtual void writeFileHeader(const label i);
105 
106 
107 public:
108 
109  //- Runtime type information
110  TypeName("time");
111 
112 
113  // Constructors
114 
115  //- Construct from Time and dictionary
116  time
117  (
118  const word& name,
119  const Time& runTime,
120  const dictionary& dict
121  );
122 
123 
124  //- Destructor
125  virtual ~time();
126 
127 
128  // Member Functions
129 
130  //- Read the controls
131  virtual bool read(const dictionary&);
132 
133  //- Execute, currently does nothing
134  virtual bool execute();
135 
136  //- Write the time
137  virtual bool write();
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:137
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.
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.
TypeName("time")
Runtime type information.
A class for handling words, derived from string.
Definition: word.H:59
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.