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 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 
104 
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
106 
107 } // End namespace runTimeControls
108 } // End namespace functionObjects
109 } // End namespace Foam
110 
111 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
112 
113 #endif
114 
115 // ************************************************************************* //
Foam::functionObjects::runTimeControls::maxDurationCondition
Activated after a user-specified duration.
Definition: maxDurationCondition.H:55
Foam::functionObjects::runTimeControls::runTimeCondition::name
virtual const word & name() const
Return the condition name.
Definition: runTimeCondition.C:98
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::functionObjects::runTimeControls::runTimeCondition
Base class for run time conditions.
Definition: runTimeCondition.H:61
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::functionObjects::stateFunctionObject
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: stateFunctionObject.H:69
Foam::functionObjects::runTimeControls::maxDurationCondition::startTime_
scalar startTime_
Time when the condition is activated.
Definition: maxDurationCondition.H:67
Foam::functionObjects::runTimeControls::maxDurationCondition::apply
virtual bool apply()
Apply the condition.
Definition: maxDurationCondition.C:81
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:60
Foam::functionObjects::runTimeControls::maxDurationCondition::write
virtual void write()
Write.
Definition: maxDurationCondition.C:104
runTimeCondition.H
Foam::functionObjects::runTimeControls::maxDurationCondition::maxDurationCondition
maxDurationCondition(const word &name, const objectRegistry &obr, const dictionary &dict, stateFunctionObject &state)
Constructor.
Definition: maxDurationCondition.C:56
Foam::functionObjects::runTimeControls::maxDurationCondition::resetOnRestart_
Switch resetOnRestart_
Reset on restart (ignores any state information)
Definition: maxDurationCondition.H:73
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::runTimeControls::maxDurationCondition::duration_
scalar duration_
Duration.
Definition: maxDurationCondition.H:64
Foam::functionObjects::runTimeControls::maxDurationCondition::~maxDurationCondition
virtual ~maxDurationCondition()=default
Destructor.
Foam::functionObjects::runTimeControls::maxDurationCondition::TypeName
TypeName("maxDuration")
Runtime type information.
Foam::functionObjects::runTimeControls::maxDurationCondition::initialised_
bool initialised_
Initialisation flag.
Definition: maxDurationCondition.H:70