Loading...
Searching...
No Matches
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
34Usage
35 Minimal example by using \c system/controlDict.functions:
36 \verbatim
37 timeInfoFO
38 {
39 // Mandatory entries
40 type timeInfo;
41 libs (utilityFunctionObjects);
42
43 // Optional entries
44 perTimeStep <bool>;
45
46 // Inherited entries
47 ...
48 }
49 \endverbatim
50
51 where the entries mean:
52 \table
53 Property | Description | Type | Reqd | Deflt
54 type | Type name: timeActivatedFileUpdate | word | yes | -
55 libs | Library name: utilityFunctionObjects | word | yes | -
56 perTimeStep | Write value per interval/step | bool | no | false
57 \endtable
58
59 The inherited entries are elaborated in:
60 - \link timeFunctionObject.H \endlink
61 - \link writeFile.H \endlink
62
63Note
64 The initial per-step value is likely to be inaccurate and should
65 mostly be ignored.
66
67SourceFiles
68 timeInfo.C
69
70\*---------------------------------------------------------------------------*/
71
72#ifndef Foam_functionObjects_timeInfo_H
73#define Foam_functionObjects_timeInfo_H
74
75#include "timeFunctionObject.H"
76#include "writeFile.H"
77
78// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
79
80namespace Foam
81{
82namespace functionObjects
83{
84
85/*---------------------------------------------------------------------------*\
86 Class timeInfo Declaration
87\*---------------------------------------------------------------------------*/
88
89class timeInfo
90:
91 public timeFunctionObject,
92 public writeFile
93{
94 // Private Member Data
95
96 //- The cpuTime from last write/time-step (for perTimeStep)
97 scalar cpuTime0_;
98
99 //- The clockTime from last write/time-step (for perTimeStep)
100 scalar clockTime0_;
101
102 //- Flag to write cpuTime and clockTime per time-step
103 bool perTimeStep_;
104
105
106protected:
107
108 // Protected Member Functions
109
110 //- Output file header information
111 virtual void writeFileHeader(Ostream& os);
112
113 //- No copy construct
114 timeInfo(const timeInfo&) = delete;
115
116 //- No copy assignment
117 void operator=(const timeInfo&) = delete;
118
119
120public:
121
122 //- Runtime type information
123 TypeName("timeInfo");
124
125
126 // Constructors
127
128 //- Construct from name, Time and dictionary
130 (
131 const word& name,
132 const Time& runTime,
133 const dictionary& dict
134 );
135
136
137 //- Destructor
138 virtual ~timeInfo() = default;
139
140
141 // Member Functions
142
143 //- Read the function-object dictionary
144 virtual bool read(const dictionary& dict);
145
146 //- Execute the function-object operations (no-op)
147 virtual bool execute();
149 //- Write the function-object results
150 virtual bool write();
151};
152
153
154// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
155
156} // End namespace functionObjects
157} // End namespace Foam
158
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#endif
162
163// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const word & name() const noexcept
Return the name of this functionObject.
Virtual base class for function objects with a reference to Time.
timeFunctionObject(const timeFunctionObject &)=delete
No copy construct.
Writes the run time (time-step), cpuTime and clockTime - optionally with cpuTime and clockTime change...
Definition timeInfo.H:112
virtual ~timeInfo()=default
Destructor.
TypeName("timeInfo")
Runtime type information.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition timeInfo.C:79
void operator=(const timeInfo &)=delete
No copy assignment.
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition timeInfo.C:41
virtual bool execute()
Execute the function-object operations (no-op).
Definition timeInfo.C:89
timeInfo(const timeInfo &)=delete
No copy construct.
virtual bool write()
Write the function-object results.
Definition timeInfo.C:95
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68