Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CurveMesh.h
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Curvemesh.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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: object for individual curve meshes.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_MESHUTILS_SURFACEMESHING_CURVEMESH_H
37 #define NEKTAR_MESHUTILS_SURFACEMESHING_CURVEMESH_H
38 
39 #include <boost/shared_ptr.hpp>
40 
44 
48 
49 /**
50  * @brief class for meshing individual curves (1d meshing)
51  */
52 namespace Nektar
53 {
54 namespace NekMeshUtils
55 {
56 
57 class CurveMesh
58 {
59 public:
60  friend class MemoryManager<CurveMesh>;
61 
62  /**
63  * @brief default constructor
64  */
65  CurveMesh(int id, MeshSharedPtr m, std::string expr = "0.0")
66  : m_id(id), m_mesh(m)
67  {
68  m_blID = m_bl.DefineFunction("x y z", expr);
69  m_cadcurve = m_mesh->m_cad->GetCurve(m_id);
70  }
71 
72  CurveMesh(int id, MeshSharedPtr m, std::vector<NodeSharedPtr> ns)
73  : m_id(id), m_mesh(m), m_meshpoints(ns)
74  {
75  m_cadcurve = m_mesh->m_cad->GetCurve(m_id);
76  }
77 
78  /**
79  * @brief execute meshing
80  */
81  void Mesh();
82 
83  /**
84  * @brief get id of first node
85  */
87  {
88  return m_meshpoints[0];
89  }
90 
91  /**
92  * @brief get id of last node
93  */
95  {
96  return m_meshpoints.back();
97  }
98 
99  /**
100  * @brief get list of mesh nodes
101  */
102  std::vector<NodeSharedPtr> GetMeshPoints()
103  {
104  return m_meshpoints;
105  }
106 
107  std::vector<EdgeSharedPtr> GetMeshEdges()
108  {
109  return m_meshedges;
110  }
111 
112  /**
113  * @brief get the number of points in the curve
114  */
116  {
117  return m_meshpoints.size();
118  }
119 
120  /**
121  * @brief get the length of the curve
122  */
124  {
125  return m_curvelength;
126  }
127 
128 private:
129  /**
130  * @brief get node spacing sampling function
131  */
132  void GetSampleFunction();
133 
134  /**
135  * @brief get node spacing phi function
136  */
137  void GetPhiFunction();
138 
139  /**
140  * @brief evaluate paramter ds at curve location s
141  */
143 
144  /**
145  * @brief evaluate paramter ps at curve location s
146  */
148 
149  /// CAD curve
151  /// length of the curve in real space
153  /// number of sampling points used in algorithm
155  /// coords of the ends of the parametric curve
157  /// array of function ds evaluations
158  std::vector<std::vector<NekDouble> > m_dst;
159  /// array of function ps evaluations
160  std::vector<std::vector<NekDouble> > m_ps;
161  /// spacing function evaluation
163  /// ds
165  /// number of edges to be made in the curve as defined by the spacing
166  /// funtion
167  int Ne;
168  /// paramteric coordiates of the mesh nodes
169  std::vector<NekDouble> meshsvalue;
170  /// list of mesh edges in the curvemesh
171  std::vector<EdgeSharedPtr> m_meshedges;
172  /// id of the curvemesh
173  int m_id;
174  ///
176  /// ids of the mesh nodes
177  std::vector<NodeSharedPtr> m_meshpoints;
179  int m_blID;
180 };
181 
182 typedef boost::shared_ptr<CurveMesh> CurveMeshSharedPtr;
183 }
184 }
185 
186 #endif
void GetSampleFunction()
get node spacing sampling function
Definition: CurveMesh.cpp:298
NekDouble GetLength()
get the length of the curve
Definition: CurveMesh.h:123
LibUtilities::AnalyticExpressionEvaluator m_bl
Definition: CurveMesh.h:178
Array< OneD, NekDouble > m_bounds
coords of the ends of the parametric curve
Definition: CurveMesh.h:156
int m_numSamplePoints
number of sampling points used in algorithm
Definition: CurveMesh.h:154
std::vector< std::vector< NekDouble > > m_ps
array of function ps evaluations
Definition: CurveMesh.h:160
CurveMesh(int id, MeshSharedPtr m, std::string expr="0.0")
default constructor
Definition: CurveMesh.h:65
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
NekDouble Ae
spacing function evaluation
Definition: CurveMesh.h:162
void Mesh()
execute meshing
Definition: CurveMesh.cpp:45
std::vector< EdgeSharedPtr > m_meshedges
list of mesh edges in the curvemesh
Definition: CurveMesh.h:171
std::vector< EdgeSharedPtr > GetMeshEdges()
Definition: CurveMesh.h:107
int m_id
id of the curvemesh
Definition: CurveMesh.h:173
std::vector< NodeSharedPtr > GetMeshPoints()
get list of mesh nodes
Definition: CurveMesh.h:102
int Ne
number of edges to be made in the curve as defined by the spacing funtion
Definition: CurveMesh.h:167
boost::shared_ptr< CurveMesh > CurveMeshSharedPtr
Definition: CurveMesh.h:182
std::vector< NodeSharedPtr > m_meshpoints
ids of the mesh nodes
Definition: CurveMesh.h:177
boost::shared_ptr< Node > NodeSharedPtr
Definition: Node.h:50
int GetNumPoints()
get the number of points in the curve
Definition: CurveMesh.h:115
double NekDouble
CADCurveSharedPtr m_cadcurve
CAD curve.
Definition: CurveMesh.h:150
This class defines evaluator of analytic (symbolic) mathematical expressions. Expressions are allowed...
NodeSharedPtr GetLastPoint()
get id of last node
Definition: CurveMesh.h:94
NodeSharedPtr GetFirstPoint()
get id of first node
Definition: CurveMesh.h:86
int DefineFunction(const std::string &vlist, const std::string &function)
This function allows one to define a function to evaluate. The first argument (vlist) is a list of va...
boost::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:147
void GetPhiFunction()
get node spacing phi function
Definition: CurveMesh.cpp:190
CurveMesh(int id, MeshSharedPtr m, std::vector< NodeSharedPtr > ns)
Definition: CurveMesh.h:72
NekDouble m_curvelength
length of the curve in real space
Definition: CurveMesh.h:152
NekDouble EvaluateDS(NekDouble s)
evaluate paramter ds at curve location s
Definition: CurveMesh.cpp:212
NekDouble EvaluatePS(NekDouble s)
evaluate paramter ps at curve location s
Definition: CurveMesh.cpp:251
std::vector< std::vector< NekDouble > > m_dst
array of function ds evaluations
Definition: CurveMesh.h:158
std::vector< NekDouble > meshsvalue
paramteric coordiates of the mesh nodes
Definition: CurveMesh.h:169
boost::shared_ptr< CADCurve > CADCurveSharedPtr
Definition: CADCurve.h:194