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

regionSplit.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::regionSplit
00027 
00028 Description
00029     This class separates the mesh into distinct unconnected regions,
00030     each of which is then given a label.
00031 
00032 SourceFiles
00033     regionSplit.C
00034 
00035 \*---------------------------------------------------------------------------*/
00036 
00037 #ifndef regionSplit_H
00038 #define regionSplit_H
00039 
00040 #include "polyMesh.H"
00041 #include "demandDrivenData.H"
00042 
00043 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00044 
00045 namespace Foam
00046 {
00047 
00048 /*---------------------------------------------------------------------------*\
00049                            Class regionSplit Declaration
00050 \*---------------------------------------------------------------------------*/
00051 
00052 class regionSplit
00053 :
00054     public labelList
00055 {
00056     // Private data
00057 
00058         //- Reference to mesh
00059         const polyMesh& mesh_;
00060 
00061         //- Number of regions
00062         label nRegions_;
00063 
00064 
00065     // Private Member Functions
00066 
00067         //- Transfer faceRegion data from one face to the other (or vice versa)
00068         void transferCoupledFaceRegion
00069         (
00070             const label faceI,
00071             const label otherFaceI,
00072 
00073             labelList& faceRegion,
00074             DynamicList<label>& newChangedFaces
00075         ) const;
00076 
00077         //- Given a seed cell label, fill cellRegion/faceRegion with markValue
00078         //  for contiguous region around it
00079         void fillSeedMask
00080         (
00081             const List<labelPair>& explicitConnections,
00082             labelList& cellRegion,
00083             labelList& faceRegion,
00084             const label seedCellID,
00085             const label markValue
00086         ) const;
00087 
00088         //- Calculate region split. Return number of regions.
00089         label calcRegionSplit
00090         (
00091             const boolList& blockedFace,
00092             const List<labelPair>& explicitConnections,
00093             labelList& cellRegion
00094         ) const;
00095 
00096 public:
00097 
00098     //- Runtime type information
00099     ClassName("regionSplit");
00100 
00101     // Constructors
00102 
00103         //- Construct from mesh
00104         regionSplit(const polyMesh&);
00105 
00106         //- Construct from mesh and whether face is blocked
00107         //  NOTE: blockedFace has to be consistent across coupled faces!
00108         regionSplit(const polyMesh&, const boolList& blockedFace);
00109 
00110         //- Construct from mesh and whether face is blocked. Additional explicit
00111         //  connections between normal boundary faces.
00112         //  NOTE: blockedFace has to be consistent across coupled faces!
00113         regionSplit
00114         (
00115             const polyMesh&,
00116             const boolList& blockedFace,
00117             const List<labelPair>&
00118         );
00119 
00120     // Member Functions
00121 
00122         //- Return number of regions
00123         label nRegions() const
00124         {
00125             return nRegions_;
00126         }
00127 };
00128 
00129 
00130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00131 
00132 } // End namespace Foam
00133 
00134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00135 
00136 #endif
00137 
00138 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd