solverControlI.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) 2007-2019 PCOpt/NTUA
9  Copyright (C) 2013-2019 FOSS GP
10  Copyright (C) 2019 OpenCFD Ltd.
11 -------------------------------------------------------------------------------
12 License
13  This file is part of OpenFOAM.
14 
15  OpenFOAM is free software: you can redistribute it and/or modify it
16  under the terms of the GNU General Public License as published by
17  the Free Software Foundation, either version 3 of the License, or
18  (at your option) any later version.
19 
20  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
21  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  for more details.
24 
25  You should have received a copy of the GNU General Public License
26  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
27 
28 
29 \*---------------------------------------------------------------------------*/
30 
31 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
32 
34 {
35  return solver_.dict();
36 }
37 
38 
40 {
41  return solverDict().subDict("solutionControls");
42 }
43 
44 
45 inline bool Foam::solverControl::printMaxMags() const
46 {
47  return printMaxMags_;
48 }
49 
50 
51 inline bool Foam::solverControl::storeInitValues() const
52 {
53  return storeInitValues_;
54 }
55 
56 
57 inline Foam::label Foam::solverControl::iter() const
58 {
59  return iter_;
60 }
61 
62 
63 inline Foam::label& Foam::solverControl::averageIter()
64 {
65  return averageIter_;
66 }
67 
68 
69 inline Foam::label Foam::solverControl::averageIter() const
70 {
71  return averageIter_;
72 }
73 
74 
75 inline Foam::label Foam::solverControl::averageStartIter() const
76 {
77  return averageStartIter_;
78 }
79 
80 
81 inline bool Foam::solverControl::doAverageIter() const
82 {
83  if (average_ && iter_ >= averageStartIter_)
84  {
85  return true;
86  }
87  else
88  {
89  return false;
90  }
91 }
92 
93 
95 {
96  if (average_ && averageIter_)
97  {
98  return true;
99  }
100  else
101  {
102  return false;
103  }
104 }
105 
107 inline bool Foam::solverControl::average() const
108 {
109  return average_;
110 }
111 
112 
113 inline const Foam::solver& Foam::solverControl::getSolver() const
114 {
115  return solver_;
116 }
117 
118 
119 // ************************************************************************* //
Base solver class.
Definition: solver.H:45
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Definition: dictionary.C:441
label averageStartIter() const
Return iteration index.
bool printMaxMags() const
Print max mags of solver fields.
const dictionary & dict() const
Return the solver dictionary.
Definition: solverI.H:54
label iter() const
Return iteration index.
const solver & solver_
Reference to the underlaying solver.
Definition: solverControl.H:54
virtual const dictionary solverDict() const
Read controls from optimisationDict.
bool doAverageIter() const
Whether or not to add fields of the current iteration to the average fields.
bool average() const
Whether averaging is enabled or not.
label & averageIter()
Return average iteration index reference.
bool useAveragedFields() const
Use averaged fields? For solving the adjoint equations or computing sensitivities based on averaged f...
bool storeInitValues() const
Re-initialize.
const solver & getSolver() const
Return reference to the underlaying solver.
virtual const dictionary solutionDict() const
Return the solutionControls dictionary.