FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 
56 #include <OpenFOAM/Map.H>
57 #include <OpenFOAM/point.H>
58 
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
60 
61 namespace Foam
62 {
63 
64 // Forward declaration of classes
65 
66 /*---------------------------------------------------------------------------*\
67  Class enrichedPatch Declaration
68 \*---------------------------------------------------------------------------*/
69 
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 faceList* enrichedFacesPtr_;
103 
104  //- Mesh points
105  mutable labelList* meshPointsPtr_;
106 
107  //- Local faces
108  mutable faceList* localFacesPtr_;
109 
110  //- Local points
111  mutable pointField* localPointsPtr_;
112 
113  //- Point-point addressing
114  mutable labelListList* pointPointsPtr_;
115 
116  // Master point addressing
117  mutable Map<labelList>* masterPointFacesPtr_;
118 
119 
120  // Cut faces and addressing
121 
122  //- Cut faces
123  mutable 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 labelList* cutFaceMasterPtr_;
129 
130  //- Cut face slave
131  // - the face on the slave patch for internal faces
132  // - -1 for boundary face
133  mutable labelList* cutFaceSlavePtr_;
134 
135 
136  // Private Member Functions
137 
138  //- Disallow default bitwise copy construct
140 
141  //- Disallow default bitwise assignment
142  void operator=(const enrichedPatch&);
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  //- Estimated number of master face hits by slave points
183  static const label nFaceHits_;
184 
185  //- Size of face on which the check is forced
186  static const label maxFaceSizeDebug_;
187 
188 
189 public:
190 
191  // Static data members
192  ClassName("enrichedPatch");
193 
194  // Constructors
195 
196  //- Construct from components
198  (
199  const primitiveFacePatch& masterPatch,
200  const primitiveFacePatch& slavePatch,
201  const labelList& slavePointPointHits,// -1 or common point snapped to
202  const labelList& slavePointEdgeHits, // -1 or common edge snapped to
203  const List<objectHit>& slavePointFaceHits // master face snapped to
204  );
205 
206 
207  // Destructor
208 
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 // ************************ vim: set sw=4 sts=4 et: ************************ //