timeInfo.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2018 OpenFOAM Foundation
9 Copyright (C) 2019-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionObjects::timeInfo
29
30Description
31 Writes the run time (time-step), cpuTime and clockTime -
32 optionally with cpuTime and clockTime change for each time step.
33
34 Example of function object specification:
35 \verbatim
36 time
37 {
38 type timeInfo;
39 libs (utilityFunctionObjects);
40
41 writeControl timeStep;
42 writeInterval 1;
43
44 perTimeStep no;
45 }
46 \endverbatim
47
48 Where the entries comprise:
49 \table
50 Property | Description | Required | Default
51 type | Type name: timeInfo | yes |
52 writeToFile | Write information to file | no | yes
53 perTimeStep | Write value per interval/step | no | no
54 \endtable
55
56 The initial per-step value is likely to be inaccurate and should
57 mostly be ignored.
58
59See also
60 Foam::functionObject
61 Foam::timeFunctionObject
62 Foam::functionObjects::writeFile
63
64SourceFiles
65 timeInfo.C
66
67\*---------------------------------------------------------------------------*/
68
69#ifndef functionObjects_timeInfo_H
70#define functionObjects_timeInfo_H
71
72#include "timeFunctionObject.H"
73#include "writeFile.H"
74
75// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
76
77namespace Foam
78{
79namespace functionObjects
80{
81
82/*---------------------------------------------------------------------------*\
83 Class timeInfo Declaration
84\*---------------------------------------------------------------------------*/
85
86class timeInfo
87:
88 public timeFunctionObject,
89 public writeFile
90{
91 // Private Member Data
92
93 //- The cpuTime from last write/time-step (for perTimeStep)
94 scalar cpuTime0_;
95
96 //- The clockTime from last write/time-step (for perTimeStep)
97 scalar clockTime0_;
98
99 //- Flag to write cpuTime and clockTime per time-step
100 bool perTimeStep_;
101
102
103protected:
104
105 // Protected Member Functions
106
107 //- Output file header information
108 virtual void writeFileHeader(Ostream& os);
109
110 //- No copy construct
111 timeInfo(const timeInfo&) = delete;
112
113 //- No copy assignment
114 void operator=(const timeInfo&) = delete;
115
116
117public:
118
119 //- Runtime type information
120 TypeName("timeInfo");
121
122
123 // Constructors
124
125 //- Construct from Time and dictionary
127 (
128 const word& name,
129 const Time& runTime,
131 );
132
134 //- Destructor
135 virtual ~timeInfo() = default;
136
137
138 // Member Functions
140 //- Read the controls
141 virtual bool read(const dictionary& dict);
142
143 //- Execute, does nothing
144 virtual bool execute();
145
146 //- Write the timeInfo
147 virtual bool write();
148};
149
150
151// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152
153} // End namespace functionObjects
154} // End namespace Foam
155
156// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157
158#endif
159
160// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Virtual base class for function objects with a reference to Time.
Writes the run time (time-step), cpuTime and clockTime - optionally with cpuTime and clockTime change...
Definition: timeInfo.H:109
virtual ~timeInfo()=default
Destructor.
TypeName("timeInfo")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the controls.
Definition: timeInfo.C:86
void operator=(const timeInfo &)=delete
No copy assignment.
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: timeInfo.C:48
virtual bool execute()
Execute, does nothing.
Definition: timeInfo.C:96
timeInfo(const timeInfo &)=delete
No copy construct.
virtual bool write()
Write the timeInfo.
Definition: timeInfo.C:102
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73