1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
28 The enriched patch contains a double set of faces from the two
29 sides of the sliding interface before the cutting.
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
38 If new points are created during master-slave edge cutting, they
39 should be registred with the pointMap.
44 enrichedPatchCutFaces.C
46 enrichedPatchPointMap.C
47 enrichedPatchPointMergeMap.C
48 enrichedPatchPointPoints.C
50 \*---------------------------------------------------------------------------*/
52 #ifndef enrichedPatch_H
53 #define enrichedPatch_H
55 #include "primitiveFacePatch.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 /*---------------------------------------------------------------------------*\
65 Class enrichedPatch Declaration
66 \*---------------------------------------------------------------------------*/
72 //- Reference to master patch
73 const primitiveFacePatch& masterPatch_;
75 //- Reference to slave patch
76 const primitiveFacePatch& slavePatch_;
78 //- Map of points supporting patch faces
79 mutable Map<point> pointMap_;
81 //- Has the point map been completed?
82 mutable bool pointMapComplete_;
84 //- Map of point merges
85 mutable Map<label> pointMergeMap_;
87 //- Slave point point hits
88 const labelList& slavePointPointHits_;
90 //- Slave point edge hits
91 const labelList& slavePointEdgeHits_;
93 //- Slave point face hits
94 const List<objectHit>& slavePointFaceHits_;
97 // Demand-driven private data
100 mutable faceList* enrichedFacesPtr_;
103 mutable labelList* meshPointsPtr_;
106 mutable faceList* localFacesPtr_;
109 mutable pointField* localPointsPtr_;
111 //- Point-point addressing
112 mutable labelListList* pointPointsPtr_;
114 // Master point addressing
115 mutable Map<labelList>* masterPointFacesPtr_;
118 // Cut faces and addressing
121 mutable faceList* cutFacesPtr_;
124 // - the face on the master patch for internal faces
125 // - the creator face for boundary face
126 mutable labelList* cutFaceMasterPtr_;
129 // - the face on the slave patch for internal faces
130 // - -1 for boundary face
131 mutable labelList* cutFaceSlavePtr_;
134 // Private Member Functions
136 //- Disallow default bitwise copy construct
137 enrichedPatch(const enrichedPatch&);
139 //- Disallow default bitwise assignment
140 void operator=(const enrichedPatch&);
142 // Creation of demand-driven private data
144 //- Calculate point merge map
145 void calcPointMergeMap() const;
147 //- Complete point map
148 void completePointMap() const;
150 //- Calculate mesh points
151 void calcMeshPoints() const;
153 //- Calculate local points
154 void calcLocalPoints() const;
156 //- Calculate local faces
157 void calcLocalFaces() const;
159 //- Calculate point-point addressing
160 void calcPointPoints() const;
162 //- Calculate master point addressing
163 void calcMasterPointFaces() const;
165 //- Calculate cut faces
166 void calcCutFaces() const;
169 void clearCutFaces();
171 //- Clear out demand-driven data
175 // Static data members
177 //- Estimated ratio of original-to-enriched face size
178 static const label enrichedFaceRatio_;
180 //- Estimated number of master face hits by slave points
181 static const label nFaceHits_;
183 //- Size of face on which the check is forced
184 static const label maxFaceSizeDebug_;
189 // Static data members
190 ClassName("enrichedPatch");
194 //- Construct from components
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
216 //- Return non-const access to point map to add points
217 Map<point>& pointMap();
219 //- Return map of points
220 const Map<point>& pointMap() const;
222 //- Return map of point merges
223 Map<label>& pointMergeMap()
225 return pointMergeMap_;
228 //- Return map of point merges
229 const Map<label>& pointMergeMap() const
231 return pointMergeMap_;
237 //- Calculate enriched faces
238 void calcEnrichedFaces
240 const labelListList& pointsIntoMasterEdges,
241 const labelListList& pointsIntoSlaveEdges,
242 const pointField& projectedSlavePoints
245 //- Return enriched faces
246 const faceList& enrichedFaces() const;
248 //- Return mesh points
249 const labelList& meshPoints() const;
251 //- Return local faces
252 const faceList& localFaces() const;
254 //- Return local points
255 const pointField& localPoints() const;
257 //- Return point-point addressing
258 const labelListList& pointPoints() const;
260 //- Master point face addressing
261 const Map<labelList>& masterPointFaces() const;
266 //- Return list of cut faces
267 const faceList& cutFaces() const;
269 //- Return cut face master list
270 const labelList& cutFaceMaster() const;
272 //- Return cut face slave list
273 const labelList& cutFaceSlave() const;
276 //- Check if the patch is fully supported
277 bool checkSupport() const;
280 //- Debugging: dump graphical representation to obj format file
281 void writeOBJ(const fileName&) const;
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
287 } // End namespace Foam
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
293 // ************************************************************************* //