enrichedPatch.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::enrichedPatch
29 
30 Description
31  The enriched patch contains a double set of faces from the two
32  sides of the sliding interface before the cutting.
33 
34  The patch basically consists of two over-lapping sets of faces sitting
35  on a common point support, where every edge may be shared by more than
36  2 faces. The patch points are collected in a map. Additional
37  information needed for cutting is the point insertion into every edge
38  of master and slave.
39 
40  Note:
41  If new points are created during master-slave edge cutting, they
42  should be registered with the pointMap.
43 
44 SourceFiles
45  enrichedPatch.C
46  enrichedPatchCutFaces.C
47  enrichedPatchFaces.C
48  enrichedPatchPointMap.C
49  enrichedPatchPointMergeMap.C
50  enrichedPatchPointPoints.C
51 
52 \*---------------------------------------------------------------------------*/
53 
54 #ifndef enrichedPatch_H
55 #define enrichedPatch_H
56 
57 #include "primitiveFacePatch.H"
58 #include "Map.H"
59 #include "point.H"
60 
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
62 
63 namespace Foam
64 {
65 
66 /*---------------------------------------------------------------------------*\
67  Class enrichedPatch Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class enrichedPatch
71 {
72  // Private Data
73 
74  //- Reference to master patch
75  const primitiveFacePatch& masterPatch_;
76 
77  //- Reference to slave patch
78  const primitiveFacePatch& slavePatch_;
79 
80  //- Map of points supporting patch faces
81  mutable Map<point> pointMap_;
82 
83  //- Has the point map been completed?
84  mutable bool pointMapComplete_;
85 
86  //- Map of point merges
87  mutable Map<label> pointMergeMap_;
88 
89  //- Slave point point hits
90  const labelList& slavePointPointHits_;
91 
92  //- Slave point edge hits
93  const labelList& slavePointEdgeHits_;
94 
95  //- Slave point face hits
96  const List<objectHit>& slavePointFaceHits_;
97 
98 
99  // Demand-driven private data
100 
101  //- Enriched patch
102  mutable unique_ptr<faceList> enrichedFacesPtr_;
103 
104  //- Mesh points
105  mutable unique_ptr<labelList> meshPointsPtr_;
106 
107  //- Local faces
108  mutable unique_ptr<faceList> localFacesPtr_;
109 
110  //- Local points
111  mutable unique_ptr<pointField> localPointsPtr_;
112 
113  //- Point-point addressing
114  mutable unique_ptr<labelListList> pointPointsPtr_;
115 
116  // Master point addressing
117  mutable unique_ptr<Map<labelList>> masterPointFacesPtr_;
118 
119 
120  // Cut faces and addressing
121 
122  //- Cut faces
123  mutable unique_ptr<faceList> cutFacesPtr_;
124 
125  //- Cut face master
126  // - the face on the master patch for internal faces
127  // - the creator face for boundary face
128  mutable unique_ptr<labelList> cutFaceMasterPtr_;
129 
130  //- Cut face slave
131  // - the face on the slave patch for internal faces
132  // - -1 for boundary face
133  mutable unique_ptr<labelList> cutFaceSlavePtr_;
134 
135 
136  // Private Member Functions
137 
138  //- No copy construct
139  enrichedPatch(const enrichedPatch&) = delete;
140 
141  //- No copy assignment
142  void operator=(const enrichedPatch&) = delete;
143 
144  // Creation of demand-driven private data
145 
146  //- Calculate point merge map
147  void calcPointMergeMap() const;
148 
149  //- Complete point map
150  void completePointMap() const;
151 
152  //- Calculate mesh points
153  void calcMeshPoints() const;
154 
155  //- Calculate local points
156  void calcLocalPoints() const;
157 
158  //- Calculate local faces
159  void calcLocalFaces() const;
160 
161  //- Calculate point-point addressing
162  void calcPointPoints() const;
163 
164  //- Calculate master point addressing
165  void calcMasterPointFaces() const;
166 
167  //- Calculate cut faces
168  void calcCutFaces() const;
169 
170  //- Clear cut faces
171  void clearCutFaces();
172 
173  //- Clear out demand-driven data
174  void clearOut();
175 
176 
177  // Static Data Members
178 
179  //- Estimated ratio of original-to-enriched face size
180  static const label enrichedFaceRatio_;
181 
182  //- Size of face on which the check is forced
183  static const label maxFaceSizeDebug_;
184 
185 
186 public:
187 
188  // Static data members
189  ClassName("enrichedPatch");
190 
191 
192  // Constructors
193 
194  //- Construct from components
196  (
197  const primitiveFacePatch& masterPatch,
198  const primitiveFacePatch& slavePatch,
199  const labelUList& slavePointPointHits,
200  // -1 or common point snapped to
201  const labelUList& slavePointEdgeHits,
202  // -1 or common edge snapped to
203  const UList<objectHit>& slavePointFaceHits
204  // master face snapped to
205  );
206 
207 
208  //- Destructor
209  ~enrichedPatch() = default;
210 
211 
212  // Member Functions
213 
214  // Access
215 
216  //- Return map of points
217  inline const Map<point>& pointMap() const;
218 
219  //- Return non-const access to point map to add points
220  inline Map<point>& pointMap();
221 
222  //- Return map of point merges
223  inline const Map<label>& pointMergeMap() const;
224 
225  //- Return map of point merges
226  inline Map<label>& pointMergeMap();
227 
228 
229  // Topological data
230 
231  //- Calculate enriched faces
232  void calcEnrichedFaces
233  (
234  const labelListList& pointsIntoMasterEdges,
235  const labelListList& pointsIntoSlaveEdges,
236  const pointField& projectedSlavePoints
237  );
238 
239  //- Return enriched faces
240  const faceList& enrichedFaces() const;
241 
242  //- Return mesh points
243  const labelList& meshPoints() const;
244 
245  //- Return local faces
246  const faceList& localFaces() const;
247 
248  //- Return local points
249  const pointField& localPoints() const;
250 
251  //- Return point-point addressing
252  const labelListList& pointPoints() const;
253 
254  //- Master point face addressing
255  const Map<labelList>& masterPointFaces() const;
256 
257 
258  // Cut faces
259 
260  //- Return list of cut faces
261  const faceList& cutFaces() const;
262 
263  //- Return cut face master list
264  const labelList& cutFaceMaster() const;
265 
266  //- Return cut face slave list
267  const labelList& cutFaceSlave() const;
268 
269 
270  //- Check if the patch is fully supported
271  bool checkSupport() const;
272 
273 
274  //- Debugging: dump graphical representation to obj format file
275  void writeOBJ(const fileName& fName) const;
276 };
277 
278 
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
280 
281 } // End namespace Foam
282 
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
284 
285 #include "enrichedPatchI.H"
286 
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
288 
289 #endif
290 
291 // ************************************************************************* //
Foam::enrichedPatch::meshPoints
const labelList & meshPoints() const
Return mesh points.
Definition: enrichedPatch.C:165
Foam::enrichedPatch::masterPointFaces
const Map< labelList > & masterPointFaces() const
Master point face addressing.
Definition: enrichedPatchMasterPoints.C:103
Foam::fileName
A class for handling file names.
Definition: fileName.H:73
Foam::enrichedPatch::calcEnrichedFaces
void calcEnrichedFaces(const labelListList &pointsIntoMasterEdges, const labelListList &pointsIntoSlaveEdges, const pointField &projectedSlavePoints)
Calculate enriched faces.
Definition: enrichedPatchFaces.C:40
point.H
primitiveFacePatch.H
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: lumpedPointController.H:69
Foam::enrichedPatch
The enriched patch contains a double set of faces from the two sides of the sliding interface before ...
Definition: enrichedPatch.H:69
Foam::enrichedPatch::writeOBJ
void writeOBJ(const fileName &fName) const
Debugging: dump graphical representation to obj format file.
Definition: enrichedPatch.C:236
Foam::enrichedPatch::localPoints
const pointField & localPoints() const
Return local points.
Definition: enrichedPatch.C:187
Foam::enrichedPatch::checkSupport
bool checkSupport() const
Check if the patch is fully supported.
Definition: enrichedPatch.C:209
Map.H
Foam::Field< vector >
Foam::enrichedPatch::~enrichedPatch
~enrichedPatch()=default
Destructor.
Foam::enrichedPatch::cutFaces
const faceList & cutFaces() const
Return list of cut faces.
Definition: enrichedPatchCutFaces.C:653
Foam::enrichedPatch::enrichedFaces
const faceList & enrichedFaces() const
Return enriched faces.
Definition: enrichedPatchFaces.C:387
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::enrichedPatch::localFaces
const faceList & localFaces() const
Return local faces.
Definition: enrichedPatch.C:176
Foam::enrichedPatch::pointPoints
const labelListList & pointPoints() const
Return point-point addressing.
Definition: enrichedPatch.C:198
Foam::enrichedPatch::cutFaceSlave
const labelList & cutFaceSlave() const
Return cut face slave list.
Definition: enrichedPatchCutFaces.C:675
Foam::enrichedPatch::pointMap
const Map< point > & pointMap() const
Return map of points.
Definition: enrichedPatchI.H:30
Foam::enrichedPatch::ClassName
ClassName("enrichedPatch")
enrichedPatchI.H
Foam::List< label >
Foam::UList< label >
Foam::enrichedPatch::pointMergeMap
const Map< label > & pointMergeMap() const
Return map of point merges.
Definition: enrichedPatchI.H:52
Foam::enrichedPatch::cutFaceMaster
const labelList & cutFaceMaster() const
Return cut face master list.
Definition: enrichedPatchCutFaces.C:664
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatch.H:79