OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

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-2009 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 the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     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, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Class
00026     Foam::regionSide
00027 
00028 Description
00029     Determines the 'side' for every face and connected to a 
00030     singly-connected (through edges) region of faces. Gets set of faces and
00031     a list of mesh edges ('fenceEdges') which should not be crossed.
00032     Used in splitting a mesh region.
00033 
00034     Determines:
00035     - For every face on the surface: whether the owner was visited
00036       from starting face.
00037     - List of faces using an internal point of the region visitable by
00038       edge-face-edge walking from the correct side of the region.
00039 
00040 SourceFiles
00041     regionSide.C
00042 
00043 \*---------------------------------------------------------------------------*/
00044 
00045 #ifndef regionSide_H
00046 #define regionSide_H
00047 
00048 #include "HashSet.H"
00049 #include "typeInfo.H"
00050 
00051 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00052 
00053 namespace Foam
00054 {
00055 
00056 // Forward declaration of classes
00057 class primitiveMesh;
00058 
00059 /*---------------------------------------------------------------------------*\
00060                            Class regionSide Declaration
00061 \*---------------------------------------------------------------------------*/
00062 
00063 class regionSide
00064 {
00065     // Private data
00066 
00067         //- For every face on region tells whether the owner is on the
00068         //  'regionside'.
00069         labelHashSet sideOwner_;
00070 
00071         //- Contains the faces using an internal point and visited face
00072         labelHashSet insidePointFaces_;
00073 
00074 
00075     // Private Member Functions
00076 
00077         //- Step across point to other edge on face
00078         static label otherEdge
00079         (
00080             const primitiveMesh& mesh,
00081             const label faceI,
00082             const label edgeI,
00083             const label pointI
00084         );
00085 
00086         //- From faceI, side cellI, cross to other faces/cells by
00087         //  face-cell walking and store visited faces and update sideOwner_.
00088         void visitConnectedFaces
00089         (
00090             const primitiveMesh& mesh,
00091             const labelHashSet& region,
00092             const labelHashSet& fenceEdges,
00093             const label cellI,
00094             const label faceI,
00095             labelHashSet& visitedFace
00096         );
00097 
00098         //- From edge on face connected to point on region (regionPointI) cross
00099         //  to all other edges using this point by walking across faces
00100         //  Does not cross regionEdges so stays on one side of region
00101         void walkPointConnectedFaces
00102         (
00103             const primitiveMesh& mesh,
00104             const labelHashSet& regionEdges,
00105             const label regionPointI,
00106             const label startFaceI,
00107             const label startEdgeI,
00108             labelHashSet& visitedEdges
00109         );
00110 
00111         //- Visits all internal points on region and marks edges reachable
00112         //  from sideOwner side (using walkPointConnectedFaces)
00113         void walkAllPointConnectedFaces
00114         (
00115             const primitiveMesh& mesh,
00116             const labelHashSet& regionFaces,
00117             const labelHashSet& fenceEdges
00118         );
00119 
00120 public:
00121 
00122     //- Runtime type information
00123     ClassName("regionSide");
00124 
00125     // Static Functions
00126 
00127         //- Step across edge onto other face on cell
00128         static label otherFace
00129         (
00130             const primitiveMesh& mesh,
00131             const label cellI,
00132             const label excludeFaceI,
00133             const label edgeI
00134         );
00135 
00136 
00137     // Constructors
00138 
00139         //- Construct from components
00140         regionSide
00141         (
00142             const primitiveMesh& mesh,
00143             const labelHashSet& region,
00144             const labelHashSet& fenceEdges,   // labels of fence edges
00145             const label startCell,
00146             const label startFace
00147         );
00148 
00149 
00150     // Member Functions
00151 
00152         // Access
00153 
00154             const labelHashSet& sideOwner() const
00155             {
00156                 return sideOwner_;
00157             }
00158 
00159             const labelHashSet& insidePointFaces() const
00160             {
00161                 return insidePointFaces_;
00162             }
00163 
00164 };
00165 
00166 
00167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00168 
00169 } // End namespace Foam
00170 
00171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00172 
00173 #endif
00174 
00175 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd