OpenFOAM logo
Open Source CFD Toolkit

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-2005 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 distint 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 // Class forward declarations
00049 class regionInfo;
00050 
00051 /*---------------------------------------------------------------------------*\
00052                            Class regionSplit Declaration
00053 \*---------------------------------------------------------------------------*/
00054 
00055 class regionSplit
00056 {
00057     // Private data
00058 
00059         //- Reference to mesh
00060         const polyMesh& mesh_;
00061 
00062         //- Number of regions
00063         mutable label nRegions_;
00064 
00065         //- Cell-to-region list
00066         mutable labelList*  cellToRegionPtr_;
00067 
00068 
00069     // Private Member Functions
00070 
00071         //- Disallow default bitwise copy construct
00072         regionSplit(const regionSplit&);
00073 
00074         //- Disallow default bitwise assignment
00075         void operator=(const regionSplit&);
00076 
00077 
00078         //- Calculate region split
00079         void calcRegionSplit() const;
00080 
00081         //- Given a seed cell label, fill mask with 1 for contiguous
00082         //  region around it
00083         void fillSeedMask
00084         (
00085             labelList& region,
00086             const label seedCellID,
00087             const label mark
00088         ) const;
00089 
00090 
00091 public:
00092 
00093     // Constructors
00094 
00095         //- Construct from mesh
00096         regionSplit(const polyMesh& m)
00097         :
00098             mesh_(m),
00099             nRegions_(-1),
00100             cellToRegionPtr_(NULL)
00101         {}
00102 
00103     // Destructor
00104 
00105         ~regionSplit()
00106         {
00107             deleteDemandDrivenData(cellToRegionPtr_);
00108         }
00109 
00110 
00111     // Member Functions
00112 
00113         //- Return number of regions
00114         label nRegions() const;
00115 
00116         //- Return region split
00117         const labelList& cellToRegion() const;
00118 
00119         //- Return mask covering contiguous cells from the given seed cell
00120         labelList seedMask(const label seedCellID) const;
00121 
00122 };
00123 
00124 
00125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00126 
00127 } // End namespace Foam
00128 
00129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00130 
00131 #endif
00132 
00133 // ************************************************************************* //
For further information go to www.openfoam.org