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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2014 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::localPointRegion
28 
29 Description
30  Takes mesh with 'baffles' (= boundary faces sharing points).
31  Determines for selected points on boundary faces the 'point region' it is
32  connected to. Each region can be visited by a cell-face-cell walk.
33  Used in duplicating points after splitting baffles.
34 
35  Regions are not consecutive per processor. They will be -1..nRegions_.
36 
37  Note: coupled boundaries (cyclics, parallel) not fully tested.
38 
39 SourceFiles
40  localPointRegion.C
41 
42 \*---------------------------------------------------------------------------*/
43 
44 #ifndef localPointRegion_H
45 #define localPointRegion_H
46 
47 #include "typeInfo.H"
48 #include "Map.H"
49 #include "labelList.H"
50 #include "HashSet.H"
51 #include "faceList.H"
52 #include "boolList.H"
53 #include "labelPair.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 
60 // Forward declaration of classes
61 class primitiveMesh;
62 class polyMesh;
63 class face;
64 class mapPolyMesh;
65 
66 /*---------------------------------------------------------------------------*\
67  Class localPointRegion Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class localPointRegion
71 {
72  // Private data
73 
75  //label nRegions_;
76 
77  //- Per point that is to duplicated to the local index
78  Map<label> meshPointMap_;
79 
80  //- Per local point the regions it is in
81  labelListList pointRegions_;
82 
83  //- Per face that uses a duplicated point the local index
84  Map<label> meshFaceMap_;
85 
86  //- Per face the region of its points
87  faceList faceRegions_;
88 
89 
90  // Private Member Functions
91 
92  //- Given minimum cell the points on a face are connected to
93  // determine the points to be duplicated.
94  void countPointRegions
95  (
96  const polyMesh& mesh,
97  const boolList& candidatePoint,
98  const Map<label>& candidateFace,
99  faceList& minRegion
100  );
101 
102  //- Do all: calculate points that need to be duplicated.
103  void calcPointRegions
104  (
105  const polyMesh& mesh,
106  const labelPairList& baffles,
107  boolList& candidatePoint
108  );
109 
110  //- Check if two faces are equal. If forward = false checks f1 in
111  // reverse order.
112  static bool isDuplicate
113  (
114  const face& f0,
115  const face& f1,
116  const bool forward
117  );
118 
119 public:
120 
121  //- Runtime type information
122  ClassName("localPointRegion");
123 
124 
125  // Constructors
126 
127  //- Construct from mesh. Assumes all non-coupled boundary points
128  // are candidates for duplication
130 
131  //- Construct from mesh and candidate points for duplication
133  (
134  const polyMesh& mesh,
135  const labelList& candidatePoints
136  );
137 
138  //- Construct from mesh and candidate points for duplication
140  (
141  const polyMesh& mesh,
142  const labelPairList& baffles,
143  const labelList& candidatePoints
144  );
145 
146 
147  // Member Functions
148 
149  // Static Member Functions
150 
151  //- Helper routine to find baffles (two boundary faces using the
152  // same points but in reverse order)
153  // Gets list of (boundary!) faces to check. Returns labelList
154  // of same size as the input list
155  // with -1 or index of other face in the input list.
156  // Does not handle duplicate faces on both sides of processor patch
158  (
159  const primitiveMesh&,
160  const labelList&
161  );
162 
163  //- Helper routine to find all baffles (two boundary faces
164  // using the same points but in reverse order)
166 
167  // Access
168 
170  //label nRegions() const
171  //{
172  // return nRegions_;
173  //}
174 
175  //- Per point that is to be duplicated the local index
176  const Map<label>& meshPointMap() const
177  {
178  return meshPointMap_;
179  }
180 
181  //- Per local point the regions it is in
182  const labelListList& pointRegions() const
183  {
184  return pointRegions_;
185  }
186 
187  //- Per face that uses a duplicated point the local index
188  const Map<label>& meshFaceMap() const
189  {
190  return meshFaceMap_;
191  }
192 
193  //- Per face (in local index) the region of its points
194  const faceList& faceRegions() const
195  {
196  return faceRegions_;
197  }
198 
199 
200  // Edit
201 
202  //- Force recalculation of locally stored data on topological change
203  void updateMesh(const mapPolyMesh&);
204 };
205 
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 } // End namespace Foam
210 
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
212 
213 #endif
214 
215 // ************************************************************************* //
Foam::localPointRegion
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
Definition: localPointRegion.H:69
boolList.H
typeInfo.H
Foam::Map< label >
faceList.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Map.H
Foam::localPointRegion::localPointRegion
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
Definition: localPointRegion.C:462
labelList.H
HashSet.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::localPointRegion::findDuplicateFaces
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
Definition: localPointRegion.C:544
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::localPointRegion::ClassName
ClassName("localPointRegion")
Runtime type information.
Foam::localPointRegion::pointRegions
const labelListList & pointRegions() const
Per local point the regions it is in.
Definition: localPointRegion.H:181
Foam::localPointRegion::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: localPointRegion.C:684
Foam::List< labelList >
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:72
Foam::localPointRegion::meshPointMap
const Map< label > & meshPointMap() const
Per point that is to be duplicated the local index.
Definition: localPointRegion.H:175
Foam::localPointRegion::meshFaceMap
const Map< label > & meshFaceMap() const
Per face that uses a duplicated point the local index.
Definition: localPointRegion.H:187
Foam::localPointRegion::findDuplicateFacePairs
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Definition: localPointRegion.C:625
labelPair.H
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:78
Foam::localPointRegion::faceRegions
const faceList & faceRegions() const
Per face (in local index) the region of its points.
Definition: localPointRegion.H:193