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 | Copyright (C) 2011 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 registred 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  //- Disallow default bitwise copy construct
138 
139  //- Disallow default bitwise assignment
140  void operator=(const enrichedPatch&);
141 
142  // Creation of demand-driven private data
143 
144  //- Calculate point merge map
145  void calcPointMergeMap() const;
146 
147  //- Complete point map
148  void completePointMap() const;
149 
150  //- Calculate mesh points
151  void calcMeshPoints() const;
152 
153  //- Calculate local points
154  void calcLocalPoints() const;
155 
156  //- Calculate local faces
157  void calcLocalFaces() const;
158 
159  //- Calculate point-point addressing
160  void calcPointPoints() const;
161 
162  //- Calculate master point addressing
163  void calcMasterPointFaces() const;
164 
165  //- Calculate cut faces
166  void calcCutFaces() const;
167 
168  //- Clear cut faces
169  void clearCutFaces();
170 
171  //- Clear out demand-driven data
172  void clearOut();
173 
174 
175  // Static data members
176 
177  //- Estimated ratio of original-to-enriched face size
178  static const label enrichedFaceRatio_;
179 
180  //- Estimated number of master face hits by slave points
181  static const label nFaceHits_;
182 
183  //- Size of face on which the check is forced
184  static const label maxFaceSizeDebug_;
185 
186 
187 public:
188 
189  // Static data members
190  ClassName("enrichedPatch");
191 
192  // Constructors
193 
194  //- Construct from components
196  (
197  const primitiveFacePatch& masterPatch,
198  const primitiveFacePatch& slavePatch,
199  const labelList& slavePointPointHits,
200  // -1 or common point snapped to
201  const labelList& slavePointEdgeHits,
202  // -1 or common edge snapped to
203  const List<objectHit>& slavePointFaceHits
204  // master face snapped to
205  );
206 
207 
208  //- Destructor
209  ~enrichedPatch();
210 
211 
212  // Member Functions
213 
214  // Access
215 
216  //- Return non-const access to point map to add points
217  Map<point>& pointMap();
218 
219  //- Return map of points
220  const Map<point>& pointMap() const;
221 
222  //- Return map of point merges
224  {
225  return pointMergeMap_;
226  }
227 
228  //- Return map of point merges
229  const Map<label>& pointMergeMap() const
230  {
231  return pointMergeMap_;
232  }
233 
234 
235  // Topological data
236 
237  //- Calculate enriched faces
238  void calcEnrichedFaces
239  (
240  const labelListList& pointsIntoMasterEdges,
241  const labelListList& pointsIntoSlaveEdges,
242  const pointField& projectedSlavePoints
243  );
244 
245  //- Return enriched faces
246  const faceList& enrichedFaces() const;
247 
248  //- Return mesh points
249  const labelList& meshPoints() const;
250 
251  //- Return local faces
252  const faceList& localFaces() const;
253 
254  //- Return local points
255  const pointField& localPoints() const;
256 
257  //- Return point-point addressing
258  const labelListList& pointPoints() const;
259 
260  //- Master point face addressing
261  const Map<labelList>& masterPointFaces() const;
262 
263 
264  // Cut faces
265 
266  //- Return list of cut faces
267  const faceList& cutFaces() const;
268 
269  //- Return cut face master list
270  const labelList& cutFaceMaster() const;
271 
272  //- Return cut face slave list
273  const labelList& cutFaceSlave() const;
274 
275 
276  //- Check if the patch is fully supported
277  bool checkSupport() const;
278 
279 
280  //- Debugging: dump graphical representation to obj format file
281  void writeOBJ(const fileName&) const;
282 };
283 
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 } // End namespace Foam
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 #endif
292 
293 // ************************************************************************* //
void calcEnrichedFaces(const labelListList &pointsIntoMasterEdges, const labelListList &pointsIntoSlaveEdges, const pointField &projectedSlavePoints)
Calculate enriched faces.
A class for handling file names.
Definition: fileName.H:69
A HashTable to objects of type <T> with a label key.
Definition: Map.H:49
const labelList & cutFaceSlave() const
Return cut face slave list.
const labelListList & pointPoints() const
Return point-point addressing.
The enriched patch contains a double set of faces from the two sides of the sliding interface before ...
Definition: enrichedPatch.H:67
Map< point > & pointMap()
Return non-const access to point map to add points.
const faceList & localFaces() const
Return local faces.
const pointField & localPoints() const
Return local points.
const labelList & meshPoints() const
Return mesh points.
const faceList & cutFaces() const
Return list of cut faces.
A list of faces which address into the list of points.
const labelList & cutFaceMaster() const
Return cut face master list.
ClassName("enrichedPatch")
const Map< labelList > & masterPointFaces() const
Master point face addressing.
~enrichedPatch()
Destructor.
void writeOBJ(const fileName &) const
Debugging: dump graphical representation to obj format file.
Map< label > & pointMergeMap()
Return map of point merges.
bool checkSupport() const
Check if the patch is fully supported.
const faceList & enrichedFaces() const
Return enriched faces.