PatchTools.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
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 -------------------------------------------------------------------------------
8 License
9  This file is part of foam-extend.
10 
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.
15 
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.
20 
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/>.
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 
44 #include "PrimitivePatchTemplate.H"
45 #include "HashSet.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 /*---------------------------------------------------------------------------*\
53  Class PatchTools Declaration
54 \*---------------------------------------------------------------------------*/
55 
56 class PatchTools
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,
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,
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 // ************************************************************************* //
Foam::faceMap
Pair< int > faceMap(const label facePi, const face &faceP, const label faceNi, const face &faceN)
Definition: blockMeshMergeFast.C:90
Foam::HashSet< label, Hash< label > >
Foam::PatchTools::subsetMap
static void subsetMap(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &includeFaces, labelList &pointMap, labelList &faceMap)
Determine the mapping for a sub-patch.
Definition: PatchToolsSearch.C:173
PrimitivePatchTemplate.H
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::faceZone
A subset of mesh faces organised as a primitive patch.
Definition: faceZone.H:64
Foam::PatchTools::markZone
static void markZone(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, const label faceI, const label currentZone, labelList &faceZone)
Fill faceZone with currentZone for every face reachable.
Definition: PatchToolsSearch.C:46
Foam::PatchTools
A collection of tools for searching, sorting PrimitivePatch information.
Definition: PatchTools.H:55
HashSet.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::PatchTools::sortedEdgeFaces
static labelListList sortedEdgeFaces(const PrimitivePatch< Face, FaceList, PointField, PointType > &)
Return edge-face addressing sorted by angle around the edge.
Foam::PatchTools::edgeOwner
static labelList edgeOwner(const PrimitivePatch< Face, FaceList, PointField, PointType > &)
If 2 face neighbours: label of face where ordering of edge.
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::PatchTools::markZones
static label markZones(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const BoolListType &borderEdge, labelList &faceZone)
Size and fills faceZone with zone of face.
Foam::PatchTools::checkOrientation
static bool checkOrientation(const PrimitivePatch< Face, FaceList, PointField, PointType > &, const bool report=false, labelHashSet *marked=0)
Check for orientation issues.
Definition: PatchToolsCheck.C:40
Foam::PrimitivePatch
A list of faces which address into the list of points.
Definition: PrimitivePatchTemplate.H:88