TimeState.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2021 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::TimeState
29
30Description
31 The time value with time-stepping information, user-defined remapping, etc.
32
33SourceFiles
34 TimeState.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef TimeState_H
39#define TimeState_H
40
41#include "dimensionedScalar.H"
42
43// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44
45namespace Foam
46{
47
48/*---------------------------------------------------------------------------*\
49 Class TimeState Declaration
50\*---------------------------------------------------------------------------*/
52class TimeState
53:
55{
56protected:
59 label writeTimeIndex_;
61 scalar deltaT_;
62 scalar deltaT0_;
63 scalar deltaTSave_;
66 bool writeTime_;
67
68
69public:
70
71 // Constructors
72
73 //- Construct a zero time state, using the current time formatting
74 TimeState();
75
76
77 //- Destructor
78 virtual ~TimeState() = default;
79
80
81 // Member functions
82
83 // Access
84
85 //- Convert the user-time (e.g. CA deg) to real-time (s).
86 virtual scalar userTimeToTime(const scalar theta) const;
87
88 //- Convert the real-time (s) into user-time (e.g. CA deg)
89 virtual scalar timeToUserTime(const scalar t) const;
90
91 //- Return current time value
92 inline scalar timeOutputValue() const;
93
94 //- Return current time index
95 inline label timeIndex() const noexcept;
96
97 //- Return time step value
98 inline scalar deltaTValue() const noexcept;
99
100 //- Return old time step value
101 inline scalar deltaT0Value() const noexcept;
102
103 //- Return time step
104 inline dimensionedScalar deltaT() const;
105
106 //- Return old time step
107 inline dimensionedScalar deltaT0() const;
108
109
110 // Check
111
112 //- True if this is a write time
113 inline bool writeTime() const noexcept;
114
115 //- Deprecated(2016-05) return true if this is a write time.
116 // \deprecated(2016-05) - use writeTime() method
117 bool outputTime() const noexcept { return this->writeTime(); }
118};
119
120
121// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122
123} // End namespace Foam
124
125// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126
127#include "TimeStateI.H"
128
129// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130
131#endif
132
133// ************************************************************************* //
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:54
TimeState()
Construct a zero time state, using the current time formatting.
Definition: TimeState.C:34
virtual scalar timeToUserTime(const scalar t) const
Convert the real-time (s) into user-time (e.g. CA deg)
Definition: TimeState.C:55
bool deltaTchanged_
Definition: TimeState.H:64
scalar deltaTSave_
Definition: TimeState.H:62
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Definition: TimeState.C:49
scalar deltaT_
Definition: TimeState.H:60
label writeTimeIndex_
Definition: TimeState.H:58
bool outputTime() const noexcept
Deprecated(2016-05) return true if this is a write time.
Definition: TimeState.H:116
scalar timeOutputValue() const
Return current time value.
Definition: TimeStateI.H:31
virtual ~TimeState()=default
Destructor.
dimensionedScalar deltaT0() const
Return old time step.
Definition: TimeStateI.H:61
label timeIndex() const noexcept
Return current time index.
Definition: TimeStateI.H:37
scalar deltaTValue() const noexcept
Return time step value.
Definition: TimeStateI.H:43
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:55
bool writeTime() const noexcept
True if this is a write time.
Definition: TimeStateI.H:67
label timeIndex_
Definition: TimeState.H:57
scalar deltaT0Value() const noexcept
Return old time step value.
Definition: TimeStateI.H:49
scalar deltaT0_
Definition: TimeState.H:61
Namespace for OpenFOAM.
const direction noexcept
Definition: Scalar.H:223