All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
solutionControl.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) 2018-2023 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::solutionControl
26 
27 Description
28  Solution control class
29 
30 SourceFiles
31  solutionControlI.H
32  solutionControl.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef solutionControl_H
37 #define solutionControl_H
38 
39 #include "Time.H"
40 
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 /*---------------------------------------------------------------------------*\
47  Class solutionControl Declaration
48 \*---------------------------------------------------------------------------*/
49 
50 class solutionControl
51 :
52  public regIOobject
53 {
54 protected:
55 
56  // Protected data
57 
58  //- Reference to the objectRegistry
60 
61  //- Name of the algorithm
62  const word algorithmName_;
63 
64  //- Whitespace the same length as the algorithm name
65  const string algorithmSpaceStr_;
66 
67  //- Flag set true during the final iteration
68  mutable bool finalIter_;
69 
70 
71  // Protected Member Functions
72 
73  //- Return true if the dependencies have been modified
74  virtual bool dependenciesModified() const = 0;
75 
76  //- Read controls
77  virtual bool read() = 0;
78 
79  //- Dummy write for regIOobject
80  virtual bool writeData(Ostream&) const;
81 
82 
83 public:
84 
85  // Static Data Members
86 
87  //- Run-time type information
88  TypeName("solutionControl");
89 
90 
91  // Constructors
92 
93  //- Construct from the time, the name of the algorithm and a registry
95  (
96  const objectRegistry& registry,
97  const word& algorithmName
98  );
99 
100 
101  //- Destructor
102  virtual ~solutionControl();
103 
104 
105  // Member Functions
106 
107  //- Return the name of the algorithm
108  inline const word& algorithmName() const;
109 
110  //- Return some whitespace the same length as the algorithm name
111  inline const char* algorithmSpace() const;
112 
113  //- Return the dictionary
114  virtual const dictionary& dict() const = 0;
115 
116  //- Lookup solutionControl from the objectRegistry and return finalIter
117  static bool finalIteration(const objectRegistry& registry);
118 };
119 
120 
121 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
122 
123 } // End namespace Foam
124 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 #include "solutionControlI.H"
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 #endif
132 
133 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Registry of regIOobjects.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
Solution control class.
const char * algorithmSpace() const
Return some whitespace the same length as the algorithm name.
solutionControl(const objectRegistry &registry, const word &algorithmName)
Construct from the time, the name of the algorithm and a registry.
virtual ~solutionControl()
Destructor.
bool finalIter_
Flag set true during the final iteration.
virtual bool writeData(Ostream &) const
Dummy write for regIOobject.
const word & algorithmName() const
Return the name of the algorithm.
const word algorithmName_
Name of the algorithm.
const objectRegistry & registry_
Reference to the objectRegistry.
virtual bool read()=0
Read controls.
TypeName("solutionControl")
Run-time type information.
virtual const dictionary & dict() const =0
Return the dictionary.
virtual bool dependenciesModified() const =0
Return true if the dependencies have been modified.
const string algorithmSpaceStr_
Whitespace the same length as the algorithm name.
static bool finalIteration(const objectRegistry &registry)
Lookup solutionControl from the objectRegistry and return finalIter.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.