meshSurfaceMapper.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  meshSurfaceMapper
26 
27 Description
28  Maps vertices to the nearest point on the geometry surface
29 
30 SourceFiles
31  meshSurfaceMapper.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef meshSurfaceMapper_H
36 #define meshSurfaceMapper_H
37 
38 #include "labelList.H"
39 #include "pointField.H"
40 #include "labelLongList.H"
41 #include "parMapperHelper.H"
42 
43 #include <map>
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward declarations
51 class meshOctree;
52 class meshSurfaceEngine;
55 
56 /*---------------------------------------------------------------------------*\
57  Class meshSurfaceMapper Declaration
58 \*---------------------------------------------------------------------------*/
59 
61 {
62  // Private data
63  //- mesh surface
65 
66  //- reference to the octree
67  const meshOctree& meshOctree_;
68 
69  //- mesh surface partitioner
71  const bool deletePartitioner_;
72 
73  //- triSurface partitioner
75 
76  // Private member functions
77  //- create and return mesh surface partitioner
79  inline const meshSurfacePartitioner& meshPartitioner() const
80  {
83 
85  }
86 
87  //- create and return triSurfacePartitioner
89  inline const triSurfacePartitioner& surfacePartitioner() const
90  {
91  if( !surfPartitionerPtr_ )
93 
94  return *surfPartitionerPtr_;
95  }
96 
97  //- delete surfaceEnginePartitionerPtr_ and surfPartitionerPtr_
98  void clearOut();
99 
100  // Private member functions
101  //- map corner nodes to the boundary
102  void mapCorners(const labelLongList& nodesToMap);
103 
104  //- find mapping distance for selected points
106  (
107  const labelLongList& nodesToMap,
108  scalarList & mappingDistance
109  ) const;
110 
111  //- calculate face metric
112  scalar faceMetricInPatch(const label bfI, const label patchI) const;
113 
114  // Private member functions needed for parallel execution
115 
116  //- check if nodes at parallel boundaries are selected at all processors
118 
119  //- map to the smallest distance
120  //- makes sense for parallel calculations, only
122 
123  //- Disallow default bitwise copy construct
125 
126  //- Disallow default bitwise assignment
127  void operator=(const meshSurfaceMapper&);
128 
129 public:
130 
131  // Constructors
132 
133  //- Construct from meshSurfaceEngine and octree
135 
136  //- Construct from meshSurfacePartitioner and octree
138 
139  // Destructor
140 
142 
143  // Member Functions
144  //- map the given surface node on the selected patch
145  //- this does not make sense for vertices at parallel boundaries
146  void mapNodeToPatch(const label bpI, const label patchI = -1);
147 
148  //- projects surface vertices onto their nearest location
149  //- on the surface mesh
150  void mapVerticesOntoSurface();
151 
152  //- projects selected surface vertices to their nearest location
153  //- on the surface mesh
154  void mapVerticesOntoSurface(const labelLongList& nodesToMap);
155 
156  //- projects corner and edge vertices onto their nearest location
157  //- on the surface mesh
158  void mapCornersAndEdges();
159 
160  //- projects selected edge vertices onto their nearest
161  //- locations on the surface mesh
162  void mapEdgeNodes(const labelLongList& nodesToMap);
163 
164  //- projects surface vertices onto the surface with respect
165  //- to the surface patch they belong to. Edges and corner are respected
167 
168  //- projects selected surface vertices onto the surface with respect
169  //- to the surface patch they belong to. Edges and corner are respected
170  void mapVerticesOntoSurfacePatches(const labelLongList& nodesToMap);
171 
172  //- a combination of mapping and smoothing intended for better
173  //- feature capturing
174  void preMapVertices(const label nIterations = 3);
175 };
176 
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 
179 } // End namespace Foam
180 
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 
183 #endif
184 
185 // ************************************************************************* //
Foam::triSurfacePartitioner
Definition: triSurfacePartitioner.H:53
Foam::meshSurfaceMapper::surfaceEngine_
const meshSurfaceEngine & surfaceEngine_
mesh surface
Definition: meshSurfaceMapper.H:63
meshSurfaceEngine
Calculates surface of the mesh.
Foam::meshSurfaceMapper::faceMetricInPatch
scalar faceMetricInPatch(const label bfI, const label patchI) const
calculate face metric
Definition: meshSurfaceMapperCornersAndEdges.C:142
Foam::meshSurfaceMapper::meshSurfaceMapper
meshSurfaceMapper(const meshSurfaceMapper &)
Disallow default bitwise copy construct.
Foam::meshSurfaceMapper::surfacePartitioner
const triSurfacePartitioner & surfacePartitioner() const
Definition: meshSurfaceMapper.H:88
Foam::meshSurfaceMapper::findMappingDistance
void findMappingDistance(const labelLongList &nodesToMap, scalarList &mappingDistance) const
find mapping distance for selected points
Definition: meshSurfaceMapperCornersAndEdges.C:53
Foam::LongList< label >
Foam::meshSurfaceMapper::deletePartitioner_
const bool deletePartitioner_
Definition: meshSurfaceMapper.H:70
triSurfacePartitioner
Provides information regarding surface partitions on the surface triangulation, and connectivity betw...
Foam::meshSurfaceMapper::mapToSmallestDistance
void mapToSmallestDistance(LongList< parMapperHelper > &)
Definition: meshSurfaceMapperMapVertices.C:104
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
labelList.H
Foam::meshSurfaceMapper::createTriSurfacePartitioner
void createTriSurfacePartitioner() const
create and return triSurfacePartitioner
Definition: meshSurfaceMapper.C:50
Foam::meshSurfaceMapper::mapNodeToPatch
void mapNodeToPatch(const label bpI, const label patchI=-1)
Definition: meshSurfaceMapperMapVertices.C:172
Foam::meshSurfaceMapper::surfaceEnginePartitionerPtr_
const meshSurfacePartitioner * surfaceEnginePartitionerPtr_
mesh surface partitioner
Definition: meshSurfaceMapper.H:69
meshSurfacePartitioner
Finds corners and edge points at the surface of the volume mesh.
Foam::meshSurfaceMapper::clearOut
void clearOut()
delete surfaceEnginePartitionerPtr_ and surfPartitionerPtr_
Definition: meshSurfaceMapper.C:55
Foam::meshSurfaceMapper::preMapVertices
void preMapVertices(const label nIterations=3)
Definition: meshSurfaceMapperPremapVertices.C:51
Foam::meshSurfaceMapper::mapVerticesOntoSurfacePatches
void mapVerticesOntoSurfacePatches()
Definition: meshSurfaceMapperMapVertices.C:285
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshSurfacePartitioner
Definition: meshSurfacePartitioner.H:52
Foam::meshSurfaceMapper::mapCornersAndEdges
void mapCornersAndEdges()
Definition: meshSurfaceMapperCornersAndEdges.C:432
Foam::meshSurfaceMapper::createMeshSurfacePartitioner
void createMeshSurfacePartitioner() const
create and return mesh surface partitioner
Definition: meshSurfaceMapper.C:45
pointField.H
Foam::meshSurfaceMapper::mapEdgeNodes
void mapEdgeNodes(const labelLongList &nodesToMap)
Definition: meshSurfaceMapperCornersAndEdges.C:311
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::meshSurfaceMapper
Definition: meshSurfaceMapper.H:59
Foam::meshSurfaceMapper::selectNodesAtParallelBnd
void selectNodesAtParallelBnd(const labelLongList &)
check if nodes at parallel boundaries are selected at all processors
Definition: meshSurfaceMapperMapVertices.C:53
Foam::meshOctree
Definition: meshOctree.H:55
labelLongList.H
meshOctree
Octree for mesh generation.
Foam::meshSurfaceMapper::meshPartitioner
const meshSurfacePartitioner & meshPartitioner() const
Definition: meshSurfaceMapper.H:78
Foam::meshSurfaceMapper::mapVerticesOntoSurface
void mapVerticesOntoSurface()
Definition: meshSurfaceMapperMapVertices.C:202
Foam::meshSurfaceMapper::operator=
void operator=(const meshSurfaceMapper &)
Disallow default bitwise assignment.
Foam::meshSurfaceMapper::surfPartitionerPtr_
triSurfacePartitioner * surfPartitionerPtr_
triSurface partitioner
Definition: meshSurfaceMapper.H:73
Foam::meshSurfaceMapper::mapCorners
void mapCorners(const labelLongList &nodesToMap)
map corner nodes to the boundary
Definition: meshSurfaceMapperCornersAndEdges.C:195
parMapperHelper.H
Foam::meshSurfaceMapper::meshOctree_
const meshOctree & meshOctree_
reference to the octree
Definition: meshSurfaceMapper.H:66
Foam::meshSurfaceEngine
Definition: meshSurfaceEngine.H:54
Foam::meshSurfaceMapper::~meshSurfaceMapper
~meshSurfaceMapper()
Definition: meshSurfaceMapper.C:106