singleRun.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-2020 PCOpt/NTUA
9  Copyright (C) 2013-2020 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 Class
30  Foam::singleRun
31 
32 Description
33  Update design variables using steepest descent
34 
35 SourceFiles
36  singleRun.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef singleRun_H
41 #define singleRun_H
42 
43 #include "optimisationManager.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class singleRun Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class singleRun
55 :
56  public optimisationManager
57 {
58 protected:
59 
60  // Protected data
61  label cycles_;
62 
63 
64 private:
65 
66  // Private Member Functions
67 
68  //- No copy construct
69  singleRun(const singleRun&) = delete;
70 
71  //- No copy assignment
72  void operator=(const singleRun&) = delete;
73 
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("singleRun");
79 
80 
81  // Constructors
82 
83  //- Construct from components
85 
86 
87  //- Destructor
88  virtual ~singleRun() = default;
89 
90 
91  // Member Functions
92 
93  //- Prefix increment
95 
96  //- Postfix increment, this is identical to the prefix increment
97  virtual optimisationManager& operator++(int);
98 
99  //- Return true if end of optimisation run.
100  // Also, updates the design variables if needed
101  virtual bool checkEndOfLoopAndUpdate();
102 
103  //- Return true if end of optimisation run
104  virtual bool end();
105 
106  //- Whether to update the design variables
107  virtual bool update();
108 
109  //- Update design variables.
110  // Does nothing
111  virtual void updateDesignVariables();
112 };
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 } // End namespace Foam
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 #endif
122 
123 // ************************************************************************* //
Foam::singleRun::end
virtual bool end()
Return true if end of optimisation run.
Definition: singleRun.C:72
Foam::singleRun
Update design variables using steepest descent.
Definition: singleRun.H:53
optimisationManager.H
Foam::singleRun::TypeName
TypeName("singleRun")
Runtime type information.
Foam::singleRun::updateDesignVariables
virtual void updateDesignVariables()
Update design variables.
Definition: singleRun.C:86
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:83
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::singleRun::checkEndOfLoopAndUpdate
virtual bool checkEndOfLoopAndUpdate()
Return true if end of optimisation run.
Definition: singleRun.C:66
Foam::singleRun::update
virtual bool update()
Whether to update the design variables.
Definition: singleRun.C:79
Foam::optimisationManager
Abstract base class for optimisation methods.
Definition: optimisationManager.H:57
Foam::singleRun::cycles_
label cycles_
Definition: singleRun.H:60
Foam::singleRun::operator++
virtual optimisationManager & operator++()
Prefix increment.
Definition: singleRun.C:53
Foam::singleRun::~singleRun
virtual ~singleRun()=default
Destructor.