noConstraint.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) 2021 PCOpt/NTUA
9  Copyright (C) 2021 FOSS GP
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::noConstraint
29 
30 Description
31  Applies no constraints to the control points.
32  Enforces the non-overlapping bounds, if present.
33 
34 SourceFiles
35  noConstraint.C
36 
37 \*---------------------------------------------------------------------------*/
38 
39 #ifndef noConstraint_H
40 #define noConstraint_H
41 
42 #include "morphingBoxConstraint.H"
43 
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 
46 namespace Foam
47 {
48 
49 /*---------------------------------------------------------------------------*\
50  Class noConstraint Declaration
51 \*---------------------------------------------------------------------------*/
52 
53 class noConstraint
54 :
56 {
57 
58 protected:
59 
60  // Protected Member Functions
61 
62  //- Compute sensitivities wrt the design variables (chain rule)
63  void virtual computeDVsSensitivities
64  (
65  scalarField& dvSens,
66  const scalarField& cpSens
67  );
68 
69  //- Update the bounds of the internal control points
71  (
72  autoPtr<scalarField>& lowerBounds,
73  autoPtr<scalarField>& upperBounds,
74  const NURBS3DVolume& boxI,
75  const label passed
76  );
77 
78  //- Update the bounds of the boundary control points
80  (
81  autoPtr<scalarField>& lowerBounds,
82  autoPtr<scalarField>& upperBounds,
83  const NURBS3DVolume& boxI,
84  const label passed
85  );
86 
87 
88 private:
89 
90  // Private Member Functions
91 
92  //- Disallow default bitwise copy construct
93  noConstraint(const noConstraint&) = delete;
94 
95  //- Disallow default bitwise assignment
96  void operator=(const noConstraint&) = delete;
97 
98 
99 public:
100 
101  //- Runtime type information
102  TypeName("none");
103 
104 
105  // Constructors
106 
107  //- Construct from components
109  (
110  const fvMesh& mesh,
111  const dictionary& dict,
113  );
114 
115 
116  //- Destructor
117  virtual ~noConstraint() = default;
118 
119 
120  // Member Functions
121 
122  //- Compute the active design variables based on the IDs of the
123  //- active control point coordinates
125  (
126  const labelList& activeCPCoors
127  );
128 
129  //- Transform bounds from control points to design variables
130  // Does nothing in this case
131  virtual void computeBounds
132  (
133  autoPtr<scalarField>& lowerBounds,
134  autoPtr<scalarField>& upperBounds
135  );
136 
137  //- Update the bounds of the design variables
138  // Will update the bound values if nonOverlappingCPs is active
139  virtual void updateBounds
140  (
141  autoPtr<scalarField>& lowerBounds,
142  autoPtr<scalarField>& upperBounds
143  );
144 
145  //- Convert design variables to control points, stored in a scalarField
147  (
149  );
150 
151  //- Return the design variables corresponding to the given control
152  //- points
154  (
155  const scalarField& cps
156  );
157 
158  //- Convert the correction of the design variables to the correction of
159  //- the control points
161  (
162  const scalarField& correctionDVs
163  );
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
dictionary dict
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
virtual tmp< scalarField > correctionCPs(const scalarField &correctionDVs)
Convert the correction of the design variables to the correction of the control points.
Definition: noConstraint.C:271
virtual labelList computeActiveDesignVariables(const labelList &activeCPCoors)
Compute the active design variables based on the IDs of the active control point coordinates.
Definition: noConstraint.C:244
virtual void updateBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds)
Update the bounds of the design variables.
Definition: noConstraint.C:215
void updateBoundaryBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds, const NURBS3DVolume &boxI, const label passed)
Update the bounds of the boundary control points.
Definition: noConstraint.C:99
Applies no constraints to the control points. Enforces the non-overlapping bounds, if present.
Definition: noConstraint.H:48
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Definition: NURBS3DVolume.H:69
virtual tmp< scalarField > controlPointsToDesignVariables(const scalarField &cps)
Return the design variables corresponding to the given control points.
Definition: noConstraint.C:262
virtual void computeDVsSensitivities(scalarField &dvSens, const scalarField &cpSens)
Compute sensitivities wrt the design variables (chain rule)
Definition: noConstraint.C:43
void updateInternalBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds, const NURBS3DVolume &boxI, const label passed)
Update the bounds of the internal control points.
Definition: noConstraint.C:53
dynamicFvMesh & mesh
virtual tmp< scalarField > designVariablesToControlPoints(const scalarField &designVariables)
Convert design variables to control points, stored in a scalarField.
Definition: noConstraint.C:253
TypeName("none")
Runtime type information.
Volumetric B-Splines design variables for shape optimisation.
virtual void computeBounds(autoPtr< scalarField > &lowerBounds, autoPtr< scalarField > &upperBounds)
Transform bounds from control points to design variables.
Definition: noConstraint.C:205
Abstract base class for defining constraints for the control points of volumetric B-Splines morphing ...
Abstract base class for defining design variables.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
A class for managing temporary objects.
Definition: HashPtrTable.H:50
virtual ~noConstraint()=default
Destructor.
Namespace for OpenFOAM.