1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
28 A collection of tools for searching, sorting PrimitivePatch information.
30 The class could also be extended to include more that just static methods.
39 \*---------------------------------------------------------------------------*/
44 #include "PrimitivePatchTemplate.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 /*---------------------------------------------------------------------------*\
53 Class PatchTools Declaration
54 \*---------------------------------------------------------------------------*/
60 //- Check for orientation issues.
61 // Returns true if problems were found.
62 // If a normal flips across an edge, places it in the HashSet
66 template<class> class FaceList,
70 static bool checkOrientation
72 const PrimitivePatch<Face, FaceList, PointField, PointType>&,
73 const bool report = false,
74 labelHashSet* marked = 0
78 //- Fill faceZone with currentZone for every face reachable
79 // from faceI without crossing edge marked in borderEdge.
80 // Note: faceZone has to be sized nFaces before calling.
85 template<class> class FaceList,
91 const PrimitivePatch<Face, FaceList, PointField, PointType>&,
92 const BoolListType& borderEdge,
94 const label currentZone,
98 //- Size and fills faceZone with zone of face.
99 // Zone is area reachable by edge crossing without crossing borderEdge.
100 // Returns number of zones.
105 template<class> class FaceList,
109 static label markZones
111 const PrimitivePatch<Face, FaceList, PointField, PointType>&,
112 const BoolListType& borderEdge,
116 //- Determine the mapping for a sub-patch.
117 // Only include faces for which bool-list entry is true.
118 // @param[in] includeFaces faces to include
119 // @param[out] pointMap mapping new to old localPoints
120 // @param[out] faceMap mapping new to old faces
125 template<class> class FaceList,
129 static void subsetMap
131 const PrimitivePatch<Face, FaceList, PointField, PointType>&,
132 const BoolListType& includeFaces,
137 //- Return edge-face addressing sorted by angle around the edge.
138 // Orientation is anticlockwise looking from edge.vec(localPoints())
142 template<class> class FaceList,
146 static labelListList sortedEdgeFaces
148 const PrimitivePatch<Face, FaceList, PointField, PointType>&
152 //- If 2 face neighbours: label of face where ordering of edge
153 // is consistent with righthand walk.
154 // If 1 neighbour: label of only face.
155 // If >2 neighbours: undetermined.
159 template<class> class FaceList,
163 static labelList edgeOwner
165 const PrimitivePatch<Face, FaceList, PointField, PointType>&
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 } // End namespace Foam
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 # include "PatchTools.C"
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 // ************************************************************************* //