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