Nektar++
FaceMesh.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: SurfaceMesh.h
4 //
5 // For more information, please see: http://www.nektar.info/
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: class for indivdual surface meshes
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NekMeshUtils_SURFACEMESHING_FACEMESH
36 #define NekMeshUtils_SURFACEMESHING_FACEMESH
37 
41 
42 namespace Nektar
43 {
44 namespace NekMeshUtils
45 {
46 
47 /**
48  * @brief class for surface meshes on individual surfaces (paramter plane
49  * meshes)
50  */
51 class FaceMesh
52 {
53 public:
54  friend class MemoryManager<FaceMesh>;
55 
56  /**
57  * @brief Default constructor
58  */
59  FaceMesh(const int id,
60  MeshSharedPtr m,
61  const std::map<int, CurveMeshSharedPtr> &cmeshes,
62  const int comp)
63  : m_mesh(m), m_curvemeshes(cmeshes), m_id(id), m_compId(comp)
64 
65  {
66  m_cadsurf = m_mesh->m_cad->GetSurf(m_id);
67  m_edgeloops = m_cadsurf->GetEdges();
68  };
69 
70  /**
71  * @brief mesh exectuation command
72  */
73  void Mesh();
74 
75  /**
76  * @brief validate the curve meshes
77  */
78  bool ValidateCurves();
79 
80  /**
81  * @brief validate the curve meshes considering the loops
82  */
83  void ValidateLoops();
84 
85 private:
86 
87  /**
88  * @brief Get the boundries of the surface and extracts the nodes from
89  * the curve meshes in the correct order
90  */
91  void OrientateCurves();
92 
93  /**
94  * @brief Calculate the paramter plane streching factor
95  */
96  void Stretching();
97 
98  /**
99  * @brief performs node smoothing on face
100  */
101  void Smoothing();
102 
103  /**
104  * @brief performs diagonal swapping of edges
105  */
106  void DiagonalSwap();
107 
108  /**
109  * @brief build a local version of mesh elements
110  */
111  void BuildLocalMesh();
112 
113  /**
114  * @brief function which calls the optimisation routines
115  */
116  void OptimiseLocalMesh();
117 
118  /**
119  * @brief Validate the surface mesh base on the octree and real
120  * dimensions of the edges
121  */
122  bool Validate();
123 
124  /**
125  * @brief adds a new stiener point to the triangulation for meshing
126  */
128 
129  /**
130  * @brief adds a quad layer around any interior loops
131  */
132  void MakeBL();
133 
134  /// mesh pointer
136  /// CAD surface
138  /// Map of the curve meshes which bound the surfaces
139  std::map<int, CurveMeshSharedPtr> m_curvemeshes;
140  /// data structure containing the edges, their order and oreientation for
141  /// the surface
142  std::vector<EdgeLoopSharedPtr> m_edgeloops;
143  /// id of the surface mesh
144  int m_id;
145  /// list of boundary nodes in their order loops
146  std::vector<std::vector<NodeSharedPtr> > orderedLoops;
147  /// list of stiener points in the triangulation
148  std::vector<NodeSharedPtr> m_stienerpoints;
149  /// pplane stretching
151  /// triangle connectiviities
152  std::vector<std::vector<NodeSharedPtr> > m_connec;
153  /// local set of nodes
155  /// local set of edges
157  /// local list of elements
158  std::vector<ElementSharedPtr> m_localElements;
159  /// set of nodes which are in the boundary (easier to identify conflicts with)
161  /// identity to put into element tags
162  int m_compId;
163 };
164 
165 typedef std::shared_ptr<FaceMesh> FaceMeshSharedPtr;
166 }
167 }
168 
169 #endif
std::vector< std::vector< NodeSharedPtr > > orderedLoops
list of boundary nodes in their order loops
Definition: FaceMesh.h:146
bool Validate()
Validate the surface mesh base on the octree and real dimensions of the edges.
Definition: FaceMesh.cpp:1018
std::shared_ptr< CADSurf > CADSurfSharedPtr
Definition: CADCurve.h:51
std::map< int, CurveMeshSharedPtr > m_curvemeshes
Map of the curve meshes which bound the surfaces.
Definition: FaceMesh.h:139
std::unordered_set< EdgeSharedPtr, EdgeHash > EdgeSet
Definition: Edge.h:159
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void ValidateLoops()
validate the curve meshes considering the loops
Definition: FaceMesh.cpp:126
void Stretching()
Calculate the paramter plane streching factor.
Definition: FaceMesh.cpp:964
FaceMesh(const int id, MeshSharedPtr m, const std::map< int, CurveMeshSharedPtr > &cmeshes, const int comp)
Default constructor.
Definition: FaceMesh.h:59
std::vector< ElementSharedPtr > m_localElements
local list of elements
Definition: FaceMesh.h:158
std::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:156
std::vector< EdgeLoopSharedPtr > m_edgeloops
data structure containing the edges, their order and oreientation for the surface ...
Definition: FaceMesh.h:142
bool ValidateCurves()
validate the curve meshes
Definition: FaceMesh.cpp:46
int m_compId
identity to put into element tags
Definition: FaceMesh.h:162
std::vector< std::vector< NodeSharedPtr > > m_connec
triangle connectiviities
Definition: FaceMesh.h:152
std::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Definition: Node.h:447
void Mesh()
mesh exectuation command
Definition: FaceMesh.cpp:145
EdgeSet m_localEdges
local set of edges
Definition: FaceMesh.h:156
int m_id
id of the surface mesh
Definition: FaceMesh.h:144
void OrientateCurves()
Get the boundries of the surface and extracts the nodes from the curve meshes in the correct order...
Definition: FaceMesh.cpp:1175
double NekDouble
void DiagonalSwap()
performs diagonal swapping of edges
Definition: FaceMesh.cpp:506
std::vector< NodeSharedPtr > m_stienerpoints
list of stiener points in the triangulation
Definition: FaceMesh.h:148
void MakeBL()
adds a quad layer around any interior loops
std::shared_ptr< FaceMesh > FaceMeshSharedPtr
Definition: FaceMesh.h:165
NekDouble m_str
pplane stretching
Definition: FaceMesh.h:150
void AddNewPoint(Array< OneD, NekDouble > uv)
adds a new stiener point to the triangulation for meshing
Definition: FaceMesh.cpp:1129
void Smoothing()
performs node smoothing on face
Definition: FaceMesh.cpp:255
void BuildLocalMesh()
build a local version of mesh elements
Definition: FaceMesh.cpp:902
void OptimiseLocalMesh()
function which calls the optimisation routines
Definition: FaceMesh.cpp:243
CADSurfSharedPtr m_cadsurf
CAD surface.
Definition: FaceMesh.h:137
MeshSharedPtr m_mesh
mesh pointer
Definition: FaceMesh.h:135
class for surface meshes on individual surfaces (paramter plane meshes)
Definition: FaceMesh.h:51
NodeSet m_localNodes
local set of nodes
Definition: FaceMesh.h:154
NodeSet m_inBoundary
set of nodes which are in the boundary (easier to identify conflicts with)
Definition: FaceMesh.h:160