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 class pointMesh;
59 class polyMesh;
60 
61 /*---------------------------------------------------------------------------*\
62  Class pointConstraints Declaration
63 \*---------------------------------------------------------------------------*/
64 
65 class pointConstraints
66 :
67  public MeshObject<pointMesh, UpdateableMeshObject, pointConstraints>
68 {
69  // Private data
70 
71  // Patch-patch constraints
72 
73  //- Mesh points on which to apply special constraints
74  labelList patchPatchPointConstraintPoints_;
75  //- Special constraints (as tensors)
76  tensorField patchPatchPointConstraintTensors_;
77  //- Special constraints (raw)
78  List<pointConstraint> patchPatchPointConstraints_;
79 
80 
81  // Private Member Functions
82 
83  //- Make patch-patch constraints
84  void makePatchPatchAddressing();
85 
86  //- No copy construct
87  pointConstraints(const pointConstraints&) = delete;
88 
89  //- No copy assignment
90  void operator=(const pointConstraints&) = delete;
91 
92 
93 public:
94 
95  // Declare name of the class and its debug switch
96  ClassName("pointConstraints");
97 
98 
99  // Constructors
100 
101  //- Constructor from pointMesh.
102  explicit pointConstraints(const pointMesh&);
103 
104 
105  //- Destructor
107 
108 
109  // Member functions
110 
111  // Access
112 
113  //- Mesh points on which to apply special constraints
115  {
116  return patchPatchPointConstraintPoints_;
117  }
118 
119  //- Special constraints
121  {
122  return patchPatchPointConstraintTensors_;
123  }
124 
125  //- Actual constraints
127  {
128  return patchPatchPointConstraints_;
129  }
130 
131 
132  // Edit
133 
134  //- Update mesh topology using the morph engine
135  void updateMesh(const mapPolyMesh&);
136 
137  //- Correct weighting factors for moving mesh.
138  bool movePoints();
139 
140 
141  // Interpolation functions
142 
143  //- Helper: sync data on collocated points only
144  template<class Type, class CombineOp>
145  static void syncUntransformedData
146  (
147  const polyMesh& mesh,
148  List<Type>& pointData,
149  const CombineOp& cop
150  );
151 
152  //- Helper: set patchField values from internal values (on
153  // valuePointPatchFields). Opposite of
154  // pointPatchField::setInInternalField
155  template<class Type>
156  static void setPatchFields
157  (
159  );
160 
161  //- Apply patch-patch constraints only
162  template<class Type>
163  void constrainCorners
164  (
166  ) const;
167 
168  //- Apply boundary conditions (single-patch constraints) and
169  // patch-patch constraints on generic pointField.
170  // Optionally override valuePointPatchFields with constrained
171  // values (see setPatchFields above)
172  template<class Type>
173  void constrain
174  (
176  const bool overrideValue = false
177  ) const;
178 
179  //- Apply boundary conditions (single-patch constraints),
180  // patch-patch constraints and
181  // two-D constraints on displacement field
183  (
184  pointVectorField& displacement,
185  const bool overrideValue = false
186  ) const;
187 };
188 
189 
190 template<>
191 void pointConstraints::constrainCorners<scalar>
192 (
194 ) const;
195 template<>
196 void pointConstraints::constrainCorners<label>
197 (
199 ) const;
200 
201 
202 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
203 
204 } // End namespace Foam
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 #ifdef NoRepository
209  #include "pointConstraintsTemplates.C"
210 #endif
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 #endif
215 
216 // ************************************************************************* //
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:157
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:85
const pointMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:157
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:74
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
Namespace for OpenFOAM.
~pointConstraints()
Destructor.