enrichedPatch.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) 2011-2020 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::enrichedPatch
26 
27 Description
28  The enriched patch contains a double set of faces from the two
29  sides of the sliding interface before the cutting.
30 
31  The patch basically consists of two over-lapping sets of faces sitting
32  on a common point support, where every edge may be shared by more than
33  2 faces. The patch points are collected in a map. Additional
34  information needed for cutting is the point insertion into every edge
35  of master and slave.
36 
37  Note:
38  If new points are created during master-slave edge cutting, they
39  should be registered with the pointMap.
40 
41 
42 SourceFiles
43  enrichedPatch.C
44  enrichedPatchCutFaces.C
45  enrichedPatchFaces.C
46  enrichedPatchPointMap.C
47  enrichedPatchPointMergeMap.C
48  enrichedPatchPointPoints.C
49 
50 \*---------------------------------------------------------------------------*/
51 
52 #ifndef enrichedPatch_H
53 #define enrichedPatch_H
54 
55 #include "primitiveFacePatch.H"
56 #include "Map.H"
57 #include "point.H"
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 /*---------------------------------------------------------------------------*\
65  Class enrichedPatch Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class enrichedPatch
69 {
70  // Private Data
71 
72  //- Reference to master patch
73  const primitiveFacePatch& masterPatch_;
74 
75  //- Reference to slave patch
76  const primitiveFacePatch& slavePatch_;
77 
78  //- Map of points supporting patch faces
79  mutable Map<point> pointMap_;
80 
81  //- Has the point map been completed?
82  mutable bool pointMapComplete_;
83 
84  //- Map of point merges
85  mutable Map<label> pointMergeMap_;
86 
87  //- Slave point point hits
88  const labelList& slavePointPointHits_;
89 
90  //- Slave point edge hits
91  const labelList& slavePointEdgeHits_;
92 
93  //- Slave point face hits
94  const List<objectHit>& slavePointFaceHits_;
95 
96 
97  // Demand-driven private data
98 
99  //- Enriched patch
100  mutable faceList* enrichedFacesPtr_;
101 
102  //- Mesh points
103  mutable labelList* meshPointsPtr_;
104 
105  //- Local faces
106  mutable faceList* localFacesPtr_;
107 
108  //- Local points
109  mutable pointField* localPointsPtr_;
110 
111  //- Point-point addressing
112  mutable labelListList* pointPointsPtr_;
113 
114  // Master point addressing
115  mutable Map<labelList>* masterPointFacesPtr_;
116 
117 
118  // Cut faces and addressing
119 
120  //- Cut faces
121  mutable faceList* cutFacesPtr_;
122 
123  //- Cut face master
124  // - the face on the master patch for internal faces
125  // - the creator face for boundary face
126  mutable labelList* cutFaceMasterPtr_;
127 
128  //- Cut face slave
129  // - the face on the slave patch for internal faces
130  // - -1 for boundary face
131  mutable labelList* cutFaceSlavePtr_;
132 
133 
134  // Private Member Functions
135 
136  // Creation of demand-driven private data
137 
138  //- Calculate point merge map
139  void calcPointMergeMap() const;
140 
141  //- Complete point map
142  void completePointMap() const;
143 
144  //- Calculate mesh points
145  void calcMeshPoints() const;
146 
147  //- Calculate local points
148  void calcLocalPoints() const;
149 
150  //- Calculate local faces
151  void calcLocalFaces() const;
152 
153  //- Calculate point-point addressing
154  void calcPointPoints() const;
155 
156  //- Calculate master point addressing
157  void calcMasterPointFaces() const;
158 
159  //- Calculate cut faces
160  void calcCutFaces() const;
161 
162  //- Clear cut faces
163  void clearCutFaces();
164 
165  //- Clear out demand-driven data
166  void clearOut();
167 
168 
169  // Static Data Members
170 
171  //- Estimated ratio of original-to-enriched face size
172  static const label enrichedFaceRatio_;
173 
174  //- Estimated number of master face hits by slave points
175  static const label nFaceHits_;
176 
177  //- Size of face on which the check is forced
178  static const label maxFaceSizeDebug_;
179 
180 
181 public:
182 
183  // Static Data Members
184  ClassName("enrichedPatch");
185 
186  // Constructors
187 
188  //- Construct from components
190  (
191  const primitiveFacePatch& masterPatch,
192  const primitiveFacePatch& slavePatch,
193  const labelList& slavePointPointHits,
194  // -1 or common point snapped to
195  const labelList& slavePointEdgeHits,
196  // -1 or common edge snapped to
197  const List<objectHit>& slavePointFaceHits
198  // master face snapped to
199  );
200 
201  //- Disallow default bitwise copy construction
202  enrichedPatch(const enrichedPatch&) = delete;
203 
204 
205  //- Destructor
206  ~enrichedPatch();
207 
208 
209  // Member Functions
210 
211  // Access
212 
213  //- Return non-const access to point map to add points
214  Map<point>& pointMap();
215 
216  //- Return map of points
217  const Map<point>& pointMap() const;
218 
219  //- Return map of point merges
221  {
222  return pointMergeMap_;
223  }
224 
225  //- Return map of point merges
226  const Map<label>& pointMergeMap() const
227  {
228  return pointMergeMap_;
229  }
230 
231 
232  // Topological data
233 
234  //- Calculate enriched faces
235  void calcEnrichedFaces
236  (
237  const labelListList& pointsIntoMasterEdges,
238  const labelListList& pointsIntoSlaveEdges,
239  const pointField& projectedSlavePoints
240  );
241 
242  //- Return enriched faces
243  const faceList& enrichedFaces() const;
244 
245  //- Return mesh points
246  const labelList& meshPoints() const;
247 
248  //- Return local faces
249  const faceList& localFaces() const;
250 
251  //- Return local points
252  const pointField& localPoints() const;
253 
254  //- Return point-point addressing
255  const labelListList& pointPoints() const;
256 
257  //- Master point face addressing
258  const Map<labelList>& masterPointFaces() const;
259 
260 
261  // Cut faces
262 
263  //- Return list of cut faces
264  const faceList& cutFaces() const;
265 
266  //- Return cut face master list
267  const labelList& cutFaceMaster() const;
268 
269  //- Return cut face slave list
270  const labelList& cutFaceSlave() const;
271 
272 
273  //- Check if the patch is fully supported
274  bool checkSupport() const;
275 
276 
277  //- Debugging: dump graphical representation to obj format file
278  void writeOBJ(const fileName&) const;
279 
280 
281  // Member Operators
282 
283  //- Disallow default bitwise assignment
284  void operator=(const enrichedPatch&) = delete;
285 };
286 
287 
288 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
289 
290 } // End namespace Foam
291 
292 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293 
294 #endif
295 
296 // ************************************************************************* //
Map< point > & pointMap()
Return non-const access to point map to add points.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
A class for handling file names.
Definition: fileName.H:79
void operator=(const enrichedPatch &)=delete
Disallow default bitwise assignment.
void writeOBJ(const fileName &) const
Debugging: dump graphical representation to obj format file.
const labelList & cutFaceMaster() const
Return cut face master list.
enrichedPatch(const primitiveFacePatch &masterPatch, const primitiveFacePatch &slavePatch, const labelList &slavePointPointHits, const labelList &slavePointEdgeHits, const List< objectHit > &slavePointFaceHits)
Construct from components.
const faceList & cutFaces() const
Return list of cut faces.
const Map< labelList > & masterPointFaces() const
Master point face addressing.
bool checkSupport() const
Check if the patch is fully supported.
const faceList & enrichedFaces() const
Return enriched faces.
~enrichedPatch()
Destructor.
A list of faces which address into the list of points.
const labelList & cutFaceSlave() const
Return cut face slave list.
The enriched patch contains a double set of faces from the two sides of the sliding interface before ...
Definition: enrichedPatch.H:67
ClassName("enrichedPatch")
const labelListList & pointPoints() const
Return point-point addressing.
Map< label > & pointMergeMap()
Return map of point merges.
const pointField & localPoints() const
Return local points.
void calcEnrichedFaces(const labelListList &pointsIntoMasterEdges, const labelListList &pointsIntoSlaveEdges, const pointField &projectedSlavePoints)
Calculate enriched faces.
const faceList & localFaces() const
Return local faces.
const labelList & meshPoints() const
Return mesh points.
Namespace for OpenFOAM.
A HashTable to objects of type <T> with a label key.
Definition: Map.H:49