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 | Copyright (C) 2011-2012 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 
50 class TimeState
51 :
52  public dimensionedScalar
53 {
54 
55 protected:
56 
58  scalar deltaT_;
59  scalar deltaTSave_;
60  scalar deltaT0_;
61  bool deltaTchanged_;
62 
64  //- Is outputTime because of primary?
65  bool primaryOutputTime_;
66 
68  //- Is outputTime because of secondary?
70 
71  bool outputTime_;
72 
73 public:
74 
75  // Constructors
76 
77  TimeState();
78 
79 
80  //- Destructor
81  virtual ~TimeState();
82 
83 
84  // Member functions
85 
86  // Access
87 
88  //- Convert the user-time (e.g. CA deg) to real-time (s).
89  virtual scalar userTimeToTime(const scalar theta) const;
90 
91  //- Convert the real-time (s) into user-time (e.g. CA deg)
92  virtual scalar timeToUserTime(const scalar t) const;
93 
94  //- Return current time value
95  scalar timeOutputValue() const;
96 
97  //- Return current time index
98  label timeIndex() const;
99 
100  //- Return time step value
101  inline scalar deltaTValue() const
102  {
103  return deltaT_;
104  }
105 
106  //- Return old time step value
107  inline scalar deltaT0Value() const
108  {
109  return deltaT0_;
110  }
111 
112  //- Return time step
113  dimensionedScalar deltaT() const;
114 
115  //- Return old time step
116  dimensionedScalar deltaT0() const;
117 
118 
119  // Check
120 
121  //- Return true if this is an output time (primary or secondary)
122  bool outputTime() const;
123 };
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
bool secondaryOutputTime_
Is outputTime because of secondary?
Definition: TimeState.H:68
scalar deltaT0Value() const
Return old time step value.
Definition: TimeState.H:106
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
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:49
label secondaryOutputTimeIndex_
Definition: TimeState.H:66
dimensionedScalar deltaT0() const
Return old time step.
Definition: TimeState.C:85
bool deltaTchanged_
Definition: TimeState.H:60
scalar timeOutputValue() const
Return current time value.
Definition: TimeState.C:67
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Definition: TimeState.C:55
Namespace for OpenFOAM.
label outputTimeIndex_
Definition: TimeState.H:62
virtual scalar timeToUserTime(const scalar t) const
Convert the real-time (s) into user-time (e.g. CA deg)
Definition: TimeState.C:61
bool primaryOutputTime_
Is outputTime because of primary?
Definition: TimeState.H:64
scalar deltaTValue() const
Return time step value.
Definition: TimeState.H:100
label timeIndex() const
Return current time index.
Definition: TimeState.C:73
label timeIndex_
Definition: TimeState.H:56
bool outputTime_
Definition: TimeState.H:70
scalar deltaT0_
Definition: TimeState.H:59
scalar deltaTSave_
Definition: TimeState.H:58
bool outputTime() const
Return true if this is an output time (primary or secondary)
Definition: TimeState.C:91
dimensionedScalar deltaT() const
Return time step.
Definition: TimeState.C:79
scalar deltaT_
Definition: TimeState.H:57
virtual ~TimeState()
Destructor.
Definition: TimeState.C:49