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-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::volBSplinesBase
31 
32 Description
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 
40 SourceFiles
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 
53 namespace Foam
54 {
55 
56 /*---------------------------------------------------------------------------*\
57  Class volBSplinesBase Declaration
58 \*---------------------------------------------------------------------------*/
59 
60 class volBSplinesBase
61 :
62  public MeshObject<fvMesh, UpdateableMeshObject, volBSplinesBase>
63 {
64 protected:
65 
66  // Protected data
67 
68  //- List with volumetric B-splines boxes.
69  // No overlapping is supported
71 
72  //- Active design variables numbering for all boxes
74 
75 
76 private:
77 
78  // Private Member Functions
79 
80  //- No copy construct
81  volBSplinesBase(const volBSplinesBase&) = delete;
82 
83  //- No copy assignment
84  void operator=(const volBSplinesBase&) = delete;
85 
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("volBSplinesBase");
91 
92 
93  // Constructors
94 
95  //- Construct from components
96  volBSplinesBase(const fvMesh& mesh);
97 
98 
99  //- Destructor
100  virtual ~volBSplinesBase() = default;
101 
102 
103  // Member Functions
104 
105  //- Get const reference to the vol. B-splines boxes
106  const PtrList<NURBS3DVolume>& boxes() const;
107 
108  //- Get non-const reference to the vol. B-splines boxes
110 
111  //- Get const reference to a specific box
112  const NURBS3DVolume& box(const label boxI) const;
113 
114  //- Get non-const reference to a specific box
115  NURBS3DVolume& boxRef(const label boxI);
116 
117  //- Get reference to control points
118  const vectorField& getControlPoints(const label& iNURB) const;
119 
120  //- Get control points from all boxes
122 
123  //- Get cumulative number of control points from all boxes
124  label getTotalControlPointsNumber() const;
125 
126  //- Get number of boxes
127  label getNumberOfBoxes() const;
128 
129  //- Get start CP ID for each box
130  labelList getStartCpID() const;
131 
132  //- Find box of certain control point
133  label findBoxID(const label cpI) const;
134 
135  //- Get active design variables
136  const labelList& getActiveDesignVariables() const;
137 
138  //- Get max boundary displacement for a given control-points
139  //- movement
141  (
142  const vectorField& controlPointsMovement,
143  const labelList& patchesToBeMoved
144  );
145 
146  //- Bound control points movement
147  void boundControlPointMovement(vectorField& controlPointsMovement);
148 
149  //- Move control points. No effect on mesh
150  void moveControlPoints(const vectorField& controlPointsMovement);
151 
152  //- Write control points to constant and optimisation folders
153  void writeControlPoints() const;
154 
155  //- Dummy function required by MeshObject.
156  // Since this class is going to initiate the mesh movement,
157  // there is nothing more to be done when the mesh points change
158  virtual bool movePoints();
159 
160  //- Dummy function required by MeshObject.
161  // Since this class is going to initiate the mesh movement,
162  // there is nothing more to be done when the mesh points change
163  virtual void updateMesh(const mapPolyMesh&);
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
Foam::volBSplinesBase::activeDesignVariables_
labelList activeDesignVariables_
Active design variables numbering for all boxes.
Definition: volBSplinesBase.H:72
Foam::volBSplinesBase::movePoints
virtual bool movePoints()
Dummy function required by MeshObject.
Definition: volBSplinesBase.C:324
Foam::volBSplinesBase::boxRef
NURBS3DVolume & boxRef(const label boxI)
Get non-const reference to a specific box.
Definition: volBSplinesBase.C:133
Foam::volBSplinesBase
Class constructing a number of volumetric B-Splines boxes, read from dynamicMeshDict....
Definition: volBSplinesBase.H:59
Foam::volBSplinesBase::getAllControlPoints
vectorField getAllControlPoints() const
Get control points from all boxes.
Definition: volBSplinesBase.C:145
Foam::volBSplinesBase::findBoxID
label findBoxID(const label cpI) const
Find box of certain control point.
Definition: volBSplinesBase.C:190
Foam::NURBS3DVolume
NURBS3DVolume morpher. Includes support functions for gradient computations Base class providing supp...
Definition: NURBS3DVolume.H:72
Foam::volBSplinesBase::box
const NURBS3DVolume & box(const label boxI) const
Get const reference to a specific box.
Definition: volBSplinesBase.C:127
Foam::volBSplinesBase::getActiveDesignVariables
const labelList & getActiveDesignVariables() const
Get active design variables.
Definition: volBSplinesBase.C:208
Foam::volBSplinesBase::moveControlPoints
void moveControlPoints(const vectorField &controlPointsMovement)
Move control points. No effect on mesh.
Definition: volBSplinesBase.C:284
Foam::volBSplinesBase::boxes
const PtrList< NURBS3DVolume > & boxes() const
Get const reference to the vol. B-splines boxes.
Definition: volBSplinesBase.C:115
OFstream.H
Foam::Field< vector >
Foam::MeshObject< fvMesh, UpdateableMeshObject, volBSplinesBase >::mesh
const fvMesh & mesh() const
Definition: MeshObject.H:122
Foam::volBSplinesBase::getTotalControlPointsNumber
label getTotalControlPointsNumber() const
Get cumulative number of control points from all boxes.
Definition: volBSplinesBase.C:157
Foam::volBSplinesBase::getControlPoints
const vectorField & getControlPoints(const label &iNURB) const
Get reference to control points.
Definition: volBSplinesBase.C:139
Foam::volBSplinesBase::boundControlPointMovement
void boundControlPointMovement(vectorField &controlPointsMovement)
Bound control points movement.
Definition: volBSplinesBase.C:252
Foam::volBSplinesBase::getNumberOfBoxes
label getNumberOfBoxes() const
Get number of boxes.
Definition: volBSplinesBase.C:169
Foam::PtrList
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers....
Definition: List.H:59
Foam::volBSplinesBase::boxesRef
PtrList< NURBS3DVolume > & boxesRef()
Get non-const reference to the vol. B-splines boxes.
Definition: volBSplinesBase.C:121
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::volBSplinesBase::volume_
PtrList< NURBS3DVolume > volume_
List with volumetric B-splines boxes.
Definition: volBSplinesBase.H:69
Foam::volBSplinesBase::computeMaxBoundaryDisplacement
scalar computeMaxBoundaryDisplacement(const vectorField &controlPointsMovement, const labelList &patchesToBeMoved)
Definition: volBSplinesBase.C:215
Foam::volBSplinesBase::getStartCpID
labelList getStartCpID() const
Get start CP ID for each box.
Definition: volBSplinesBase.C:175
Foam::List< label >
NURBS3DVolume.H
Foam::volBSplinesBase::updateMesh
virtual void updateMesh(const mapPolyMesh &)
Dummy function required by MeshObject.
Definition: volBSplinesBase.C:331
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::MeshObject
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:88
Foam::volBSplinesBase::TypeName
TypeName("volBSplinesBase")
Runtime type information.
Foam::volBSplinesBase::writeControlPoints
void writeControlPoints() const
Write control points to constant and optimisation folders.
Definition: volBSplinesBase.C:314
Foam::volBSplinesBase::~volBSplinesBase
virtual ~volBSplinesBase()=default
Destructor.