userTime.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2021 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::userTime
26 
27 Description
28  An abstract class for the user time description
29 
30 SourceFiles
31  userTime.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef userTime_H
36 #define userTime_H
37 
38 #include "dictionary.H"
39 #include "runTimeSelectionTables.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 namespace userTimes
46 {
47 
48 /*---------------------------------------------------------------------------*\
49  Class userTime Declaration
50 \*---------------------------------------------------------------------------*/
51 
52 class userTime
53 {
54 
55 public:
56 
57  //- Runtime type information
58  TypeName("userTime");
59 
60 
61  //- Declare runtime constructor selection table
63  (
64  autoPtr,
65  userTime,
66  dictionary,
67  (const dictionary& controlDict),
68  (controlDict)
69  );
70 
71 
72  // Constructors
73 
74  //- Construct from controlDict
76 
77 
78  // Selector
79 
81 
82 
83  //- Destructor
84  virtual ~userTime();
85 
86 
87  // Member Functions
88 
89  //- Return the userTime sub-dictionary
90  static const dictionary& dict(const dictionary& controlDict);
91 
92  //- Convert the user-time (e.g. CA deg) to real-time (s).
93  virtual scalar userTimeToTime(const scalar tau) const = 0;
94 
95  //- Convert the real-time (s) into user-time (e.g. CA deg)
96  virtual scalar timeToUserTime(const scalar t) const = 0;
97 
98  //- Return user-time unit
99  virtual word unit() const = 0;
100 
101  //- Read the controlDict and set all the parameters
102  virtual bool read(const dictionary& controlDict) = 0;
103 };
104 
105 
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
107 
108 } // End namespace userTimes
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #endif
114 
115 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
virtual word unit() const =0
Return user-time unit.
virtual ~userTime()
Destructor.
Definition: userTime.C:48
userTime(const dictionary &controlDict)
Construct from controlDict.
Definition: userTime.C:42
TypeName("userTime")
Runtime type information.
virtual bool read(const dictionary &controlDict)=0
Read the controlDict and set all the parameters.
static autoPtr< userTime > New(const dictionary &controlDict)
Definition: userTimeNew.C:32
declareRunTimeSelectionTable(autoPtr, userTime, dictionary,(const dictionary &controlDict),(controlDict))
Declare runtime constructor selection table.
static const dictionary & dict(const dictionary &controlDict)
Return the userTime sub-dictionary.
Definition: userTime.C:55
virtual scalar timeToUserTime(const scalar t) const =0
Convert the real-time (s) into user-time (e.g. CA deg)
virtual scalar userTimeToTime(const scalar tau) const =0
Convert the user-time (e.g. CA deg) to real-time (s).
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
runTime controlDict().lookup("adjustTimeStep") >> adjustTimeStep
Macros to ease declaration of run-time selection tables.