pointConstraints.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2013-2019 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::pointConstraints
26 
27 Description
28  Application of (multi-)patch point constraints.
29 
30  Note: includes all points which are on the boundary of a patch
31  with a constraint. It includes them (even though the constraint
32  will already be implemented through the patch evaluation)
33  since these points might be
34  coupled to points which are not on any constraint patch and we
35  don't want to get inconsistency between the two points.
36 
37 SourceFiles
38  pointConstraints.C
39  pointConstraintsTemplates.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef pointConstraints_H
44 #define pointConstraints_H
45 
46 #include "MeshObject.H"
47 #include "tensorField.H"
48 #include "pointFieldsFwd.H"
49 #include "pointConstraint.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 class pointMesh;
57 class polyMesh;
58 
59 /*---------------------------------------------------------------------------*\
60  Class pointConstraints Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class pointConstraints
64 :
65  public MeshObject<pointMesh, UpdateableMeshObject, pointConstraints>
66 {
67  // Private Data
68 
69  // Patch-patch constraints
70 
71  //- Mesh points on which to apply special constraints
72  labelList patchPatchPointConstraintPoints_;
73  //- Special constraints (as tensors)
74  tensorField patchPatchPointConstraintTensors_;
75  //- Special constraints (raw)
76  List<pointConstraint> patchPatchPointConstraints_;
77 
78 
79  // Private Member Functions
80 
81  //- Make patch-patch constraints
82  void makePatchPatchAddressing();
83 
84 
85 public:
86 
87  // Declare name of the class and its debug switch
88  ClassName("pointConstraints");
89 
90 
91  // Constructors
92 
93  //- Constructor from pointMesh.
94  explicit pointConstraints(const pointMesh&);
95 
96  //- Disallow default bitwise copy construction
97  pointConstraints(const pointConstraints&) = delete;
98 
99 
100  //- Destructor
102 
103 
104  // Member Functions
105 
106  // Access
107 
108  //- Mesh points on which to apply special constraints
110  {
111  return patchPatchPointConstraintPoints_;
112  }
113 
114  //- Special constraints
116  {
117  return patchPatchPointConstraintTensors_;
118  }
119 
120  //- Actual constraints
122  {
123  return patchPatchPointConstraints_;
124  }
125 
126 
127  // Edit
128 
129  //- Update mesh topology using the morph engine
130  void updateMesh(const mapPolyMesh&);
131 
132  //- Correct weighting factors for moving mesh.
133  bool movePoints();
134 
135 
136  // Interpolation functions
137 
138  //- Helper: sync data on collocated points only
139  template<class Type, class CombineOp>
140  static void syncUntransformedData
141  (
142  const polyMesh& mesh,
144  const CombineOp& cop
145  );
146 
147  //- Helper: set patchField values from internal values (on
148  // valuePointPatchFields). Opposite of
149  // pointPatchField::setInInternalField
150  template<class Type>
151  static void setPatchFields
152  (
154  );
155 
156  //- Apply patch-patch constraints only
157  template<class Type>
158  void constrainCorners
159  (
161  ) const;
162 
163  //- Apply boundary conditions (single-patch constraints) and
164  // patch-patch constraints on generic pointField.
165  // Optionally override valuePointPatchFields with constrained
166  // values (see setPatchFields above)
167  template<class Type>
168  void constrain
169  (
171  const bool overrideValue = false
172  ) const;
173 
174  //- Apply boundary conditions (single-patch constraints),
175  // patch-patch constraints and
176  // two-D constraints on displacement field
178  (
179  pointVectorField& displacement,
180  const bool overrideValue = false
181  ) const;
182 
183 
184  // Member Operators
185 
186  //- Disallow default bitwise assignment
187  void operator=(const pointConstraints&) = delete;
188 };
189 
190 
191 template<>
192 void pointConstraints::constrainCorners<scalar>
193 (
195 ) const;
196 template<>
197 void pointConstraints::constrainCorners<label>
198 (
200 ) const;
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #ifdef NoRepository
210  #include "pointConstraintsTemplates.C"
211 #endif
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #endif
216 
217 // ************************************************************************* //
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
Definition: pointData.H:61
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.
Generic GeometricField class.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
pointConstraints(const pointMesh &)
Constructor from pointMesh.
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:48
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:86
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.
void operator=(const pointConstraints &)=delete
Disallow default bitwise assignment.
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.