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-2022 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 polyMesh;
57 
58 /*---------------------------------------------------------------------------*\
59  Class pointConstraints Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class pointConstraints
63 :
64  public MeshObject<pointMesh, UpdateableMeshObject, pointConstraints>
65 {
66  // Private Data
67 
68  //- Mesh points on which to apply special constraints
69  labelList patchPatchPointConstraintPoints_;
70 
71  //- Special constraints (as tensors)
72  tensorField patchPatchPointConstraintTensors_;
73 
74  //- Special constraints (raw)
75  List<pointConstraint> patchPatchPointConstraints_;
76 
77 
78  // Private Member Functions
79 
80  //- Make patch-patch constraints
81  void makePatchPatchAddressing();
82 
83 
84 public:
85 
86  // Declare name of the class and its debug switch
87  ClassName("pointConstraints");
88 
89 
90  // Constructors
91 
92  //- Constructor from pointMesh.
93  explicit pointConstraints(const pointMesh&);
94 
95  //- Disallow default bitwise copy construction
96  pointConstraints(const pointConstraints&) = delete;
97 
98 
99  //- Destructor
101 
102 
103  // Member Functions
104 
105  // Access
106 
107  //- Mesh points on which to apply special constraints
109  {
110  return patchPatchPointConstraintPoints_;
111  }
112 
113  //- Special constraints
115  {
116  return patchPatchPointConstraintTensors_;
117  }
118 
119  //- Actual constraints
121  {
122  return patchPatchPointConstraints_;
123  }
124 
125 
126  // Edit
127 
128  //- Correct weighting factors for moving mesh.
129  virtual bool movePoints();
130 
131  //- Update mesh topology using the morph engine
132  virtual void topoChange(const polyTopoChangeMap&);
133 
134  //- Update from another mesh using the given map
135  virtual void mapMesh(const polyMeshMap&);
136 
137  //- Update corresponding to the given distribution map
138  virtual void distribute(const polyDistributionMap&);
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,
149  const CombineOp& cop
150  );
151 
152  //- Helper: set patchField values from internal values (on
153  // valuePointPatchFields). Opposite of
154  // pointPatchField::setInternalField
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  // Member Operators
190 
191  //- Disallow default bitwise assignment
192  void operator=(const pointConstraints&) = delete;
193 };
194 
195 
196 template<>
197 void pointConstraints::constrainCorners<scalar>
198 (
200 ) const;
201 
202 template<>
203 void pointConstraints::constrainCorners<label>
204 (
206 ) const;
207 
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 } // End namespace Foam
212 
213 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 
215 #ifdef NoRepository
216  #include "pointConstraintsTemplates.C"
217 #endif
218 
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
220 
221 #endif
222 
223 // ************************************************************************* //
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
Definition: pointData.H:60
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
ClassName("pointConstraints")
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
virtual bool movePoints()
Correct weighting factors for moving mesh.
virtual void topoChange(const polyTopoChangeMap &)
Update mesh topology using the morph engine.
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:87
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
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.
const labelList & patchPatchPointConstraintPoints() const
Mesh points on which to apply special constraints.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:50
void constrain(GeometricField< Type, pointPatchField, pointMesh > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
Namespace for OpenFOAM.
~pointConstraints()
Destructor.