boundaryLayers.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
11  cfMesh 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 3 of the License, or (at your
14  option) any later version.
15 
16  cfMesh 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 cfMesh. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  boundaryLayers
26 
27 Description
28  Creates boundary layers
29 
30 SourceFiles
31  boundaryLayers.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef boundaryLayers_H
36 #define boundaryLayers_H
37 
38 #include "polyMeshGenModifier.H"
39 #include "meshSurfaceEngine.H"
40 #include "meshSurfacePartitioner.H"
41 #include "DynList.H"
42 #include "labelLongList.H"
43 #include "Map.H"
44 #include "labelPair.H"
45 
46 #include <map>
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declarations
54 class meshSurfaceEngine;
56 
57 /*---------------------------------------------------------------------------*\
58  Class boundaryLayers Declaration
59 \*---------------------------------------------------------------------------*/
60 
61 class boundaryLayers
62 {
63  //- Reference to the mesh
65 
66  //- pointer to mesh surface engine
67  mutable meshSurfaceEngine* msePtr_;
68 
69  //- poiner to meshSurfacePartitioner
71 
72  //- shall I create patch-wise layers (true)
73  //- O-topology layer (false)
74  bool patchWiseLayers_;
75 
76  //- shall the layers be terminated at concave edges (true)
78 
79  //- is it a 2D mesh
80  bool is2DMesh_;
81 
82  //- patch names
84 
85  //- patch types
87 
88  //- helper which contains information if a boundary layer
89  //- has already been extruded for a given patch
91 
92  //- extrude patches with patch
94 
95  //- label of a new node (helper)
97 
98  //- map storing labels of new vertices created at node
99  //- and corner vertices
100  std::map<label, std::map<std::pair<label, label>, label> > otherVrts_;
101 
102  //- a key assigned to each patch. It is needed to search in otherVrts_
104 
105  //- number of vertices in the mesh
106  label nPoints_;
107 
108  //- has the geometry been analysed
109  bool geometryAnalysed_;
110 
111  // Private member functions
112  //- Return const reference to meshSurfaceEngine
113  const meshSurfaceEngine& surfaceEngine() const;
114 
115  //- return const reference to meshSurfacePartitioner
117 
118  //- find if any other patches need to be treated together
119  //- with the given one
121 
122  //- find vertices of the selected patches
123  void findPatchVertices
124  (
125  const boolList& treatPatches,
126  List<direction>& patchVertex
127  ) const;
128 
129  //- check and correct the topology of boundary faces where
130  //- the layers terminate
131  void checkTopologyOfBoundaryFaces(const labelList& patchLabels);
132 
133  //- create new vertex
135  (
136  const label bpI,
137  const boolList& treatPatches,
138  const List<direction>& pVertices
139  ) const;
140 
141  //- create new vertices for the selected patches
142  void createNewVertices
143  (
144  const boolList& treatPatches
145  );
146 
147  //- create new vertices such that layers for selected patches
148  //- are generated in a single run
149  void createNewVertices
150  (
151  const labelList& patchLabels
152  );
153 
154  //- creates new vertices for vertices at parallel boundaries
156  (
157  const labelLongList& procPoints,
158  const List<direction>& pVertices,
159  const boolList& treatPatches
160  );
161 
162  //- creates new vertices from vertices at parallel boundaries
163  //- which are also at the border of the treated partitions
165  (
166  const labelLongList& procPoints,
167  const List<direction>& pVertices,
168  const boolList& treatPatches
169  );
170 
171  //- create a layer of cells
173  (
174  const boolList& treatPatches
175  );
176 
177  //- create new faces at parallel boundaries
178  //- faces are extruded from edges
180  (
181  const boolList& treatPatches
182  );
183 
184  //- create new faces at parallel boundaries
185  //- faces are created from points at parallel boundaries
186  //- the function takes a reference to the faces which are the candidates
187  //- to create faces at parallel boundaries
189  (
190  const LongList<DynList<label, 4> >& faceCandidates,
191  const LongList<labelPair>& candidatePatches
192  );
193 
194  //- create layer cells in one go
195  //- this is much faster than layer by layer
196  void createLayerCells(const labelList& patchLabels);
197 
198  //- helper function finding a new face label for multiply extruded nodes
199  inline label findNewNodeLabel
200  (
201  const label pointI,
202  const label pKey
203  ) const;
204 
205  //- creating hex cells near feature edges
206  inline void createNewCellFromEdge
207  (
208  const edge& e,
209  const label pKeyI,
210  const label pKeyJ,
211  FixedList<FixedList<label, 4>, 6>& cellFaces
212  ) const;
213 
214  //- creating hex cells near corners
215  inline void createNewCellFromNode
216  (
217  const label pointI,
218  const DynList<label, 3>& pKeys,
219  FixedList<FixedList<label, 4>, 6>& cellFaces
220  ) const;
221 
222  //- create a bnd layer for a given patch
223  void addLayerForPatch(const label patchLabel);
224 
225  //- delete meshSurfaceEngine
226  inline void clearOut()
227  {
230  }
231 
232  // Enumerators
233  enum vertexTypes
234  {
235  NONE = 0,
237  EDGENODE = 2,
239  PARALLELBOUNDARY = 8
240  };
241 
242  //- Disallow bitwise copy construct
244 
245  //- Disallow bitwise assignment
246  void operator=(const boundaryLayers&);
247 
248 public:
249 
250  // Constructors
251 
252  //- Construct from mesh reference
254 
255  // Destructor
256  ~boundaryLayers();
257 
258  // Public member functions
259  //- adds layer for a given patch
260  void addLayerForPatch(const word& patchName);
261 
262  //- create O-topology layers (used as flag)
263  void createOTopologyLayers();
264 
265  //- terminate boundary layers at concave edges (used as a flag)
267 
268  //- avoid generating layers for empty patches in case of a 2D mesh
269  //- used as a flag prior to addLayerForAllPatches
270  void activate2DMode();
271 
272  //- add layers for all patches
273  void addLayerForAllPatches();
274 
275  //- add wrapper layer
276  //- this function is intended for usage before surface recovery
277  void addWrapperLayer();
278 };
279 
280 
281 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
282 
283 } // End namespace Foam
284 
285 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
286 
287 #include "boundaryLayersI.H"
288 
289 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
290 
291 #endif
292 
293 // ************************************************************************* //
Foam::boundaryLayers::patchNames_
wordList patchNames_
patch names
Definition: boundaryLayers.H:82
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::boundaryLayers::~boundaryLayers
~boundaryLayers()
Definition: boundaryLayers.C:572
Foam::boundaryLayers::surfaceEngine
const meshSurfaceEngine & surfaceEngine() const
Return const reference to meshSurfaceEngine.
Definition: boundaryLayers.C:54
meshSurfaceEngine
Calculates surface of the mesh.
Foam::boundaryLayers::createNewPartitionVerticesParallel
void createNewPartitionVerticesParallel(const labelLongList &procPoints, const List< direction > &pVertices, const boolList &treatPatches)
creates new vertices for vertices at parallel boundaries
Definition: boundaryLayersCreateVertices.C:686
Foam::boundaryLayers::nPoints_
label nPoints_
number of vertices in the mesh
Definition: boundaryLayers.H:105
Foam::boundaryLayers::mesh_
polyMeshGen & mesh_
Reference to the mesh.
Definition: boundaryLayers.H:63
Foam::boundaryLayers::patchTypes_
wordList patchTypes_
patch types
Definition: boundaryLayers.H:85
polyMeshGenModifier.H
Foam::edge
An edge is a list of two point labels. The functionality it provides supports the discretisation on a...
Definition: edge.H:58
Foam::boundaryLayers::newLabelForVertex_
labelLongList newLabelForVertex_
label of a new node (helper)
Definition: boundaryLayers.H:95
Foam::boundaryLayers::otherVrts_
std::map< label, std::map< std::pair< label, label >, label > > otherVrts_
Definition: boundaryLayers.H:99
Foam::boundaryLayers::is2DMesh_
bool is2DMesh_
is it a 2D mesh
Definition: boundaryLayers.H:79
Foam::polyMeshGen
Definition: polyMeshGen.H:46
Foam::boundaryLayers::PARALLELBOUNDARY
@ PARALLELBOUNDARY
Definition: boundaryLayers.H:238
Foam::boundaryLayers::createNewFacesFromPointsParallel
void createNewFacesFromPointsParallel(const LongList< DynList< label, 4 > > &faceCandidates, const LongList< labelPair > &candidatePatches)
Definition: boundaryLayerCells.C:652
Foam::boundaryLayers::addWrapperLayer
void addWrapperLayer()
Definition: boundaryLayersWrapperLayer.C:39
Foam::boundaryLayers::createNewCellFromNode
void createNewCellFromNode(const label pointI, const DynList< label, 3 > &pKeys, FixedList< FixedList< label, 4 >, 6 > &cellFaces) const
creating hex cells near corners
Definition: boundaryLayersI.H:231
Foam::boundaryLayers::boundaryLayers
boundaryLayers(const boundaryLayers &)
Disallow bitwise copy construct.
Foam::boundaryLayers
Definition: boundaryLayers.H:60
Foam::boundaryLayers::EDGENODE
@ EDGENODE
Definition: boundaryLayers.H:236
Foam::LongList< label >
Foam::deleteDemandDrivenData
void deleteDemandDrivenData(DataPtr &dataPtr)
Definition: demandDrivenData.H:40
Foam::boundaryLayers::NONE
@ NONE
Definition: boundaryLayers.H:234
Map.H
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Foam::boundaryLayers::findPatchesToBeTreatedTogether
void findPatchesToBeTreatedTogether()
Definition: boundaryLayers.C:70
Foam::boundaryLayers::PATCHNODE
@ PATCHNODE
Definition: boundaryLayers.H:235
Foam::boundaryLayers::addLayerForPatch
void addLayerForPatch(const label patchLabel)
create a bnd layer for a given patch
Definition: boundaryLayers.C:494
Foam::boundaryLayers::geometryAnalysed_
bool geometryAnalysed_
has the geometry been analysed
Definition: boundaryLayers.H:108
Foam::boundaryLayers::terminateLayersAtConcaveEdges
void terminateLayersAtConcaveEdges()
terminate boundary layers at concave edges (used as a flag)
Definition: boundaryLayers.C:599
Foam::boundaryLayers::addLayerForAllPatches
void addLayerForAllPatches()
add layers for all patches
Definition: boundaryLayers.C:653
boundaryLayersI.H
Foam::boundaryLayers::createNewEdgeVerticesParallel
void createNewEdgeVerticesParallel(const labelLongList &procPoints, const List< direction > &pVertices, const boolList &treatPatches)
Definition: boundaryLayersCreateVertices.C:793
meshSurfacePartitioner
Finds corners and edge points at the surface of the volume mesh.
Foam::boundaryLayers::terminateLayersAtConcaveEdges_
bool terminateLayersAtConcaveEdges_
shall the layers be terminated at concave edges (true)
Definition: boundaryLayers.H:76
Foam::boundaryLayers::patchKey_
labelList patchKey_
a key assigned to each patch. It is needed to search in otherVrts_
Definition: boundaryLayers.H:102
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:18
Foam::boundaryLayers::findPatchVertices
void findPatchVertices(const boolList &treatPatches, List< direction > &patchVertex) const
find vertices of the selected patches
Definition: boundaryLayersCreateVertices.C:53
Foam::boundaryLayers::createLayerCells
void createLayerCells(const labelList &patchLabels)
Definition: boundaryLayerCells.C:53
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
meshSurfaceEngine.H
Foam::boundaryLayers::vertexTypes
vertexTypes
Definition: boundaryLayers.H:232
Foam::e
const double e
Elementary charge.
Definition: doubleFloat.H:94
Foam::DynList
Definition: DynList.H:53
Foam::boundaryLayers::checkTopologyOfBoundaryFaces
void checkTopologyOfBoundaryFaces(const labelList &patchLabels)
Definition: boundaryLayersCheckTopologyOfBndFaces.C:45
Foam::meshSurfacePartitioner
Definition: meshSurfacePartitioner.H:52
Foam::boundaryLayers::createNewVertex
point createNewVertex(const label bpI, const boolList &treatPatches, const List< direction > &pVertices) const
create new vertex
Definition: boundaryLayersCreateVertices.C:106
Foam::boundaryLayers::operator=
void operator=(const boundaryLayers &)
Disallow bitwise assignment.
Foam::boundaryLayers::clearOut
void clearOut()
delete meshSurfaceEngine
Definition: boundaryLayers.H:225
Foam::boundaryLayers::CORNERNODE
@ CORNERNODE
Definition: boundaryLayers.H:237
Foam::boundaryLayers::createNewCellFromEdge
void createNewCellFromEdge(const edge &e, const label pKeyI, const label pKeyJ, FixedList< FixedList< label, 4 >, 6 > &cellFaces) const
creating hex cells near feature edges
Definition: boundaryLayersI.H:81
Foam::boundaryLayers::treatPatchesWithPatch_
List< DynList< label > > treatPatchesWithPatch_
extrude patches with patch
Definition: boundaryLayers.H:92
Foam::boundaryLayers::createOTopologyLayers
void createOTopologyLayers()
create O-topology layers (used as flag)
Definition: boundaryLayers.C:594
Foam::boundaryLayers::meshPartitionerPtr_
meshSurfacePartitioner * meshPartitionerPtr_
poiner to meshSurfacePartitioner
Definition: boundaryLayers.H:69
Foam::Vector< scalar >
Foam::boundaryLayers::treatedPatch_
boolList treatedPatch_
Definition: boundaryLayers.H:89
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::boundaryLayers::activate2DMode
void activate2DMode()
Definition: boundaryLayers.C:604
Foam::FixedList
A 1D vector of objects of type <T> with a fixed size <Size>.
Definition: FixedList.H:53
Foam::boundaryLayers::createNewFacesParallel
void createNewFacesParallel(const boolList &treatPatches)
Definition: boundaryLayersFacesAndCells.C:180
labelLongList.H
Foam::boundaryLayers::patchWiseLayers_
bool patchWiseLayers_
Definition: boundaryLayers.H:73
Foam::boundaryLayers::createNewVertices
void createNewVertices(const boolList &treatPatches)
create new vertices for the selected patches
Definition: boundaryLayersCreateVertices.C:317
Foam::boundaryLayers::createNewFacesAndCells
void createNewFacesAndCells(const boolList &treatPatches)
create a layer of cells
Definition: boundaryLayersFacesAndCells.C:45
Foam::boundaryLayers::surfacePartitioner
const meshSurfacePartitioner & surfacePartitioner() const
return const reference to meshSurfacePartitioner
Definition: boundaryLayers.C:62
Foam::meshSurfaceEngine
Definition: meshSurfaceEngine.H:54
Foam::boundaryLayers::msePtr_
meshSurfaceEngine * msePtr_
pointer to mesh surface engine
Definition: boundaryLayers.H:66
DynList.H
Foam::boundaryLayers::findNewNodeLabel
label findNewNodeLabel(const label pointI, const label pKey) const
helper function finding a new face label for multiply extruded nodes
Definition: boundaryLayersI.H:38
meshSurfacePartitioner.H
labelPair.H