timeControl.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) 2011-2016 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::timeControl
26 
27 Description
28  General time dependent execution controller.
29  The default to execute every time-step.
30 
31 SourceFiles
32  timeControl.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef timeControl_H
37 #define timeControl_H
38 
39 #include "Time.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class timeControl Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class timeControl
51 {
52 public:
53 
54  //- The time control options
55  enum timeControls
56  {
64  ocNone
65  };
66 
67 
68 private:
69 
70  // Private data
71 
72  //- Time object
73  const Time& time_;
74 
75  //- Prefix
76  const word prefix_;
77 
78  //- String representation of timeControls enums
79  static const NamedEnum<timeControls, 8> timeControlNames_;
80 
81  //- Type of time control
82  timeControls timeControl_;
83 
84  //- Execution interval steps for timeStep mode
85  // a value <= 1 means execute at every time step
86  label intervalSteps_;
87 
88  //- Execution interval
89  scalar interval_;
90 
91  //- Index of previous execution
92  label executionIndex_;
93 
94 
95  // Private Member Functions
96 
97  //- Disallow default bitwise copy construct and assignment
98  timeControl(const timeControl&);
99 
100  //- Disallow default bitwise assignment
101  void operator=(const timeControl&);
102 
103 
104 public:
105 
106  // Constructors
107 
108  //- Construct from Time object and dictionary
110  (
111  const Time&,
112  const dictionary&,
113  const word& prefix
114  );
115 
116 
117  //- Destructor
118  ~timeControl();
119 
120 
121  // Member Functions
122 
123  //- Read from dictionary
124  void read(const dictionary&);
125 
126  //- Return Time
127  inline const Time& time() const;
128 
129  //- Flag to indicate whether to execute
130  bool execute();
131 
132  //- Return control
133  inline timeControls control() const;
134 
135  //- Return interval
136  inline scalar interval() const;
137 
138  //- Return the index of the previous execution
139  inline label executionIndex() const;
140 };
141 
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 } // End namespace Foam
146 
147 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
148 
149 #include "timeControlI.H"
150 
151 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 
153 #endif
154 
155 // ************************************************************************* //
execution is coupled to the write-time
Definition: timeControl.H:57
execution is coupled to the time-step
Definition: timeControl.H:56
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
timeControls control() const
Return control.
Definition: timeControlI.H:34
label executionIndex() const
Return the index of the previous execution.
Definition: timeControlI.H:46
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
timeControls
The time control options.
Definition: timeControl.H:54
execution is coupled to the output-time
Definition: timeControl.H:58
bool execute()
Flag to indicate whether to execute.
Definition: timeControl.C:140
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:68
const Time & time() const
Return Time.
Definition: timeControlI.H:28
A class for handling words, derived from string.
Definition: word.H:59
cpu time for execution
Definition: timeControl.H:62
scalar interval() const
Return interval.
Definition: timeControlI.H:40
clock time for execution
Definition: timeControl.H:61
Adjust time step for execution.
Definition: timeControl.H:59
~timeControl()
Destructor.
Definition: timeControl.C:74
run time for execution
Definition: timeControl.H:60
General time dependent execution controller. The default to execute every time-step.
Definition: timeControl.H:49
void read(const dictionary &)
Read from dictionary.
Definition: timeControl.C:80
Namespace for OpenFOAM.