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-2016 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  //- Return current time value
87  inline scalar timeOutputValue() const;
88 
89  //- Return current time index
90  inline label timeIndex() const;
91 
92  //- Return time step value
93  inline scalar deltaTValue() const;
94 
95  //- Return old time step value
96  inline scalar deltaT0Value() const;
97 
98  //- Return time step
99  inline dimensionedScalar deltaT() const;
100 
101  //- Return old time step
102  inline dimensionedScalar deltaT0() const;
103 
104 
105  // Check
106 
107  //- Return true if this is a write time
108  inline bool writeTime() const;
109 
110  //- Return true if this is a write time.
111  // Provided for backward-compatibility
112  inline bool outputTime() const;
113 };
114 
115 
116 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117 
118 } // End namespace Foam
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 #include "TimeStateI.H"
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************************************************************* //
label timeIndex() const
Return current time index.
Definition: TimeStateI.H:35
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
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Definition: TimeState.C:52
scalar deltaTSave_
Definition: TimeState.H:57
scalar deltaT0Value() const
Return old time step value.
Definition: TimeStateI.H:47
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
label writeTimeIndex_
Definition: TimeState.H:60
scalar deltaT0_
Definition: TimeState.H:58
scalar deltaTValue() const
Return time step value.
Definition: TimeStateI.H:41
bool deltaTchanged_
Definition: TimeState.H:59
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:53
scalar timeOutputValue() const
Return current time value.
Definition: TimeStateI.H:29
virtual ~TimeState()
Destructor.
Definition: TimeState.C:46
bool outputTime() const
Return true if this is a write time.
Definition: TimeStateI.H:71
Namespace for OpenFOAM.
label timeIndex_
Definition: TimeState.H:55