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 "DemandDrivenMeshObject.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 :
65  <
66  pointMesh,
67  UpdateableMeshObject,
68  pointConstraints
69  >
70 {
71  // Private Data
72 
73  //- Mesh points on which to apply special constraints
74  labelList patchPatchPointConstraintPoints_;
75 
76  //- Special constraints (as tensors)
77  tensorField patchPatchPointConstraintTensors_;
78 
79  //- Special constraints (raw)
80  List<pointConstraint> patchPatchPointConstraints_;
81 
82 
83  // Private Member Functions
84 
85  //- Make patch-patch constraints
86  void makePatchPatchAddressing();
87 
88 
89 protected:
90 
91  friend class DemandDrivenMeshObject
92  <
93  pointMesh,
96  >;
97 
98  // Protected Constructors
99 
100  //- Constructor from pointMesh.
101  explicit pointConstraints(const pointMesh&);
102 
103 
104 public:
105 
106  // Declare name of the class and its debug switch
107  ClassName("pointConstraints");
108 
109 
110  // Constructors
111 
112  //- Disallow default bitwise copy construction
113  pointConstraints(const pointConstraints&) = delete;
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  //- Correct weighting factors for moving mesh.
146  virtual bool movePoints();
147 
148  //- Update mesh topology using the morph engine
149  virtual void topoChange(const polyTopoChangeMap&);
150 
151  //- Update from another mesh using the given map
152  virtual void mapMesh(const polyMeshMap&);
153 
154  //- Update corresponding to the given distribution map
155  virtual void distribute(const polyDistributionMap&);
156 
157 
158  // Interpolation functions
159 
160  //- Helper: sync data on collocated points only
161  template<class Type, class CombineOp>
162  static void syncUntransformedData
163  (
164  const polyMesh& mesh,
166  const CombineOp& cop
167  );
168 
169  //- Helper: set patchField values from internal values (on
170  // valuePointPatchFields). Opposite of
171  // pointPatchField::setInternalField
172  template<class Type>
173  static void setPatchFields
174  (
176  );
177 
178  //- Apply patch-patch constraints only
179  template<class Type>
180  void constrainCorners
181  (
182  PointField<Type>& pf
183  ) const;
184 
185  //- Apply boundary conditions (single-patch constraints) and
186  // patch-patch constraints on generic pointField.
187  // Optionally override valuePointPatchFields with constrained
188  // values (see setPatchFields above)
189  template<class Type>
190  void constrain
191  (
192  PointField<Type>& pf,
193  const bool overrideValue = false
194  ) const;
195 
196  //- Apply boundary conditions (single-patch constraints),
197  // patch-patch constraints and
198  // two-D constraints on displacement field
200  (
201  pointVectorField& displacement,
202  const bool overrideValue = false
203  ) const;
204 
205 
206  // Member Operators
207 
208  //- Disallow default bitwise assignment
209  void operator=(const pointConstraints&) = delete;
210 };
211 
212 
213 template<>
214 void pointConstraints::constrainCorners<scalar>
215 (
217 ) const;
218 
219 template<>
220 void pointConstraints::constrainCorners<label>
221 (
223 ) const;
224 
225 
226 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
227 
228 } // End namespace Foam
229 
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
231 
232 #ifdef NoRepository
233  #include "pointConstraintsTemplates.C"
234 #endif
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Templated abstract base-class for demand-driven mesh objects used to automate their allocation to the...
Application of (multi-)patch point constraints.
virtual bool movePoints()
Correct weighting factors for moving mesh.
const tensorField & patchPatchPointConstraintTensors() const
Special constraints.
ClassName("pointConstraints")
const labelList & patchPatchPointConstraintPoints() const
Mesh points on which to apply special constraints.
void constrain(PointField< Type > &pf, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints) and.
pointConstraints(const pointMesh &)
Constructor from pointMesh.
virtual void topoChange(const polyTopoChangeMap &)
Update mesh topology using the morph engine.
static void syncUntransformedData(const polyMesh &mesh, List< Type > &pointData, const CombineOp &cop)
Helper: sync data on collocated points only.
virtual void distribute(const polyDistributionMap &)
Update corresponding to the given distribution map.
void operator=(const pointConstraints &)=delete
Disallow default bitwise assignment.
const List< pointConstraint > & patchPatchPointConstraints() const
Actual constraints.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
~pointConstraints()
Destructor.
static void setPatchFields(PointField< Type > &)
Helper: set patchField values from internal values (on.
void constrainCorners(PointField< Type > &pf) const
Apply patch-patch constraints only.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Variant of pointEdgePoint with some transported additional data. WIP - should be templated on data li...
Definition: pointData.H:63
Mesh representing a set of points created from polyMesh.
Definition: pointMesh.H:52
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:80
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Namespace for OpenFOAM.