maxDurationCondition.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2018-2022 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::functionObjects::runTimeControls::maxDurationCondition
28 
29 Description
30  Activated after a user-specified duration
31 
32 SourceFiles
33  maxDurationCondition.H
34  maxDurationCondition.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef functionObjects_runTimeConditions_maxDurationCondition_H
39 #define functionObjects_runTimeConditions_maxDurationCondition_H
40 
41 #include "runTimeCondition.H"
42 
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
44 
45 namespace Foam
46 {
47 namespace functionObjects
48 {
49 namespace runTimeControls
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class maxDurationCondition Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 :
58  public runTimeCondition
59 {
60 protected:
61 
62  // Protected data
63 
64  //- Duration
65  scalar duration_;
66 
67  //- Time when the condition is activated
68  scalar startTime_;
69 
70  //- Initialisation flag
71  bool initialised_;
72 
73  //- Reset on restart (ignores any state information)
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("maxDuration");
81 
82  //- Constructor
84  (
85  const word& name,
86  const objectRegistry& obr,
87  const dictionary& dict,
88  stateFunctionObject& state
89  );
90 
91  //- Destructor
92  virtual ~maxDurationCondition() = default;
93 
94 
95  // Public Member Functions
96 
97  //- Apply the condition
98  virtual bool apply();
99 
100  //- Write
101  virtual void write();
102 
103  //- Reset
104  virtual void reset();
105 };
106 
107 
108 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
109 
110 } // End namespace runTimeControls
111 } // End namespace functionObjects
112 } // End namespace Foam
113 
114 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
115 
116 #endif
117 
118 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
scalar startTime_
Time when the condition is activated.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Definition: Switch.H:77
Switch resetOnRestart_
Reset on restart (ignores any state information)
A class for handling words, derived from Foam::string.
Definition: word.H:63
TypeName("maxDuration")
Runtime type information.
Base class for function objects, adding functionality to read/write state information (data required ...
Registry of regIOobjects.
maxDurationCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
Namespace for OpenFOAM.
virtual const word & name() const
Return the condition name.