meshSurfaceMapper2D.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  meshSurfaceMapper2D
26 
27 Description
28  Maps vertices of a 2D onto the nearest points on the geometry
29 
30 SourceFiles
31  meshSurfaceMapper2D.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef meshSurfaceMapper2D_H
36 #define meshSurfaceMapper2D_H
37 
38 #include "labelList.H"
39 #include "pointField.H"
40 #include "labelLongList.H"
41 #include "parMapperHelper.H"
42 #include "boundBox.H"
43 
44 #include <map>
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 // Forward declarations
52 class meshOctree;
53 class polyMeshGen;
55 class meshSurfaceEngine;
58 
59 /*---------------------------------------------------------------------------*\
60  Class meshSurfaceMapper2D Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 {
65  // Private data
66  //- reference to mesh surface
68 
69  //- reference to the octree
70  const meshOctree& meshOctree_;
71 
72  //- mesh 2D engine
74 
75  //- triSurface partitioner
77 
78  //- mesh surface partitioner
80 
81  //- labels of edges which are at the boundary which shall be mapped
82  //- onto the surface
84 
85  // Private member functions
86  //- find active boundary edges
88 
89  //- create a 2D engine
90  void create2DEngine() const;
91 
92  //- create and return mesh 2D engine
93  inline const polyMeshGen2DEngine& mesh2DEngine() const
94  {
95  if( !mesh2DEnginePtr_ )
97 
98  return *mesh2DEnginePtr_;
99  }
100 
101  //- create surface partitioner
102  void createTriSurfacePartitioner() const;
103 
104  //- create and reurn surface partitioner
105  inline const triSurfacePartitioner& surfacePartitioner() const
106  {
107  if( !surfPartitionerPtr_ )
109 
110  return *surfPartitionerPtr_;
111  }
112 
113  //- create mesh surface partitioner
114  void createMeshSurfacePartitioner() const;
115 
116  //- create and return mesh surface partitioner
117  inline const meshSurfacePartitioner& meshPartitioner() const
118  {
119  if( !meshPartitionerPtr_ )
121 
122  return *meshPartitionerPtr_;
123  }
124 
125  //- delete dynamically allocated data
126  void clearOut();
127 
128  // Private member functions needed for parallel execution
129  //- find mapping distance for corner points
131  (
132  const labelLongList&,
133  std::map<label, scalar>&
134  ) const;
135 
136  //- map to the location with the smallest distance
138 
139  //- Disallow default bitwise copy construct
141 
142  //- Disallow default bitwise assignment
143  void operator=(const meshSurfaceMapper2D&);
144 
145 public:
146 
147  // Constructors
148 
149  //- Construct from meshSurfaceEngine and octree
151 
152  // Destructor
153 
155 
156  // Member Functions
157 
158  //- adjust z coordinates of the mesh to the ones in the surface mesh
159  void adjustZCoordinates();
160 
161  //- projects surface vertices onto their nearest location
162  //- on the surface mesh
163  void mapVerticesOntoSurface();
164 
165  //- projects selected edge to their nearest location
166  //- on the surface mesh
167  void mapVerticesOntoSurface(const labelLongList& edgesToMap);
168 
169  //- projects edges with corners onto their nearest location
170  //- on the surface mesh
171  void mapCorners();
172 
173  //- projects selected edges with corners onto their nearest
174  //- locations on the surface mesh
175  void mapCorners(const labelLongList& edgesToMap);
176 
177  //- projects surface edges onto the surface with respect
178  //- to the surface patch they belong to. Corners are respected
180 
181  //- projects selected surface edges onto the surface with respect
182  //- to the surface patch they belong to. Corners are respected
183  void mapVerticesOntoSurfacePatches(const labelLongList& edgesToMap);
184 
185  //- a combination of mapping and smoothing intended for better
186  //- feature capturing
187  void preMapVertices(const label nIterations = 2);
188 };
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 } // End namespace Foam
193 
194 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
195 
196 #endif
197 
198 // ************************************************************************* //
Foam::triSurfacePartitioner
Definition: triSurfacePartitioner.H:53
Foam::meshSurfaceMapper2D::create2DEngine
void create2DEngine() const
create a 2D engine
Definition: meshSurfaceMapper2D.C:106
meshSurfaceEngine
Calculates surface of the mesh.
Foam::meshSurfaceMapper2D::meshPartitionerPtr_
meshSurfacePartitioner * meshPartitionerPtr_
mesh surface partitioner
Definition: meshSurfaceMapper2D.H:78
Foam::meshSurfaceMapper2D::mesh2DEngine
const polyMeshGen2DEngine & mesh2DEngine() const
create and return mesh 2D engine
Definition: meshSurfaceMapper2D.H:92
polyMeshGen
Mesh with selections.
Foam::meshSurfaceMapper2D::~meshSurfaceMapper2D
~meshSurfaceMapper2D()
Definition: meshSurfaceMapper2D.C:157
Foam::meshSurfaceMapper2D::surfPartitionerPtr_
triSurfacePartitioner * surfPartitionerPtr_
triSurface partitioner
Definition: meshSurfaceMapper2D.H:75
Foam::LongList< label >
triSurfacePartitioner
Provides information regarding surface partitions on the surface triangulation, and connectivity betw...
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
polyMeshGen2DEngine
A simple engine which provides topological information of a 2D mesh and allows for maintaining consis...
labelList.H
Foam::meshSurfaceMapper2D::createMeshSurfacePartitioner
void createMeshSurfacePartitioner() const
create mesh surface partitioner
Definition: meshSurfaceMapper2D.C:117
Foam::meshSurfaceMapper2D::activeBoundaryEdges_
labelLongList activeBoundaryEdges_
Definition: meshSurfaceMapper2D.H:82
meshSurfacePartitioner
Finds corners and edge points at the surface of the volume mesh.
Foam::meshSurfaceMapper2D::clearOut
void clearOut()
delete dynamically allocated data
Definition: meshSurfaceMapper2D.C:122
Foam::meshSurfaceMapper2D
Definition: meshSurfaceMapper2D.H:62
Foam::meshSurfaceMapper2D::preMapVertices
void preMapVertices(const label nIterations=2)
Definition: meshSurfaceMapper2DPremapVertices.C:49
Foam::meshSurfaceMapper2D::mapVerticesOntoSurface
void mapVerticesOntoSurface()
Definition: meshSurfaceMapper2DMapVertices.C:262
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::meshSurfaceMapper2D::mesh2DEnginePtr_
polyMeshGen2DEngine * mesh2DEnginePtr_
mesh 2D engine
Definition: meshSurfaceMapper2D.H:72
Foam::meshSurfaceMapper2D::meshOctree_
const meshOctree & meshOctree_
reference to the octree
Definition: meshSurfaceMapper2D.H:69
Foam::meshSurfacePartitioner
Definition: meshSurfacePartitioner.H:52
Foam::meshSurfaceMapper2D::surfaceEngine_
const meshSurfaceEngine & surfaceEngine_
reference to mesh surface
Definition: meshSurfaceMapper2D.H:66
Foam::meshSurfaceMapper2D::meshSurfaceMapper2D
meshSurfaceMapper2D(const meshSurfaceMapper2D &)
Disallow default bitwise copy construct.
pointField.H
boundBox.H
Foam::meshSurfaceMapper2D::mapVerticesOntoSurfacePatches
void mapVerticesOntoSurfacePatches()
Definition: meshSurfaceMapper2DMapVertices.C:490
Foam::meshSurfaceMapper2D::createTriSurfacePartitioner
void createTriSurfacePartitioner() const
create surface partitioner
Definition: meshSurfaceMapper2D.C:112
Foam::polyMeshGen2DEngine
Definition: polyMeshGen2DEngine.H:51
Foam::meshOctree
Definition: meshOctree.H:55
Foam::meshSurfaceMapper2D::meshPartitioner
const meshSurfacePartitioner & meshPartitioner() const
create and return mesh surface partitioner
Definition: meshSurfaceMapper2D.H:116
Foam::meshSurfaceMapper2D::findMappingDistance
void findMappingDistance(const labelLongList &, std::map< label, scalar > &) const
find mapping distance for corner points
Definition: meshSurfaceMapper2DMapVertices.C:56
labelLongList.H
meshOctree
Octree for mesh generation.
Foam::meshSurfaceMapper2D::findActiveBoundaryEdges
void findActiveBoundaryEdges()
find active boundary edges
Definition: meshSurfaceMapper2D.C:47
Foam::meshSurfaceMapper2D::operator=
void operator=(const meshSurfaceMapper2D &)
Disallow default bitwise assignment.
Foam::meshSurfaceMapper2D::mapCorners
void mapCorners()
Definition: meshSurfaceMapper2DMapVertices.C:354
parMapperHelper.H
Foam::meshSurfaceEngine
Definition: meshSurfaceEngine.H:54
Foam::meshSurfaceMapper2D::mapToSmallestDistance
void mapToSmallestDistance(LongList< parMapperHelper > &)
map to the location with the smallest distance
Definition: meshSurfaceMapper2DMapVertices.C:139
Foam::meshSurfaceMapper2D::adjustZCoordinates
void adjustZCoordinates()
adjust z coordinates of the mesh to the ones in the surface mesh
Definition: meshSurfaceMapper2DMapVertices.C:219
Foam::meshSurfaceMapper2D::surfacePartitioner
const triSurfacePartitioner & surfacePartitioner() const
create and reurn surface partitioner
Definition: meshSurfaceMapper2D.H:104