FreeFOAM The Cross-Platform CFD Toolkit
localPointRegion.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::localPointRegion
26 
27 Description
28  Takes mesh with 'baffles' (= boundary faces sharing points).
29  Determines for selected points on boundary faces the 'point region' it is
30  connected to. Each region can be visited by a cell-face-cell walk.
31  Used in duplicating points after splitting baffles.
32 
33  Regions are not consecutive per processor. They will be -1..nRegions_.
34 
35  Note: coupled boundaries (cyclics, parallel) not fully tested.
36 
37 SourceFiles
38  localPointRegion.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef localPointRegion_H
43 #define localPointRegion_H
44 
45 #include <OpenFOAM/typeInfo.H>
46 #include <OpenFOAM/Map.H>
47 #include <OpenFOAM/labelList.H>
48 #include <OpenFOAM/HashSet.H>
49 #include <OpenFOAM/faceList.H>
50 #include <OpenFOAM/boolList.H>
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 
57 // Forward declaration of classes
58 class primitiveMesh;
59 class polyMesh;
60 class face;
61 class mapPolyMesh;
62 
63 /*---------------------------------------------------------------------------*\
64  Class localPointRegion Declaration
65 \*---------------------------------------------------------------------------*/
66 
68 {
69  // Private data
70 
72  //label nRegions_;
73 
74  //- Per point that is to duplicated to the local index
75  Map<label> meshPointMap_;
76 
77  //- Per local point the regions it is in
78  labelListList pointRegions_;
79 
80  //- Per face that uses a duplicated point the local index
81  Map<label> meshFaceMap_;
82 
83  //- Per face the region of its points
84  faceList faceRegions_;
85 
86 
87  // Private Member Functions
88 
89  //- Given minimum cell the points on a face are connected to
90  // determine the points to be duplicated.
91  void countPointRegions
92  (
93  const polyMesh& mesh,
94  const boolList& candidatePoint,
95  const Map<label>& candidateFace,
96  faceList& minRegion
97  );
98 
99  //- Do all: calculate points that need to be duplicated.
100  void calcPointRegions
101  (
102  const polyMesh& mesh,
103  boolList& candidatePoint
104  );
105 
106 
107  //- Check if two faces are equal. If forward = false checks f1 in
108  // reverse order.
109  static bool isDuplicate
110  (
111  const face& f0,
112  const face& f1,
113  const bool forward
114  );
115 
116 public:
117 
118  //- Runtime type information
119  ClassName("localPointRegion");
120 
121 
122  // Constructors
123 
124  //- Construct from mesh. Assumes all non-coupled boundary points
125  // are candidates for duplication
126  localPointRegion(const polyMesh& mesh);
127 
128  //- Construct from mesh and candidate points for duplication
130  (
131  const polyMesh& mesh,
132  const labelList& candidatePoints
133  );
134 
135 
136  // Member Functions
137 
138  // Static Member Functions
139 
140  //- Helper routine to find baffles (two boundary faces using the
141  // same points but in reverse order)
142  // Gets list of (boundary!) faces to check. Returns labelList
143  // of same size as the input list
144  // with -1 or index of other face in the input list.
145  // Does not handle duplicate faces on both sides of processor patch
147  (
148  const primitiveMesh&,
149  const labelList&
150  );
151 
152 
153  // Access
154 
156  //label nRegions() const
157  //{
158  // return nRegions_;
159  //}
160 
161  //- Per point that is to be duplicated the local index
162  const Map<label>& meshPointMap() const
163  {
164  return meshPointMap_;
165  }
166 
167  //- Per local point the regions it is in
169  {
170  return pointRegions_;
171  }
172 
173  //- Per face that uses a duplicated point the local index
174  const Map<label>& meshFaceMap() const
175  {
176  return meshFaceMap_;
177  }
178 
179  //- Per face the region of its points
180  const faceList& faceRegions() const
181  {
182  return faceRegions_;
183  }
184 
185 
186  // Edit
187 
188  //- Force recalculation of locally stored data on topological change
189  void updateMesh(const mapPolyMesh&);
190 };
191 
192 
193 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194 
195 } // End namespace Foam
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 #endif
200 
201 // ************************ vim: set sw=4 sts=4 et: ************************ //