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-2018 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  //- Disallow default bitwise copy construct
86 
87  //- Disallow default bitwise assignment
88  void operator=(const pointConstraints&);
89 
90 
91 public:
92 
93  // Declare name of the class and its debug switch
94  ClassName("pointConstraints");
95 
96 
97  // Constructors
98 
99  //- Constructor from pointMesh.
100  explicit pointConstraints(const pointMesh&);
101 
102 
103  //- Destructor
105 
106 
107  // Member functions
108 
109  // Access
110 
111  //- Mesh points on which to apply special constraints
113  {
114  return patchPatchPointConstraintPoints_;
115  }
116 
117  //- Special constraints
119  {
120  return patchPatchPointConstraintTensors_;
121  }
122 
123  //- Actual constraints
125  {
126  return patchPatchPointConstraints_;
127  }
128 
129 
130  // Edit
131 
132  //- Update mesh topology using the morph engine
133  void updateMesh(const mapPolyMesh&);
134 
135  //- Correct weighting factors for moving mesh.
136  bool movePoints();
137 
138 
139  // Interpolation functions
140 
141  //- Helper: sync data on collocated points only
142  template<class Type, class CombineOp>
143  static void syncUntransformedData
144  (
145  const polyMesh& mesh,
147  const CombineOp& cop
148  );
149 
150  //- Helper: set patchField values from internal values (on
151  // valuePointPatchFields). Opposite of
152  // pointPatchField::setInInternalField
153  template<class Type>
154  static void setPatchFields
155  (
157  );
158 
159  //- Apply patch-patch constraints only
160  template<class Type>
161  void constrainCorners
162  (
164  ) const;
165 
166  //- Apply boundary conditions (single-patch constraints) and
167  // patch-patch constraints on generic pointField.
168  // Optionally override valuePointPatchFields with constrained
169  // values (see setPatchFields above)
170  template<class Type>
171  void constrain
172  (
174  const bool overrideValue = false
175  ) const;
176 
177  //- Apply boundary conditions (single-patch constraints),
178  // patch-patch constraints and
179  // two-D constraints on displacement field
181  (
182  pointVectorField& displacement,
183  const bool overrideValue = false
184  ) const;
185 };
186 
187 
188 template<>
189 void pointConstraints::constrainCorners<scalar>
190 (
192 ) const;
193 template<>
194 void pointConstraints::constrainCorners<label>
195 (
197 ) const;
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #ifdef NoRepository
207  #include "pointConstraintsTemplates.C"
208 #endif
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
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
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:85
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.