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