FreeFOAM The Cross-Platform CFD Toolkit
Hosted by SourceForge:
Get FreeFOAM at SourceForge.net.
            Fast, secure and Free Open Source software downloads

regionSide.H

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software: you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 Class
00025     Foam::regionSide
00026 
00027 Description
00028     Determines the 'side' for every face and connected to a 
00029     singly-connected (through edges) region of faces. Gets set of faces and
00030     a list of mesh edges ('fenceEdges') which should not be crossed.
00031     Used in splitting a mesh region.
00032 
00033     Determines:
00034     - For every face on the surface: whether the owner was visited
00035       from starting face.
00036     - List of faces using an internal point of the region visitable by
00037       edge-face-edge walking from the correct side of the region.
00038 
00039 SourceFiles
00040     regionSide.C
00041 
00042 \*---------------------------------------------------------------------------*/
00043 
00044 #ifndef regionSide_H
00045 #define regionSide_H
00046 
00047 #include <OpenFOAM/HashSet.H>
00048 #include <OpenFOAM/typeInfo.H>
00049 
00050 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00051 
00052 namespace Foam
00053 {
00054 
00055 // Forward declaration of classes
00056 class primitiveMesh;
00057 
00058 /*---------------------------------------------------------------------------*\
00059                            Class regionSide Declaration
00060 \*---------------------------------------------------------------------------*/
00061 
00062 class regionSide
00063 {
00064     // Private data
00065 
00066         //- For every face on region tells whether the owner is on the
00067         //  'regionside'.
00068         labelHashSet sideOwner_;
00069 
00070         //- Contains the faces using an internal point and visited face
00071         labelHashSet insidePointFaces_;
00072 
00073 
00074     // Private Member Functions
00075 
00076         //- Step across point to other edge on face
00077         static label otherEdge
00078         (
00079             const primitiveMesh& mesh,
00080             const label faceI,
00081             const label edgeI,
00082             const label pointI
00083         );
00084 
00085         //- From faceI, side cellI, cross to other faces/cells by
00086         //  face-cell walking and store visited faces and update sideOwner_.
00087         void visitConnectedFaces
00088         (
00089             const primitiveMesh& mesh,
00090             const labelHashSet& region,
00091             const labelHashSet& fenceEdges,
00092             const label cellI,
00093             const label faceI,
00094             labelHashSet& visitedFace
00095         );
00096 
00097         //- From edge on face connected to point on region (regionPointI) cross
00098         //  to all other edges using this point by walking across faces
00099         //  Does not cross regionEdges so stays on one side of region
00100         void walkPointConnectedFaces
00101         (
00102             const primitiveMesh& mesh,
00103             const labelHashSet& regionEdges,
00104             const label regionPointI,
00105             const label startFaceI,
00106             const label startEdgeI,
00107             labelHashSet& visitedEdges
00108         );
00109 
00110         //- Visits all internal points on region and marks edges reachable
00111         //  from sideOwner side (using walkPointConnectedFaces)
00112         void walkAllPointConnectedFaces
00113         (
00114             const primitiveMesh& mesh,
00115             const labelHashSet& regionFaces,
00116             const labelHashSet& fenceEdges
00117         );
00118 
00119 public:
00120 
00121     //- Runtime type information
00122     ClassName("regionSide");
00123 
00124     // Static Functions
00125 
00126         //- Step across edge onto other face on cell
00127         static label otherFace
00128         (
00129             const primitiveMesh& mesh,
00130             const label cellI,
00131             const label excludeFaceI,
00132             const label edgeI
00133         );
00134 
00135 
00136     // Constructors
00137 
00138         //- Construct from components
00139         regionSide
00140         (
00141             const primitiveMesh& mesh,
00142             const labelHashSet& region,
00143             const labelHashSet& fenceEdges,   // labels of fence edges
00144             const label startCell,
00145             const label startFace
00146         );
00147 
00148 
00149     // Member Functions
00150 
00151         // Access
00152 
00153             const labelHashSet& sideOwner() const
00154             {
00155                 return sideOwner_;
00156             }
00157 
00158             const labelHashSet& insidePointFaces() const
00159             {
00160                 return insidePointFaces_;
00161             }
00162 
00163 };
00164 
00165 
00166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00167 
00168 } // End namespace Foam
00169 
00170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00171 
00172 #endif
00173 
00174 // ************************ vim: set sw=4 sts=4 et: ************************ //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines