Loading...
Searching...
No Matches
volBSplinesBase.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-2023 PCOpt/NTUA
9 Copyright (C) 2013-2023 FOSS GP
10 Copyright (C) 2019 OpenCFD Ltd.
11-------------------------------------------------------------------------------
12License
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
29Class
30 Foam::volBSplinesBase
31
32Description
33 Class constructing a number of volumetric B-Splines boxes,
34 read from dynamicMeshDict. Useful for various sensitivities and
35 optMeshMovement classes.
36
37 Derives from MeshObject so that all instances know and update the same
38 control points and parametric coordinates are computed only once
39
40SourceFiles
41 volBSplinesBase.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef volBSplinesBase_H
46#define volBSplinesBase_H
47
48#include "NURBS3DVolume.H"
49#include "OFstream.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
56/*---------------------------------------------------------------------------*\
57 Class volBSplinesBase Declaration
58\*---------------------------------------------------------------------------*/
59
60class volBSplinesBase
61:
62 public MeshObject<fvMesh, UpdateableMeshObject, volBSplinesBase>
63{
64 // Private Typedefs
65
66 typedef MeshObject
67 <
68 fvMesh,
70 volBSplinesBase
71 > MeshObject_type;
72
73
74 // Private Member Functions
75
76 //- No copy construct
77 volBSplinesBase(const volBSplinesBase&) = delete;
78
79 //- No copy assignment
80 void operator=(const volBSplinesBase&) = delete;
81
82
83protected:
84
85 // Protected Data
86
87 //- List with volumetric B-splines boxes.
88 // No overlapping is supported
90
91 //- Active design variables numbering for all boxes
93
94
95public:
97 //- Runtime type information
98 TypeName("volBSplinesBase");
99
100
101 // Constructors
102
103 //- Construct from components
104 explicit volBSplinesBase(const fvMesh& mesh);
105
106
107 //- Destructor
108 virtual ~volBSplinesBase() = default;
109
110
111 // Member Functions
112
113 //- Get const reference to the vol. B-splines boxes
114 const PtrList<NURBS3DVolume>& boxes() const;
115
116 //- Get non-const reference to the vol. B-splines boxes
119 //- Get const reference to a specific box
120 const NURBS3DVolume& box(const label boxI) const;
121
122 //- Get non-const reference to a specific box
123 NURBS3DVolume& boxRef(const label boxI);
124
125 //- Get reference to control points
126 const vectorField& getControlPoints(const label& iNURB) const;
127
128 //- Get control points from all boxes
130
131 //- Get cumulative number of control points from all boxes
132 label getTotalControlPointsNumber() const;
133
134 //- Get number of boxes
135 label getNumberOfBoxes() const;
136
137 //- Get start CP ID for each box
138 labelList getStartCpID() const;
139
140 //- Get start CP ID for each box
141 labelList getStartVarID() const;
142
143 //- Find box of certain control point
144 label findBoxID(const label cpI) const;
145
146 //- From design variable ID, return boxID, cpID and direction
147 Vector<label> decomposeDV(const label dvI) const;
148
149 //- Get active design variables
150 const labelList& getActiveDesignVariables() const;
151
152 //- Get max boundary displacement for a given control-points
153 //- movement
155 (
156 const vectorField& controlPointsMovement,
157 const labelList& patchesToBeMoved
158 );
159
160 //- Get the updated boundary points only
162 (
163 const vectorField& controlPointsMovement,
164 const labelList& patchesToBeMoved
165 );
166
167 //- Bound control points movement
169 (
170 vectorField& controlPointsMovement
171 ) const;
172
173 //- Move control points. No effect on mesh
174 void moveControlPoints(const vectorField& controlPointsMovement);
175
176 //- Write control points to constant and optimisation folders
177 void writeControlPoints() const;
178
179 //- Dummy function required by MeshObject.
180 // Since this class is going to initiate the mesh movement,
181 // there is nothing more to be done when the mesh points change
182 virtual bool movePoints();
183
184 //- Dummy function required by MeshObject.
185 // Since this class is going to initiate the mesh movement,
186 // there is nothing more to be done when the mesh points change
187 virtual void updateMesh(const mapPolyMesh&);
188};
189
190
191// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192
193} // End namespace Foam
194
195// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196
197#endif
198
199// ************************************************************************* //
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition PtrList.H:67
Templated 3D Vector derived from VectorSpace adding construction from 3 components,...
Definition Vector.H:61
Mesh data needed to do the Finite Volume discretisation.
Definition fvMesh.H:85
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for managing temporary objects.
Definition tmp.H:75
virtual bool movePoints()
Dummy function required by MeshObject.
virtual ~volBSplinesBase()=default
Destructor.
void moveControlPoints(const vectorField &controlPointsMovement)
Move control points. No effect on mesh.
const vectorField & getControlPoints(const label &iNURB) const
Get reference to control points.
const PtrList< NURBS3DVolume > & boxes() const
Get const reference to the vol. B-splines boxes.
vectorField getAllControlPoints() const
Get control points from all boxes.
const labelList & getActiveDesignVariables() const
Get active design variables.
void writeControlPoints() const
Write control points to constant and optimisation folders.
scalar computeMaxBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Get max boundary displacement for a given control-points movement.
labelList getStartCpID() const
Get start CP ID for each box.
labelList getStartVarID() const
Get start CP ID for each box.
label findBoxID(const label cpI) const
Find box of certain control point.
NURBS3DVolume & boxRef(const label boxI)
Get non-const reference to a specific box.
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
TypeName("volBSplinesBase")
Runtime type information.
labelList activeDesignVariables_
Active design variables numbering for all boxes.
const NURBS3DVolume & box(const label boxI) const
Get const reference to a specific box.
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
void boundControlPointMovement(vectorField &controlPointsMovement) const
Bound control points movement.
PtrList< NURBS3DVolume > volume_
List with volumetric B-splines boxes.
virtual void updateMesh(const mapPolyMesh &)
Dummy function required by MeshObject.
tmp< vectorField > computeBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Get the updated boundary points only.
label getNumberOfBoxes() const
Get number of boxes.
Vector< label > decomposeDV(const label dvI) const
From design variable ID, return boxID, cpID and direction.
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Field< vector > vectorField
Specialisation of Field<T> for vector.
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68