timeControlFunctionObject.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) 2016-2024 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::functionObjects::timeControl
26 
27 Description
28  General time control for functionObjects
29 
30 SourceFiles
31  timeControlFunctionObject.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef timeControlFunctionObject_H
36 #define timeControlFunctionObject_H
37 
38 #include "functionObject.H"
39 #include "dictionary.H"
40 #include "timeControl.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 namespace functionObjects
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class timeControl Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class timeControl
54 :
55  public functionObject
56 {
57  // Private Data
58 
59  //- Reference to the time database
60  const Time& time_;
61 
62  //- Execute controls
63  Foam::timeControl executeControl_;
64 
65  //- Write controls
66  Foam::timeControl writeControl_;
67 
68  //- The functionObject to execute
70 
71 
72  // Private Member Functions
73 
74  //- Returns true if within time bounds
75  bool active() const;
76 
77 
78 public:
79 
80  //- Runtime type information
81  TypeName("timeControl");
82 
83 
84  // Constructors
85 
86  //- Construct from components
88  (
89  const word& name,
90  const Time&,
91  const dictionary&
92  );
93 
94  //- Disallow default bitwise copy construction
95  timeControl(const timeControl&) = delete;
96 
97 
98  // Member Functions
99 
100  // Access
101 
102  //- Return time database
103  inline const Time& time() const;
104 
105  //- Return the execute control object
106  inline const Foam::timeControl& executeControl() const;
107 
108  //- Return the write control object
109  inline const Foam::timeControl& writeControl() const;
110 
111  //- Return the functionObject filter
112  inline const functionObject& filter() const;
113 
114 
115  // Function object control
116 
117  //- Return the list of fields required
118  virtual wordList fields() const;
119 
120  //- Return true if the functionObject should be executed
121  // at the start
122  virtual bool executeAtStart() const;
123 
124  //- Called at each ++ or += of the time-loop.
125  // foamPostProcess overrides the usual executeControl behaviour and
126  // forces execution (used in post-processing mode)
127  virtual bool execute();
128 
129  //- Called at each ++ or += of the time-loop.
130  // foamPostProcess overrides the usual writeControl behaviour and
131  // forces writing (used in post-processing mode)
132  virtual bool write();
133 
134  //- Called when Time::run() determines that the time-loop exits
135  virtual bool end();
136 
137  //- Return the time to the next execute or write
138  // if time requires adjustment
139  virtual scalar timeToNextAction();
140 
141  //- Read and set the function object if its data have changed
142  virtual bool read(const dictionary&);
143 
144  //- Update topology using the given map
145  virtual void movePoints(const polyMesh& mesh);
146 
147  //- Update topology using the given map
148  virtual void topoChange(const polyTopoChangeMap& map);
149 
150  //- Update from another mesh using the given map
151  virtual void mapMesh(const polyMeshMap&);
152 
153  //- Redistribute or update using the given distribution map
154  virtual void distribute(const polyDistributionMap&);
155 
156 
157  // Member Operators
158 
159  //- Disallow default bitwise assignment
160  void operator=(const timeControl&) = delete;
161 };
162 
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 } // End namespace functionObjects
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
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 keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
Abstract base-class for Time/database functionObjects.
const word & name() const
Return the name of this functionObject.
General time control for functionObjects.
const Foam::timeControl & writeControl() const
Return the write control object.
const Time & time() const
Return time database.
virtual wordList fields() const
Return the list of fields required.
timeControl(const word &name, const Time &, const dictionary &)
Construct from components.
virtual bool executeAtStart() const
Return true if the functionObject should be executed.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual void movePoints(const polyMesh &mesh)
Update topology using the given map.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
TypeName("timeControl")
Runtime type information.
virtual scalar timeToNextAction()
Return the time to the next execute or write.
virtual bool execute()
Called at each ++ or += of the time-loop.
virtual void topoChange(const polyTopoChangeMap &map)
Update topology using the given map.
const Foam::timeControl & executeControl() const
Return the execute control object.
virtual bool write()
Called at each ++ or += of the time-loop.
virtual bool end()
Called when Time::run() determines that the time-loop exits.
void operator=(const timeControl &)=delete
Disallow default bitwise assignment.
const functionObject & filter() const
Return the functionObject filter.
virtual bool read(const dictionary &)
Read and set the function object if its data have changed.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
General time dependent execution controller. The default to execute every time-step.
Definition: timeControl.H:51
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
Namespace for OpenFOAM.