1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2008 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 option) any later version.
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
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 Foam::localPointRegion
29 Takes mesh with 'baffles' (= boundary faces sharing points).
30 Determines for selected points on boundary faces the 'point region' it is
31 connected to. Each region can be visited by a cell-face-cell walk.
32 Used in duplicating points after splitting baffles.
34 Regions are not consecutive per processor. They will be -1..nRegions_.
36 Note: coupled boundaries (cyclics, parallel) not fully tested.
41 \*---------------------------------------------------------------------------*/
43 #ifndef localPointRegion_H
44 #define localPointRegion_H
48 #include "labelList.H"
49 #include "labelHashSet.H"
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 // Forward declaration of classes
64 /*---------------------------------------------------------------------------*\
65 Class localPointRegion Declaration
66 \*---------------------------------------------------------------------------*/
68 class localPointRegion
72 ////- (global) number of regions
75 //- Per point that is to duplicated to the local index
76 Map<label> meshPointMap_;
78 //- Per local point the regions it is in
79 labelListList pointRegions_;
81 //- Per face that uses a duplicated point the local index
82 Map<label> meshFaceMap_;
84 //- Per face the region of its points
85 faceList faceRegions_;
88 // Private Member Functions
90 //- Given minimum cell the points on a face are connected to
91 // determine the points to be duplicated.
92 void countPointRegions
95 const boolList& candidatePoint,
96 const Map<label>& candidateFace,
100 //- Do all: calculate points that need to be duplicated.
101 void calcPointRegions
103 const polyMesh& mesh,
104 boolList& candidatePoint
108 //- Check if two faces are equal. If forward = false checks f1 in
110 static bool isDuplicate
119 //- Runtime type information
120 ClassName("localPointRegion");
125 //- Construct from mesh. Assumes all non-coupled boundary points
126 // are candidates for duplication
127 localPointRegion(const polyMesh& mesh);
129 //- Construct from mesh and candidate points for duplication
132 const polyMesh& mesh,
133 const labelList& candidatePoints
139 // Static Member Functions
141 //- Helper routine to find baffles (two boundary faces using the
142 // same points but in reverse order)
143 // Gets list of (boundary!) faces to check. Returns labelList
144 // of same size as the input list
145 // with -1 or index of other face in the input list.
146 // Does not handle duplicate faces on both sides of processor patch
147 static labelList findDuplicateFaces
149 const primitiveMesh&,
156 ////- Global number of regions. TBD. regions not compacted yet.
157 //label nRegions() const
162 //- Per point that is to duplicated to the local index
163 const Map<label>& meshPointMap() const
165 return meshPointMap_;
168 //- Per local point the regions it is in
169 const labelListList& pointRegions() const
171 return pointRegions_;
174 //- Per face that uses a duplicated point the local index
175 const Map<label>& meshFaceMap() const
180 //- Per face the region of its points
181 const faceList& faceRegions() const
189 //- Force recalculation of locally stored data on topological change
190 void updateMesh(const mapPolyMesh&);
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 } // End namespace Foam
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 // ************************************************************************* //