localPointRegion.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2022 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 polyTopoChangeMap;
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
76  Map<label> meshPointMap_;
77 
78  //- Per local point the regions it is in
79  labelListList pointRegions_;
80 
81  //- Per face that uses a duplicated point the local index
82  Map<label> meshFaceMap_;
83 
84  //- Per face the region of its points
85  faceList faceRegions_;
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.
92  void countPointRegions
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  boolList& candidatePoint
105  );
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
127  localPointRegion(const polyMesh& mesh);
128 
129  //- Construct from mesh and candidate points for duplication
131  (
132  const polyMesh& mesh,
133  const labelList& candidatePoints
134  );
135 
136 
137  // Member Functions
138 
139  // Static Member Functions
140 
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
148  (
149  const primitiveMesh&,
150  const labelList&
151  );
152 
153  //- Helper routine to find all baffles (two boundary faces
154  // using the same points but in reverse order)
156 
157  // Access
158 
160  // label nRegions() const
161  //{
162  // return nRegions_;
163  //}
164 
165  //- Per point that is to be duplicated the local index
166  const Map<label>& meshPointMap() const
167  {
168  return meshPointMap_;
169  }
170 
171  //- Per local point the regions it is in
172  const labelListList& pointRegions() const
173  {
174  return pointRegions_;
175  }
176 
177  //- Per face that uses a duplicated point the local index
178  const Map<label>& meshFaceMap() const
179  {
180  return meshFaceMap_;
181  }
182 
183  //- Per face the region of its points
184  const faceList& faceRegions() const
185  {
186  return faceRegions_;
187  }
188 
189 
190  // Edit
191 
192  //- Force recalculation of locally stored data on topological change
193  void topoChange(const polyTopoChangeMap&);
194 };
195 
196 
197 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
198 
199 } // End namespace Foam
200 
201 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 
203 #endif
204 
205 // ************************************************************************* //
const labelListList & pointRegions() const
Per local point the regions it is in.
const faceList & faceRegions() const
Per face the region of its points.
A face is a list of labels corresponding to mesh vertices.
Definition: face.H:75
Cell-face mesh analysis engine.
Definition: primitiveMesh.H:74
fvMesh & mesh
const Map< label > & meshPointMap() const
Per point that is to be duplicated the local index.
scalar f1
Definition: createFields.H:15
void topoChange(const polyTopoChangeMap &)
Force recalculation of locally stored data on topological change.
Takes mesh with &#39;baffles&#39; (= boundary faces sharing points). Determines for selected points on bounda...
static labelPairList findDuplicateFacePairs(const polyMesh &)
Helper routine to find all baffles (two boundary faces.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
localPointRegion(const polyMesh &mesh)
Construct from mesh. Assumes all non-coupled boundary points.
const Map< label > & meshFaceMap() const
Per face that uses a duplicated point the local index.
ClassName("localPointRegion")
Runtime type information.
static labelList findDuplicateFaces(const primitiveMesh &, const labelList &)
Helper routine to find baffles (two boundary faces using the.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:76
Namespace for OpenFOAM.