FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

TimeState.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::TimeState
00026 
00027 Description
00028     The time value with time-stepping information, user-defined remapping, etc.
00029 
00030 SourceFiles
00031     TimeState.C
00032 
00033 \*---------------------------------------------------------------------------*/
00034 
00035 #ifndef TimeState_H
00036 #define TimeState_H
00037 
00038 #include <OpenFOAM/dimensionedScalar.H>
00039 
00040 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00041 
00042 namespace Foam
00043 {
00044 
00045 /*---------------------------------------------------------------------------*\
00046                            Class TimeState Declaration
00047 \*---------------------------------------------------------------------------*/
00048 
00049 
00050 class TimeState
00051 :
00052     public dimensionedScalar
00053 {
00054 
00055 protected:
00056 
00057         label timeIndex_;
00058         scalar deltaT_;
00059         scalar deltaTSave_;
00060         scalar deltaT0_;
00061         bool deltaTchanged_;
00062 
00063         label outputTimeIndex_;
00064         bool  outputTime_;
00065 
00066 
00067 public:
00068 
00069     // Constructors
00070 
00071         TimeState();
00072 
00073 
00074     //- Destructor
00075     virtual ~TimeState();
00076 
00077 
00078     // Member functions
00079 
00080         // Access
00081 
00082             //- Convert the user-time (e.g. CA deg) to real-time (s).
00083             virtual scalar userTimeToTime(const scalar theta) const;
00084 
00085             //- Convert the real-time (s) into user-time (e.g. CA deg)
00086             virtual scalar timeToUserTime(const scalar t) const;
00087 
00088             //- Return current time value
00089             scalar timeOutputValue() const;
00090 
00091             //- Return current time index
00092             label timeIndex() const;
00093 
00094             //- Return time step value
00095             inline scalar deltaTValue() const
00096             {
00097                 return deltaT_;
00098             }
00099 
00100             //- Return old time step value
00101             inline scalar deltaT0Value() const
00102             {
00103                 return deltaT0_;
00104             }
00105 
00106             //- Return time step
00107             dimensionedScalar deltaT() const;
00108 
00109             //- Return old time step
00110             dimensionedScalar deltaT0() const;
00111 
00112 
00113         // Check
00114 
00115             //- Return true if this is an output time
00116             bool outputTime() const;
00117 };
00118 
00119 
00120 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00121 
00122 } // End namespace Foam
00123 
00124 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00125 
00126 #endif
00127 
00128 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines