initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / src / dynamicMesh / polyTopoChange / polyTopoChange / localPointRegion.H
blob95d05d3aedf29c775c65c9e68583fe06a86d35ce
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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
25 Class
26     Foam::localPointRegion
28 Description
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.
38 SourceFiles
39     localPointRegion.C
41 \*---------------------------------------------------------------------------*/
43 #ifndef localPointRegion_H
44 #define localPointRegion_H
46 #include "typeInfo.H"
47 #include "Map.H"
48 #include "labelList.H"
49 #include "labelHashSet.H"
50 #include "faceList.H"
51 #include "boolList.H"
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 namespace Foam
58 // Forward declaration of classes
59 class primitiveMesh;
60 class polyMesh;
61 class face;
62 class mapPolyMesh;
64 /*---------------------------------------------------------------------------*\
65                            Class localPointRegion Declaration
66 \*---------------------------------------------------------------------------*/
68 class localPointRegion
70     // Private data
72         ////- (global) number of regions
73         //label nRegions_;
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
93         (
94             const polyMesh& mesh,
95             const boolList& candidatePoint,
96             const Map<label>& candidateFace,
97             faceList& minRegion
98         );
100         //- Do all: calculate points that need to be duplicated.
101         void calcPointRegions
102         (
103             const polyMesh& mesh,
104             boolList& candidatePoint
105         );
108         //- Check if two faces are equal. If forward = false checks f1 in
109         //  reverse order.
110         static bool isDuplicate
111         (
112             const face& f0,
113             const face& f1,
114             const bool forward
115         );
117 public:
119     //- Runtime type information
120     ClassName("localPointRegion");
123     // Constructors
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
130         localPointRegion
131         (
132             const polyMesh& mesh,
133             const labelList& candidatePoints
134         );
137     // Member Functions
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
148             (
149                 const primitiveMesh&,
150                 const labelList&
151             );
154         // Access
156             ////- Global number of regions. TBD. regions not compacted yet.
157             //label nRegions() const
158             //{
159             //    return nRegions_;
160             //}
162             //- Per point that is to duplicated to the local index
163             const Map<label>& meshPointMap() const
164             {
165                 return meshPointMap_;
166             }
168             //- Per local point the regions it is in
169             const labelListList& pointRegions() const
170             {
171                 return pointRegions_;
172             }
174             //- Per face that uses a duplicated point the local index
175             const Map<label>& meshFaceMap() const
176             {
177                 return meshFaceMap_;
178             }
180             //- Per face the region of its points
181             const faceList& faceRegions() const
182             {
183                 return faceRegions_;
184             }
187         // Edit
189             //- Force recalculation of locally stored data on topological change
190             void updateMesh(const mapPolyMesh&);
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
196 } // End namespace Foam
198 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
200 #endif
202 // ************************************************************************* //