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) 2011-2014 OpenFOAM Foundation
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 "typeInfo.H"
46 #include "Map.H"
47 #include "labelList.H"
48 #include "HashSet.H"
49 #include "faceList.H"
50 #include "boolList.H"
51 #include "labelPair.H"
52 
53 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54 
55 namespace Foam
56 {
57 
58 // Forward declaration of classes
59 class primitiveMesh;
60 class polyMesh;
61 class face;
62 class mapPolyMesh;
63 
64 /*---------------------------------------------------------------------------*\
65  Class localPointRegion Declaration
66 \*---------------------------------------------------------------------------*/
67 
68 class localPointRegion
69 {
70  // Private data
71 
73  //label nRegions_;
74 
75  //- Per point that is to duplicated to the local index
77 
78  //- Per local point the regions it is in
80 
81  //- Per face that uses a duplicated point the local index
83 
84  //- Per face the region of its points
86 
87 
88  // Private Member Functions
89 
90  //- Given minimum cell the points on a face are connected to
91  // determine the points to be duplicated.
93  (
94  const polyMesh& mesh,
95  const boolList& candidatePoint,
96  const Map<label>& candidateFace,
97  faceList& minRegion
98  );
99 
100  //- Do all: calculate points that need to be duplicated.
101  void calcPointRegions
102  (
103  const polyMesh& mesh,
104  const labelPairList& baffles,
105  boolList& candidatePoint
106  );
107 
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  );
116 
117 public:
118 
119  //- Runtime type information
120  ClassName("localPointRegion");
121 
122 
123  // Constructors
124 
125  //- Construct from mesh. Assumes all non-coupled boundary points
126  // are candidates for duplication
128 
129  //- Construct from mesh and candidate points for duplication
131  (
132  const polyMesh& mesh,
133  const labelList& candidatePoints
134  );
135 
136  //- Construct from mesh and candidate points for duplication
138  (
139  const polyMesh& mesh,
140  const labelPairList& baffles,
141  const labelList& candidatePoints
142  );
143 
144 
145  // Member Functions
146 
147  // Static Member Functions
148 
149  //- Helper routine to find baffles (two boundary faces using the
150  // same points but in reverse order)
151  // Gets list of (boundary!) faces to check. Returns labelList
152  // of same size as the input list
153  // with -1 or index of other face in the input list.
154  // Does not handle duplicate faces on both sides of processor patch
156  (
157  const primitiveMesh&,
158  const labelList&
159  );
160 
161  //- Helper routine to find all baffles (two boundary faces
162  // using the same points but in reverse order)
164 
165  // Access
166 
168  //label nRegions() const
169  //{
170  // return nRegions_;
171  //}
172 
173  //- Per point that is to be duplicated the local index
174  const Map<label>& meshPointMap() const
175  {
176  return meshPointMap_;
177  }
178 
179  //- Per local point the regions it is in
180  const labelListList& pointRegions() const
181  {
182  return pointRegions_;
183  }
184 
185  //- Per face that uses a duplicated point the local index
186  const Map<label>& meshFaceMap() const
187  {
188  return meshFaceMap_;
189  }
190 
191  //- Per face the region of its points
192  const faceList& faceRegions() const
193  {
194  return faceRegions_;
195  }
196 
197 
198  // Edit
199 
200  //- Force recalculation of locally stored data on topological change
201  void updateMesh(const mapPolyMesh&);
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************************************************************* //
Foam::localPointRegion::isDuplicate
static bool isDuplicate(const face &f0, const face &f1, const bool forward)
Check if two faces are equal. If forward = false checks f1 in.
Definition: localPointRegion.C:67
Foam::localPointRegion::meshPointMap_
Map< label > meshPointMap_
Per point that is to duplicated to the local index.
Definition: localPointRegion.H:75
Foam::localPointRegion
Takes mesh with 'baffles' (= boundary faces sharing points). Determines for selected points on bounda...
Definition: localPointRegion.H:67
boolList.H
typeInfo.H
Foam::localPointRegion::pointRegions_
labelListList pointRegions_
Per local point the regions it is in.
Definition: localPointRegion.H:78
Foam::Map< label >
Foam::localPointRegion::calcPointRegions
void calcPointRegions(const polyMesh &mesh, const labelPairList &baffles, boolList &candidatePoint)
Do all: calculate points that need to be duplicated.
Definition: localPointRegion.C:248
faceList.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
Map.H
Foam::localPointRegion::localPointRegion
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
Definition: localPointRegion.C:459
labelList.H
Foam::localPointRegion::countPointRegions
void countPointRegions(const polyMesh &mesh, const boolList &candidatePoint, const Map< label > &candidateFace, faceList &minRegion)
Given minimum cell the points on a face are connected to.
Definition: localPointRegion.C:107
f1
scalar f1
Definition: createFields.H:28
Foam::localPointRegion::meshFaceMap_
Map< label > meshFaceMap_
Per face that uses a duplicated point the local index.
Definition: localPointRegion.H:81
HashSet.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::localPointRegion::findDuplicateFaces
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
Definition: localPointRegion.C:541
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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:179
Foam::localPointRegion::updateMesh
void updateMesh(const mapPolyMesh &)
Force recalculation of locally stored data on topological change.
Definition: localPointRegion.C:680
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Foam::face
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Foam::localPointRegion::meshPointMap
const Map< label > & meshPointMap() const
Per point that is to be duplicated the local index.
Definition: localPointRegion.H:173
Foam::localPointRegion::meshFaceMap
const Map< label > & meshFaceMap() const
Per face that uses a duplicated point the local index.
Definition: localPointRegion.H:185
Foam::localPointRegion::faceRegions_
faceList faceRegions_
Per face the region of its points.
Definition: localPointRegion.H:84
Foam::localPointRegion::findDuplicateFacePairs
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Definition: localPointRegion.C:620
labelPair.H
Foam::primitiveMesh
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:79
Foam::localPointRegion::faceRegions
const faceList & faceRegions() const
Per face the region of its points.
Definition: localPointRegion.H:191