pointConstraints.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) 2013-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::pointConstraints
28 
29 Description
30  Application of (multi-)patch point constraints.
31 
32  Note: includes all points which are on the boundary of a patch
33  with a constraint. It includes them (even though the constraint
34  will already be implemented through the patch evaluation)
35  since these points might be
36  coupled to points which are not on any constraint patch and we
37  don't want to get inconsistency between the two points.
38 
39 SourceFiles
40  pointConstraints.C
41  pointConstraintsTemplates.C
42 
43 \*---------------------------------------------------------------------------*/
44 
45 #ifndef pointConstraints_H
46 #define pointConstraints_H
47 
48 #include "MeshObject.H"
49 #include "tensorField.H"
50 #include "pointFieldsFwd.H"
51 #include "pointConstraint.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward Declarations
59 class pointMesh;
60 class polyMesh;
61 
62 /*---------------------------------------------------------------------------*\
63  Class pointConstraints Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class pointConstraints
67 :
68  public MeshObject<pointMesh, UpdateableMeshObject, pointConstraints>
69 {
70  // Private Typedefs
71 
72  typedef MeshObject
73  <
74  pointMesh,
78 
79 
80  // Private Data
81 
82  // Patch-patch constraints
83 
84  //- Mesh points on which to apply special constraints
85  labelList patchPatchPointConstraintPoints_;
86  //- Special constraints (as tensors)
87  tensorField patchPatchPointConstraintTensors_;
88  //- Special constraints (raw)
89  List<pointConstraint> patchPatchPointConstraints_;
90 
91 
92  // Private Member Functions
93 
94  //- Make patch-patch constraints
95  void makePatchPatchAddressing();
96 
97  //- No copy construct
98  pointConstraints(const pointConstraints&) = delete;
99 
100  //- No copy assignment
101  void operator=(const pointConstraints&) = delete;
102 
103 
104 public:
105 
106  // Declare name of the class and its debug switch
107  ClassName("pointConstraints");
108 
109 
110  // Constructors
111 
112  //- Constructor from pointMesh.
113  explicit pointConstraints(const pointMesh&);
114 
115 
116  //- Destructor
118 
119 
120  // Member functions
121 
122  // Access
123 
124  //- Mesh points on which to apply special constraints
126  {
127  return patchPatchPointConstraintPoints_;
128  }
129 
130  //- Special constraints
132  {
133  return patchPatchPointConstraintTensors_;
134  }
135 
136  //- Actual constraints
138  {
139  return patchPatchPointConstraints_;
140  }
141 
142 
143  // Edit
144 
145  //- Update mesh topology using the morph engine
146  void updateMesh(const mapPolyMesh&);
147 
148  //- Correct weighting factors for moving mesh.
149  bool movePoints();
150 
151 
152  // Interpolation functions
153 
154  //- Helper: sync data on collocated points only
155  template<class Type, class CombineOp>
156  static void syncUntransformedData
157  (
158  const polyMesh& mesh,
159  List<Type>& pointData,
160  const CombineOp& cop
161  );
162 
163  //- Helper: set patchField values from internal values (on
164  // valuePointPatchFields). Opposite of
165  // pointPatchField::setInInternalField
166  template<class Type>
167  static void setPatchFields
168  (
170  );
171 
172  //- Apply patch-patch constraints only
173  template<class Type>
174  void constrainCorners
175  (
177  ) const;
178 
179  //- Apply boundary conditions (single-patch constraints) and
180  // patch-patch constraints on generic pointField.
181  // Optionally override valuePointPatchFields with constrained
182  // values (see setPatchFields above)
183  template<class Type>
184  void constrain
185  (
187  const bool overrideValue = false
188  ) const;
189 
190  //- Apply boundary conditions (single-patch constraints),
191  // patch-patch constraints and
192  // two-D constraints on displacement field
194  (
195  pointVectorField& displacement,
196  const bool overrideValue = false
197  ) const;
198 };
199 
200 
201 template<>
202 void pointConstraints::constrainCorners<scalar>
203 (
205 ) const;
206 template<>
207 void pointConstraints::constrainCorners<label>
208 (
210 ) const;
211 
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 } // End namespace Foam
216 
217 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
218 
219 #ifdef NoRepository
220  #include "pointConstraintsTemplates.C"
221 #endif
222 
223 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
224 
225 #endif
226 
227 // ************************************************************************* //
ClassName("pointConstraints")
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
bool movePoints()
Correct weighting factors for moving mesh.
Forwards and collection of common point field types.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:45
Application of (multi-)patch point constraints.
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:152
const pointMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
void constrainCorners(GeometricField< Type, pointPatchField, pointMesh > &pf) const
Apply patch-patch constraints only.
const tensorField & patchPatchPointConstraintTensors() const
Special constraints.
static void setPatchFields(GeometricField< Type, pointPatchField, pointMesh > &)
Helper: set patchField values from internal values (on.
const List< pointConstraint > & patchPatchPointConstraints() const
Actual constraints.
void updateMesh(const mapPolyMesh &)
Update mesh topology using the morph engine.
const labelList & patchPatchPointConstraintPoints() const
Mesh points on which to apply special constraints.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
Namespace for OpenFOAM.
UpdateableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:352
~pointConstraints()
Destructor.