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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::functionObjects::timeInfo
29 
30 Description
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 
59 See also
60  Foam::functionObject
61  Foam::timeFunctionObject
62  Foam::functionObjects::writeFile
63 
64 SourceFiles
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 
77 namespace Foam
78 {
79 namespace functionObjects
80 {
81 
82 /*---------------------------------------------------------------------------*\
83  Class timeInfo Declaration
84 \*---------------------------------------------------------------------------*/
85 
86 class 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 
103 protected:
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 
117 public:
118 
119  //- Runtime type information
120  TypeName("timeInfo");
121 
122 
123  // Constructors
124 
125  //- Construct from Time and dictionary
126  timeInfo
127  (
128  const word& name,
129  const Time& runTime,
130  const dictionary& dict
131  );
132 
133 
134  //- Destructor
135  virtual ~timeInfo() = default;
136 
137 
138  // Member Functions
139 
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 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
writeFile.H
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::functionObjects::timeFunctionObject
Virtual base class for function objects with a reference to Time.
Definition: timeFunctionObject.H:56
Foam::functionObjects::timeInfo::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: timeInfo.C:48
Foam::functionObjects::timeInfo::timeInfo
timeInfo(const timeInfo &)=delete
No copy construct.
timeFunctionObject.H
Foam::functionObjects::timeInfo::operator=
void operator=(const timeInfo &)=delete
No copy assignment.
Foam::functionObjects::timeInfo
Writes the run time (time-step), cpuTime and clockTime - optionally with cpuTime and clockTime change...
Definition: timeInfo.H:105
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::timeInfo::read
virtual bool read(const dictionary &dict)
Read the controls.
Definition: timeInfo.C:86
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::timeInfo::~timeInfo
virtual ~timeInfo()=default
Destructor.
Foam::functionObjects::timeInfo::execute
virtual bool execute()
Execute, does nothing.
Definition: timeInfo.C:96
Foam::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::functionObjects::timeInfo::TypeName
TypeName("timeInfo")
Runtime type information.
Foam::functionObjects::timeInfo::write
virtual bool write()
Write the timeInfo.
Definition: timeInfo.C:102