TimeState.C
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 \*---------------------------------------------------------------------------*/
25 
26 #include "TimeState.H"
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
32 :
34  timeIndex_(0),
35  deltaT_(0),
36  deltaTSave_(0),
37  deltaT0_(0),
38  deltaTchanged_(false),
39  outputTimeIndex_(0),
40  primaryOutputTime_(false),
41  secondaryOutputTimeIndex_(0),
42  secondaryOutputTime_(false),
43  outputTime_(false)
44 {}
45 
46 
47 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * * //
48 
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
55 Foam::scalar Foam::TimeState::userTimeToTime(const scalar theta) const
56 {
57  return theta;
58 }
59 
60 
61 Foam::scalar Foam::TimeState::timeToUserTime(const scalar t) const
62 {
63  return t;
64 }
65 
66 
68 {
69  return timeToUserTime(value());
70 }
71 
72 
74 {
75  return timeIndex_;
76 }
77 
78 
80 {
81  return dimensionedScalar("deltaT", dimTime, deltaT_);
82 }
83 
84 
86 {
87  return dimensionedScalar("deltaT0", dimTime, deltaT0_);
88 }
89 
90 
92 {
93  return outputTime_;
94 }
95 
96 
97 // ************************************************************************* //
Foam::TimeState::timeOutputValue
scalar timeOutputValue() const
Return current time value.
Definition: TimeState.C:67
Foam::TimeState::outputTime
bool outputTime() const
Return true if this is an output time (primary or secondary)
Definition: TimeState.C:91
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
Foam::TimeState::TimeState
TimeState()
Definition: TimeState.C:31
Foam::TimeState::deltaT
dimensionedScalar deltaT() const
Return time step.
Definition: TimeState.C:79
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:61
Time.H
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:55
Foam::TimeState::deltaT0
dimensionedScalar deltaT0() const
Return old time step.
Definition: TimeState.C:85
Foam::dimTime
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
Definition: dimensionSets.H:51
Foam::label
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
Foam::dimensionedScalar
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
Definition: dimensionedScalarFwd.H:41
Foam::dimensioned
Generic dimensioned Type class.
Definition: dimensionedScalarFwd.H:41
Foam::TimeState::~TimeState
virtual ~TimeState()
Destructor.
Definition: TimeState.C:49
timeName
word timeName
Definition: getTimeIndex.H:3
Foam::TimeState::timeIndex
label timeIndex() const
Return current time index.
Definition: TimeState.C:73
TimeState.H