FreeFOAM The Cross-Platform CFD Toolkit
regionSplit.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::regionSplit
26 
27 Description
28  This class separates the mesh into distinct unconnected regions,
29  each of which is then given a label.
30 
31 SourceFiles
32  regionSplit.C
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #ifndef regionSplit_H
37 #define regionSplit_H
38 
39 #include <OpenFOAM/polyMesh.H>
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class regionSplit Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 :
53  public labelList
54 {
55  // Private data
56 
57  //- Reference to mesh
58  const polyMesh& mesh_;
59 
60  //- Number of regions
61  label nRegions_;
62 
63 
64  // Private Member Functions
65 
66  //- Transfer faceRegion data from one face to the other (or vice versa)
67  void transferCoupledFaceRegion
68  (
69  const label faceI,
70  const label otherFaceI,
71 
72  labelList& faceRegion,
73  DynamicList<label>& newChangedFaces
74  ) const;
75 
76  //- Given a seed cell label, fill cellRegion/faceRegion with markValue
77  // for contiguous region around it
78  void fillSeedMask
79  (
80  const List<labelPair>& explicitConnections,
81  labelList& cellRegion,
82  labelList& faceRegion,
83  const label seedCellID,
84  const label markValue
85  ) const;
86 
87  //- Calculate region split. Return number of regions.
88  label calcRegionSplit
89  (
90  const boolList& blockedFace,
91  const List<labelPair>& explicitConnections,
92  labelList& cellRegion
93  ) const;
94 
95 public:
96 
97  //- Runtime type information
98  ClassName("regionSplit");
99 
100  // Constructors
101 
102  //- Construct from mesh
103  regionSplit(const polyMesh&);
104 
105  //- Construct from mesh and whether face is blocked
106  // NOTE: blockedFace has to be consistent across coupled faces!
107  regionSplit(const polyMesh&, const boolList& blockedFace);
108 
109  //- Construct from mesh and whether face is blocked. Additional explicit
110  // connections between normal boundary faces.
111  // NOTE: blockedFace has to be consistent across coupled faces!
113  (
114  const polyMesh&,
115  const boolList& blockedFace,
116  const List<labelPair>&
117  );
118 
119  // Member Functions
120 
121  //- Return number of regions
122  label nRegions() const
123  {
124  return nRegions_;
125  }
126 };
127 
128 
129 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
130 
131 } // End namespace Foam
132 
133 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
134 
135 #endif
136 
137 // ************************ vim: set sw=4 sts=4 et: ************************ //