runTimeControl.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) 2015 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::runTimeControl
26 
27 Group
28  grpJobControlFunctionObjects
29 
30 Description
31  This function object controls when the calculation is terminated based on
32  satisfying user-specified conditions.
33 
34  Optionally specify a number of write steps before the calculation is
35  terminated. Here, a write is performed each time that all conditons are
36  satisfied.
37 
38 SourceFiles
39  runTimeControl.C
40  IOrunTimeControl.H
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef runTimeControl_H
45 #define runTimeControl_H
46 
47 #include "functionObjectState.H"
48 #include "Map.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class objectRegistry;
57 class dictionary;
58 class polyMesh;
59 class mapPolyMesh;
60 class runTimeCondition;
61 
62 /*---------------------------------------------------------------------------*\
63  Class runTimeControl Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class runTimeControl
67 :
68  public functionObjectState
69 {
70  // Private data
71 
72  //- Reference to the database
73  const objectRegistry& obr_;
74 
75  //- List of conditions to satisfy
77 
78  //- Map to define group IDs
80 
81  //- Number of write steps before exiting
83 
84  //- Current number of steps written
86 
87 
88  // Private Member Functions
89 
90  //- Disallow default bitwise copy construct
92 
93  //- Disallow default bitwise assignment
94  void operator=(const runTimeControl&);
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeName("runTimeControl");
101 
102 
103  // Constructors
104 
105  //- Construct for given objectRegistry and dictionary.
106  // Allow the possibility to load fields from files
108  (
109  const word& name,
110  const objectRegistry&,
111  const dictionary&,
112  const bool loadFromFiles = false
113  );
114 
115 
116  //- Destructor
117  virtual ~runTimeControl();
118 
119 
120  // Member Functions
121 
122  //- Return name of the set of runTimeControl
123  virtual const word& name() const
124  {
125  return name_;
126  }
127 
128  //- Read the runTimeControl data
129  virtual void read(const dictionary&);
130 
131  //- Execute, currently does nothing
132  virtual void execute();
133 
134  //- Execute at the final time-loop, currently does nothing
135  virtual void end();
136 
137  //- Called when time was set at the end of the Time::operator++
138  virtual void timeSet();
139 
140  //- Calculate the runTimeControl and write
141  virtual void write();
142 
143  //- Update for changes of mesh
144  virtual void updateMesh(const mapPolyMesh&)
145  {}
146 
147  //- Update for changes of mesh
148  virtual void movePoints(const polyMesh&)
149  {}
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace Foam
156 
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 
159 #endif
160 
161 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::functionObjectState
Base class for function objects, adding functionality to read/write state information (data required ...
Definition: functionObjectState.H:54
Foam::runTimeControl
This function object controls when the calculation is terminated based on satisfying user-specified c...
Definition: runTimeControl.H:65
Foam::runTimeControl::operator=
void operator=(const runTimeControl &)
Disallow default bitwise assignment.
Foam::runTimeControl::name
virtual const word & name() const
Return name of the set of runTimeControl.
Definition: runTimeControl.H:122
functionObjectState.H
Foam::Map< label >
Foam::runTimeControl::timeSet
virtual void timeSet()
Called when time was set at the end of the Time::operator++.
Definition: runTimeControl.C:243
Foam::runTimeControl::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Update for changes of mesh.
Definition: runTimeControl.H:143
Foam::runTimeControl::end
virtual void end()
Execute at the final time-loop, currently does nothing.
Definition: runTimeControl.C:237
Foam::runTimeControl::execute
virtual void execute()
Execute, currently does nothing.
Definition: runTimeControl.C:136
Foam::runTimeControl::write
virtual void write()
Calculate the runTimeControl and write.
Definition: runTimeControl.C:249
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Foam::runTimeControl::~runTimeControl
virtual ~runTimeControl()
Destructor.
Definition: runTimeControl.C:97
Foam::objectRegistry
Registry of regIOobjects.
Definition: objectRegistry.H:50
Map.H
Foam::runTimeControl::movePoints
virtual void movePoints(const polyMesh &)
Update for changes of mesh.
Definition: runTimeControl.H:147
Foam::label
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
Foam::runTimeControl::read
virtual void read(const dictionary &)
Read the runTimeControl data.
Definition: runTimeControl.C:103
Foam::PtrList
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:61
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::runTimeControl::writeStepI_
label writeStepI_
Current number of steps written.
Definition: runTimeControl.H:84
Foam::runTimeControl::runTimeControl
runTimeControl(const runTimeControl &)
Disallow default bitwise copy construct.
Foam::functionObjectState::name_
const word name_
Name of model.
Definition: functionObjectState.H:72
Foam::runTimeControl::TypeName
TypeName("runTimeControl")
Runtime type information.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::runTimeControl::obr_
const objectRegistry & obr_
Reference to the database.
Definition: runTimeControl.H:72
Foam::runTimeControl::conditions_
PtrList< runTimeCondition > conditions_
List of conditions to satisfy.
Definition: runTimeControl.H:75
Foam::runTimeControl::groupMap_
Map< label > groupMap_
Map to define group IDs.
Definition: runTimeControl.H:78
Foam::runTimeControl::nWriteStep_
label nWriteStep_
Number of write steps before exiting.
Definition: runTimeControl.H:81