FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 
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 
57  label timeIndex_;
58  scalar deltaT_;
59  scalar deltaTSave_;
60  scalar deltaT0_;
62 
65 
66 
67 public:
68 
69  // Constructors
70 
71  TimeState();
72 
73 
74  //- Destructor
75  virtual ~TimeState();
76 
77 
78  // Member functions
79 
80  // Access
81 
82  //- Convert the user-time (e.g. CA deg) to real-time (s).
83  virtual scalar userTimeToTime(const scalar theta) const;
84 
85  //- Convert the real-time (s) into user-time (e.g. CA deg)
86  virtual scalar timeToUserTime(const scalar t) const;
87 
88  //- Return current time value
89  scalar timeOutputValue() const;
90 
91  //- Return current time index
92  label timeIndex() const;
93 
94  //- Return time step value
95  inline scalar deltaTValue() const
96  {
97  return deltaT_;
98  }
99 
100  //- Return old time step value
101  inline scalar deltaT0Value() const
102  {
103  return deltaT0_;
104  }
105 
106  //- Return time step
107  dimensionedScalar deltaT() const;
108 
109  //- Return old time step
110  dimensionedScalar deltaT0() const;
111 
112 
113  // Check
114 
115  //- Return true if this is an output time
116  bool outputTime() const;
117 };
118 
119 
120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
121 
122 } // End namespace Foam
123 
124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
125 
126 #endif
127 
128 // ************************ vim: set sw=4 sts=4 et: ************************ //