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 -------------------------------------------------------------------------------
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::TimeState
29 
30 Description
31  The time value with time-stepping information, user-defined remapping, etc.
32 
33 SourceFiles
34  TimeState.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef TimeState_H
39 #define TimeState_H
40 
41 #include "dimensionedScalar.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class TimeState Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class TimeState
53 :
54  public dimensionedScalar
55 {
56 protected:
57 
58  label timeIndex_;
59  label writeTimeIndex_;
60 
61  scalar deltaT_;
62  scalar deltaT0_;
63  scalar deltaTSave_;
64 
66  bool writeTime_;
67 
68 
69 public:
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 // ************************************************************************* //
Foam::TimeState::timeOutputValue
scalar timeOutputValue() const
Return current time value.
Definition: TimeStateI.H:31
Foam::TimeState::TimeState
TimeState()
Construct a zero time state, using the current time formatting.
Definition: TimeState.C:34
Foam::TimeState::deltaT
dimensionedScalar deltaT() const
Return time step.
Definition: TimeStateI.H:55
Foam::TimeState::timeToUserTime
virtual scalar timeToUserTime(const scalar t) const
Convert the real-time (s) into user-time (e.g. CA deg)
Definition: TimeState.C:55
Foam::TimeState::userTimeToTime
virtual scalar userTimeToTime(const scalar theta) const
Convert the user-time (e.g. CA deg) to real-time (s).
Definition: TimeState.C:49
Foam::TimeState::deltaT0_
scalar deltaT0_
Definition: TimeState.H:61
Foam::TimeState::outputTime
bool outputTime() const noexcept
Deprecated(2016-05) return true if this is a write time.
Definition: TimeState.H:116
Foam::TimeState::deltaT0
dimensionedScalar deltaT0() const
Return old time step.
Definition: TimeStateI.H:61
Foam::TimeState::deltaTValue
scalar deltaTValue() const noexcept
Return time step value.
Definition: TimeStateI.H:43
Foam::TimeState::deltaT0Value
scalar deltaT0Value() const noexcept
Return old time step value.
Definition: TimeStateI.H:49
Foam::TimeState::~TimeState
virtual ~TimeState()=default
Destructor.
Foam::TimeState
The time value with time-stepping information, user-defined remapping, etc.
Definition: TimeState.H:51
Foam::TimeState::timeIndex
label timeIndex() const noexcept
Return current time index.
Definition: TimeStateI.H:37
Foam::TimeState::deltaTSave_
scalar deltaTSave_
Definition: TimeState.H:62
Foam::TimeState::writeTime
bool writeTime() const noexcept
True if this is a write time.
Definition: TimeStateI.H:67
TimeStateI.H
Foam::TimeState::writeTimeIndex_
label writeTimeIndex_
Definition: TimeState.H:58
Foam::dimensioned< scalar >
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
dimensionedScalar.H
Foam::TimeState::timeIndex_
label timeIndex_
Definition: TimeState.H:57
Foam::TimeState::deltaT_
scalar deltaT_
Definition: TimeState.H:60
Foam::TimeState::deltaTchanged_
bool deltaTchanged_
Definition: TimeState.H:64
Foam::TimeState::writeTime_
bool writeTime_
Definition: TimeState.H:65