OpenFOAM logo
The Open Source CFD Toolbox
  Programmer’s C++ Doxygen 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-2007 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     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 
00068         //- Given a seed cell label, fill cellRegion/faceRegion with markValue
00069         //  for contiguous region around it
00070         void fillSeedMask
00071         (
00072             labelList& cellRegion,
00073             labelList& faceRegion,
00074             const label seedCellID,
00075             const label markValue
00076         ) const;
00077 
00078         //- Calculate region split. Return number of regions.
00079         label calcRegionSplit
00080         (
00081             const boolList& blockedFace,
00082             labelList& cellRegion
00083         ) const;
00084 
00085 public:
00086 
00087     //- Runtime type information
00088     ClassName("regionSplit");
00089 
00090     // Constructors
00091 
00092         //- Construct from mesh
00093         regionSplit(const polyMesh&);
00094 
00095         //- Construct from mesh and whether face is blocked
00096         //  NOTE: blockedFace has to be consistent across coupled faces!
00097         regionSplit(const polyMesh&, const boolList& blockedFace);
00098 
00099     // Member Functions
00100 
00101         //- Return number of regions
00102         label nRegions() const
00103         {
00104             return nRegions_;
00105         }
00106 };
00107 
00108 
00109 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00110 
00111 } // End namespace Foam
00112 
00113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00114 
00115 #endif
00116 
00117 // ************************************************************************* //
Copyright © 2000-2007 OpenCFD Ltd