regionSide.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::regionSide
28 
29 Description
30  Determines the 'side' for every face and connected to a
31  singly-connected (through edges) region of faces. Gets set of faces and
32  a list of mesh edges ('fenceEdges') which should not be crossed.
33  Used in splitting a mesh region.
34 
35  Determines:
36  - For every face on the surface: whether the owner was visited
37  from starting face.
38  - List of faces using an internal point of the region visitable by
39  edge-face-edge walking from the correct side of the region.
40 
41 SourceFiles
42  regionSide.C
43 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef regionSide_H
47 #define regionSide_H
48 
49 #include "HashSet.H"
50 #include "typeInfo.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class primitiveMesh;
59 
60 /*---------------------------------------------------------------------------*\
61  Class regionSide Declaration
62 \*---------------------------------------------------------------------------*/
63 
64 class regionSide
65 {
66  // Private data
67 
68  //- For every face on region tells whether the owner is on the
69  // 'regionside'.
70  labelHashSet sideOwner_;
71 
72  //- Contains the faces using an internal point and visited face
73  labelHashSet insidePointFaces_;
74 
75 
76  // Private Member Functions
77 
78  //- Step across point to other edge on face
79  static label otherEdge
80  (
81  const primitiveMesh& mesh,
82  const label facei,
83  const label edgeI,
84  const label pointi
85  );
86 
87  //- From facei, side celli, cross to other faces/cells by
88  // face-cell walking and store visited faces and update sideOwner_.
89  void visitConnectedFaces
90  (
91  const primitiveMesh& mesh,
92  const labelHashSet& region,
93  const labelHashSet& fenceEdges,
94  const label celli,
95  const label facei,
96  labelHashSet& visitedFace
97  );
98 
99  //- From edge on face connected to point on region (regionPointi) cross
100  // to all other edges using this point by walking across faces
101  // Does not cross regionEdges so stays on one side of region
102  void walkPointConnectedFaces
103  (
104  const primitiveMesh& mesh,
105  const labelHashSet& regionEdges,
106  const label regionPointi,
107  const label startFacei,
108  const label startEdgeI,
109  labelHashSet& visitedEdges
110  );
111 
112  //- Visits all internal points on region and marks edges reachable
113  // from sideOwner side (using walkPointConnectedFaces)
114  void walkAllPointConnectedFaces
115  (
116  const primitiveMesh& mesh,
117  const labelHashSet& regionFaces,
118  const labelHashSet& fenceEdges
119  );
120 
121 public:
122 
123  //- Runtime type information
124  ClassName("regionSide");
125 
126  // Static Functions
127 
128  //- Step across edge onto other face on cell
129  static label otherFace
130  (
131  const primitiveMesh& mesh,
132  const label celli,
133  const label excludeFacei,
134  const label edgeI
135  );
136 
137 
138  // Constructors
139 
140  //- Construct from components
141  regionSide
142  (
143  const primitiveMesh& mesh,
144  const labelHashSet& region,
145  const labelHashSet& fenceEdges, // labels of fence edges
146  const label startCell,
147  const label startFace
148  );
149 
150 
151  // Member Functions
152 
153  // Access
154 
155  const labelHashSet& sideOwner() const
156  {
157  return sideOwner_;
158  }
159 
160  const labelHashSet& insidePointFaces() const
161  {
162  return insidePointFaces_;
163  }
164 
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace Foam
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 #endif
175 
176 // ************************************************************************* //
Foam::regionSide::regionSide
regionSide(const primitiveMesh &mesh, const labelHashSet &region, const labelHashSet &fenceEdges, const label startCell, const label startFace)
Construct from components.
Foam::regionSide::sideOwner
const labelHashSet & sideOwner() const
Definition: regionSide.H:154
typeInfo.H
Foam::regionSide::ClassName
ClassName("regionSide")
Runtime type information.
Foam::HashSet< label, Hash< label > >
Foam::regionSide
Determines the 'side' for every face and connected to a singly-connected (through edges) region of fa...
Definition: regionSide.H:63
HashSet.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::regionSide::otherFace
static label otherFace(const primitiveMesh &mesh, const label celli, const label excludeFacei, const label edgeI)
Step across edge onto other face on cell.
Foam::regionSide::insidePointFaces
const labelHashSet & insidePointFaces() const
Definition: regionSide.H:159
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78