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
74 
75  //- Reference to slave patch
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
89 
90  //- Slave point edge hits
92 
93  //- Slave point face hits
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
113 
114  // Master point addressing
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 // ************************************************************************* //
Foam::enrichedPatch::cutFaceMasterPtr_
labelList * cutFaceMasterPtr_
Cut face master.
Definition: enrichedPatch.H:125
Foam::enrichedPatch::meshPoints
const labelList & meshPoints() const
Return mesh points.
Definition: enrichedPatch.C:178
Foam::enrichedPatch::masterPointFaces
const Map< labelList > & masterPointFaces() const
Master point face addressing.
Definition: enrichedPatchMasterPoints.C:148
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::enrichedPatch::slavePointEdgeHits_
const labelList & slavePointEdgeHits_
Slave point edge hits.
Definition: enrichedPatch.H:90
Foam::enrichedPatch::pointMergeMap
const Map< label > & pointMergeMap() const
Return map of point merges.
Definition: enrichedPatch.H:228
Foam::enrichedPatch::enrichedFacesPtr_
faceList * enrichedFacesPtr_
Enriched patch.
Definition: enrichedPatch.H:99
Foam::enrichedPatch::cutFaceSlavePtr_
labelList * cutFaceSlavePtr_
Cut face slave.
Definition: enrichedPatch.H:130
Foam::enrichedPatch::calcEnrichedFaces
void calcEnrichedFaces(const labelListList &pointsIntoMasterEdges, const labelListList &pointsIntoSlaveEdges, const pointField &projectedSlavePoints)
Calculate enriched faces.
Definition: enrichedPatchFaces.C:37
point.H
Foam::enrichedPatch::slavePatch_
const primitiveFacePatch & slavePatch_
Reference to slave patch.
Definition: enrichedPatch.H:75
Foam::Map
A HashTable to objects of type <T> with a label key.
Definition: PrimitivePatchTemplate.H:68
Foam::enrichedPatch
The enriched patch contains a double set of faces from the two sides of the sliding interface before ...
Definition: enrichedPatch.H:67
Foam::enrichedPatch::masterPointFacesPtr_
Map< labelList > * masterPointFacesPtr_
Definition: enrichedPatch.H:114
Foam::enrichedPatch::nFaceHits_
static const label nFaceHits_
Estimated number of master face hits by slave points.
Definition: enrichedPatch.H:180
Foam::enrichedPatch::pointMergeMap_
Map< label > pointMergeMap_
Map of point merges.
Definition: enrichedPatch.H:84
Foam::enrichedPatch::localPoints
const pointField & localPoints() const
Return local points.
Definition: enrichedPatch.C:200
Foam::enrichedPatch::checkSupport
bool checkSupport() const
Check if the patch is fully supported.
Definition: enrichedPatch.C:222
Foam::enrichedPatch::masterPatch_
const primitiveFacePatch & masterPatch_
Reference to master patch.
Definition: enrichedPatch.H:72
Foam::enrichedPatch::pointMergeMap
Map< label > & pointMergeMap()
Return map of point merges.
Definition: enrichedPatch.H:222
Foam::enrichedPatch::meshPointsPtr_
labelList * meshPointsPtr_
Mesh points.
Definition: enrichedPatch.H:102
Foam::enrichedPatch::localPointsPtr_
pointField * localPointsPtr_
Local points.
Definition: enrichedPatch.H:108
Foam::enrichedPatch::pointMap
Map< point > & pointMap()
Return non-const access to point map to add points.
Definition: enrichedPatchPointMap.C:83
Map.H
Foam::enrichedPatch::localFacesPtr_
faceList * localFacesPtr_
Local faces.
Definition: enrichedPatch.H:105
Foam::enrichedPatch::enrichedFaceRatio_
static const label enrichedFaceRatio_
Estimated ratio of original-to-enriched face size.
Definition: enrichedPatch.H:177
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::enrichedPatch::calcMasterPointFaces
void calcMasterPointFaces() const
Calculate master point addressing.
Definition: enrichedPatchMasterPoints.C:37
Foam::enrichedPatch::writeOBJ
void writeOBJ(const fileName &) const
Debugging: dump graphical representation to obj format file.
Definition: enrichedPatch.C:251
Foam::enrichedPatch::calcPointMergeMap
void calcPointMergeMap() const
Calculate point merge map.
Foam::enrichedPatch::calcCutFaces
void calcCutFaces() const
Calculate cut faces.
Definition: enrichedPatchCutFaces.C:50
Foam::enrichedPatch::slavePointFaceHits_
const List< objectHit > & slavePointFaceHits_
Slave point face hits.
Definition: enrichedPatch.H:93
Foam::enrichedPatch::pointPointsPtr_
labelListList * pointPointsPtr_
Point-point addressing.
Definition: enrichedPatch.H:111
Foam::enrichedPatch::pointMapComplete_
bool pointMapComplete_
Has the point map been completed?
Definition: enrichedPatch.H:81
Foam::enrichedPatch::operator=
void operator=(const enrichedPatch &)
Disallow default bitwise assignment.
Foam::enrichedPatch::calcLocalPoints
void calcLocalPoints() const
Calculate local points.
Definition: enrichedPatch.C:97
Foam::enrichedPatch::cutFaces
const faceList & cutFaces() const
Return list of cut faces.
Definition: enrichedPatchCutFaces.C:669
Foam::enrichedPatch::enrichedFaces
const faceList & enrichedFaces() const
Return enriched faces.
Definition: enrichedPatchFaces.C:379
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::enrichedPatch::cutFacesPtr_
faceList * cutFacesPtr_
Cut faces.
Definition: enrichedPatch.H:120
Foam::enrichedPatch::localFaces
const faceList & localFaces() const
Return local faces.
Definition: enrichedPatch.C:189
Foam::enrichedPatch::pointPoints
const labelListList & pointPoints() const
Return point-point addressing.
Definition: enrichedPatch.C:211
Foam::enrichedPatch::slavePointPointHits_
const labelList & slavePointPointHits_
Slave point point hits.
Definition: enrichedPatch.H:87
Foam::enrichedPatch::cutFaceSlave
const labelList & cutFaceSlave() const
Return cut face slave list.
Definition: enrichedPatchCutFaces.C:691
Foam::enrichedPatch::~enrichedPatch
~enrichedPatch()
Destructor.
Definition: enrichedPatch.C:170
Foam::enrichedPatch::clearOut
void clearOut()
Clear out demand-driven data.
Definition: enrichedPatch.C:118
Foam::enrichedPatch::ClassName
ClassName("enrichedPatch")
Foam::enrichedPatch::completePointMap
void completePointMap() const
Complete point map.
Definition: enrichedPatchPointMap.C:30
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::enrichedPatch::maxFaceSizeDebug_
static const label maxFaceSizeDebug_
Size of face on which the check is forced.
Definition: enrichedPatch.H:183
Foam::enrichedPatch::calcPointPoints
void calcPointPoints() const
Calculate point-point addressing.
Definition: enrichedPatchPointPoints.C:35
Foam::enrichedPatch::calcMeshPoints
void calcMeshPoints() const
Calculate mesh points.
Definition: enrichedPatch.C:41
Foam::enrichedPatch::enrichedPatch
enrichedPatch(const enrichedPatch &)
Disallow default bitwise copy construct.
Foam::enrichedPatch::calcLocalFaces
void calcLocalFaces() const
Calculate local faces.
Definition: enrichedPatch.C:57
Foam::enrichedPatch::clearCutFaces
void clearCutFaces()
Clear cut faces.
Definition: enrichedPatchCutFaces.C:659
Foam::enrichedPatch::cutFaceMaster
const labelList & cutFaceMaster() const
Return cut face master list.
Definition: enrichedPatchCutFaces.C:680
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88
Foam::enrichedPatch::pointMap_
Map< point > pointMap_
Map of points supporting patch faces.
Definition: enrichedPatch.H:78