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

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