FreeFOAM The Cross-Platform CFD Toolkit
PatchTools.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::PatchTools
26 
27 Description
28  A collection of tools for searching, sorting PrimitivePatch information.
29 
30  The class could also be extended to include more that just static methods.
31 
32 SourceFiles
33  PatchTools.C
34  PatchToolsCheck.C
35  PatchToolsEdgeOwner.C
36  PatchToolsSearch.C
37  PatchToolsSortEdges.C
38 
39 \*---------------------------------------------------------------------------*/
40 
41 #ifndef PatchTools_H
42 #define PatchTools_H
43 
45 #include <OpenFOAM/HashSet.H>
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class PatchTools Declaration
54 \*---------------------------------------------------------------------------*/
55 
57 {
58 public:
59 
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
63  template
64  <
65  class Face,
66  template<class> class FaceList,
67  class PointField,
68  class PointType
69  >
70  static bool checkOrientation
71  (
73  const bool report = false,
74  labelHashSet* marked = 0
75  );
76 
77 
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.
81  template
82  <
83  class BoolListType,
84  class Face,
85  template<class> class FaceList,
86  class PointField,
87  class PointType
88  >
89  static void markZone
90  (
92  const BoolListType& borderEdge,
93  const label faceI,
94  const label currentZone,
96  );
97 
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.
101  template
102  <
103  class BoolListType,
104  class Face,
105  template<class> class FaceList,
106  class PointField,
107  class PointType
108  >
109  static label markZones
110  (
112  const BoolListType& borderEdge,
113  labelList& faceZone
114  );
115 
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
121  template
122  <
123  class BoolListType,
124  class Face,
125  template<class> class FaceList,
126  class PointField,
127  class PointType
128  >
129  static void subsetMap
130  (
132  const BoolListType& includeFaces,
133  labelList& pointMap,
134  labelList& faceMap
135  );
136 
137  //- Return edge-face addressing sorted by angle around the edge.
138  // Orientation is anticlockwise looking from edge.vec(localPoints())
139  template
140  <
141  class Face,
142  template<class> class FaceList,
143  class PointField,
144  class PointType
145  >
147  (
149  );
150 
151 
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.
156  template
157  <
158  class Face,
159  template<class> class FaceList,
160  class PointField,
161  class PointType
162  >
163  static labelList edgeOwner
164  (
166  );
167 
168 
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #ifdef NoRepository
179 # include "PatchTools.C"
180 #endif
181 
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 
184 #endif
185 
186 // ************************ vim: set sw=4 sts=4 et: ************************ //