ENH: work with processors with 0 cells. polyMesh::directions, checkMesh.
[OpenFOAM-1.6.x.git] / applications / utilities / mesh / manipulation / splitMesh / regionSide.H
blob45f4516672676e22b34c064a443e3a026fbd9d92
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::regionSide
28 Description
29     Determines the 'side' for every face and connected to a 
30     singly-connected (through edges) region of faces. Gets set of faces and
31     a list of mesh edges ('fenceEdges') which should not be crossed.
32     Used in splitting a mesh region.
34     Determines:
35     - For every face on the surface: whether the owner was visited
36       from starting face.
37     - List of faces using an internal point of the region visitable by
38       edge-face-edge walking from the correct side of the region.
40 SourceFiles
41     regionSide.C
43 \*---------------------------------------------------------------------------*/
45 #ifndef regionSide_H
46 #define regionSide_H
48 #include "HashSet.H"
49 #include "typeInfo.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 namespace Foam
56 // Forward declaration of classes
57 class primitiveMesh;
59 /*---------------------------------------------------------------------------*\
60                            Class regionSide Declaration
61 \*---------------------------------------------------------------------------*/
63 class regionSide
65     // Private data
67         //- For every face on region tells whether the owner is on the
68         //  'regionside'.
69         labelHashSet sideOwner_;
71         //- Contains the faces using an internal point and visited face
72         labelHashSet insidePointFaces_;
75     // Private Member Functions
77         //- Step across point to other edge on face
78         static label otherEdge
79         (
80             const primitiveMesh& mesh,
81             const label faceI,
82             const label edgeI,
83             const label pointI
84         );
86         //- From faceI, side cellI, cross to other faces/cells by
87         //  face-cell walking and store visited faces and update sideOwner_.
88         void visitConnectedFaces
89         (
90             const primitiveMesh& mesh,
91             const labelHashSet& region,
92             const labelHashSet& fenceEdges,
93             const label cellI,
94             const label faceI,
95             labelHashSet& visitedFace
96         );
98         //- From edge on face connected to point on region (regionPointI) cross
99         //  to all other edges using this point by walking across faces
100         //  Does not cross regionEdges so stays on one side of region
101         void walkPointConnectedFaces
102         (
103             const primitiveMesh& mesh,
104             const labelHashSet& regionEdges,
105             const label regionPointI,
106             const label startFaceI,
107             const label startEdgeI,
108             labelHashSet& visitedEdges
109         );
111         //- Visits all internal points on region and marks edges reachable
112         //  from sideOwner side (using walkPointConnectedFaces)
113         void walkAllPointConnectedFaces
114         (
115             const primitiveMesh& mesh,
116             const labelHashSet& regionFaces,
117             const labelHashSet& fenceEdges
118         );
120 public:
122     //- Runtime type information
123     ClassName("regionSide");
125     // Static Functions
127         //- Step across edge onto other face on cell
128         static label otherFace
129         (
130             const primitiveMesh& mesh,
131             const label cellI,
132             const label excludeFaceI,
133             const label edgeI
134         );
137     // Constructors
139         //- Construct from components
140         regionSide
141         (
142             const primitiveMesh& mesh,
143             const labelHashSet& region,
144             const labelHashSet& fenceEdges,   // labels of fence edges
145             const label startCell,
146             const label startFace
147         );
150     // Member Functions
152         // Access
154             const labelHashSet& sideOwner() const
155             {
156                 return sideOwner_;
157             }
159             const labelHashSet& insidePointFaces() const
160             {
161                 return insidePointFaces_;
162             }
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 } // End namespace Foam
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 #endif
175 // ************************************************************************* //