Nektar++
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 // 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: object for individual curve meshes.
32 //
33 ////////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_MESHUTILS_SURFACEMESHING_CURVEMESH_H
36 #define NEKTAR_MESHUTILS_SURFACEMESHING_CURVEMESH_H
37 
41 
45 
46 namespace Nektar
47 {
48 namespace NekMeshUtils
49 {
50 
51 class CurveMesh;
52 typedef std::shared_ptr<CurveMesh> CurveMeshSharedPtr;
53 
54 /**
55  * @brief class for meshing individual curves (1d meshing)
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(bool forceThree = false);
82 
83  /**
84  * @brief Delete old mesh and mesh with forceThree on
85  */
86  void ReMesh();
87 
88  /**
89  * @brief get id of first node
90  */
92  {
93  return m_meshpoints[0];
94  }
95 
96  /**
97  * @brief get id of last node
98  */
100  {
101  return m_meshpoints.back();
102  }
103 
104  /**
105  * @brief get list of mesh nodes
106  */
107  std::vector<NodeSharedPtr> GetMeshPoints()
108  {
109  return m_meshpoints;
110  }
111 
112  std::vector<EdgeSharedPtr> GetMeshEdges()
113  {
114  return m_meshedges;
115  }
116 
117  /**
118  * @brief get the number of points in the curve
119  */
121  {
122  return m_meshpoints.size();
123  }
124 
125  /**
126  * @brief get the length of the curve
127  */
129  {
130  return m_curvelength;
131  }
132 
133  void PeriodicOverwrite(CurveMeshSharedPtr from);
134 
135  int GetId()
136  {
137  return m_id;
138  }
139 
140  void SetOffset(unsigned i, NekDouble offset)
141  {
142  m_endoffset[i] = offset;
143  }
144 
145 private:
146  /**
147  * @brief get node spacing sampling function
148  */
149  void GetSampleFunction();
150 
151  /**
152  * @brief get node spacing phi function
153  */
154  void GetPhiFunction();
155 
156  /**
157  * @brief evaluate paramter ds at curve location s
158  */
160 
161  /**
162  * @brief evaluate paramter ps at curve location s
163  */
165 
166  /// CAD curve
168  /// length of the curve in real space
170  /// number of sampling points used in algorithm
172  /// coords of the ends of the parametric curve
174  /// array of function ds evaluations
175  std::vector<std::vector<NekDouble> > m_dst;
176  /// array of function ps evaluations
177  std::vector<std::vector<NekDouble> > m_ps;
178  /// spacing function evaluation
180  /// ds
182  /// number of edges to be made in the curve as defined by the spacing
183  /// funtion
184  int Ne;
185  /// paramteric coordiates of the mesh nodes
186  std::vector<NekDouble> meshsvalue;
187  /// list of mesh edges in the curvemesh
188  std::vector<EdgeSharedPtr> m_meshedges;
189  /// id of the curvemesh
190  int m_id;
191  ///
193  /// ids of the mesh nodes
194  std::vector<NodeSharedPtr> m_meshpoints;
196  int m_blID;
197  /// offset of second point at each end
198  std::map<unsigned, NekDouble> m_endoffset;
199 };
200 
201 }
202 }
203 
204 #endif
void GetSampleFunction()
get node spacing sampling function
Definition: CurveMesh.cpp:353
NekDouble GetLength()
get the length of the curve
Definition: CurveMesh.h:128
Array< OneD, NekDouble > m_bounds
coords of the ends of the parametric curve
Definition: CurveMesh.h:173
LibUtilities::Interpreter m_bl
Definition: CurveMesh.h:195
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
int m_numSamplePoints
number of sampling points used in algorithm
Definition: CurveMesh.h:171
std::vector< std::vector< NekDouble > > m_ps
array of function ps evaluations
Definition: CurveMesh.h:177
std::map< unsigned, NekDouble > m_endoffset
offset of second point at each end
Definition: CurveMesh.h:198
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:179
class for meshing individual curves (1d meshing)
Definition: CurveMesh.h:57
std::shared_ptr< Mesh > MeshSharedPtr
Shared pointer to a mesh.
Definition: Mesh.h:156
std::shared_ptr< Node > NodeSharedPtr
Definition: CADVert.h:49
std::vector< EdgeSharedPtr > m_meshedges
list of mesh edges in the curvemesh
Definition: CurveMesh.h:188
std::vector< EdgeSharedPtr > GetMeshEdges()
Definition: CurveMesh.h:112
int m_id
id of the curvemesh
Definition: CurveMesh.h:190
void ReMesh()
Delete old mesh and mesh with forceThree on.
Definition: CurveMesh.cpp:44
std::vector< NodeSharedPtr > GetMeshPoints()
get list of mesh nodes
Definition: CurveMesh.h:107
std::shared_ptr< CADCurve > CADCurveSharedPtr
Definition: CADCurve.h:219
int Ne
number of edges to be made in the curve as defined by the spacing funtion
Definition: CurveMesh.h:184
std::vector< NodeSharedPtr > m_meshpoints
ids of the mesh nodes
Definition: CurveMesh.h:194
int GetNumPoints()
get the number of points in the curve
Definition: CurveMesh.h:120
double NekDouble
CADCurveSharedPtr m_cadcurve
CAD curve.
Definition: CurveMesh.h:167
void SetOffset(unsigned i, NekDouble offset)
Definition: CurveMesh.h:140
NodeSharedPtr GetLastPoint()
get id of last node
Definition: CurveMesh.h:99
Interpreter class for the evaluation of mathematical expressions.
Definition: Interpreter.h:77
NodeSharedPtr GetFirstPoint()
get id of first node
Definition: CurveMesh.h:91
void Mesh(bool forceThree=false)
execute meshing
Definition: CurveMesh.cpp:59
void GetPhiFunction()
get node spacing phi function
Definition: CurveMesh.cpp:245
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:169
NekDouble EvaluateDS(NekDouble s)
evaluate paramter ds at curve location s
Definition: CurveMesh.cpp:267
std::shared_ptr< CurveMesh > CurveMeshSharedPtr
Definition: CurveMesh.h:51
NekDouble EvaluatePS(NekDouble s)
evaluate paramter ps at curve location s
Definition: CurveMesh.cpp:306
std::vector< std::vector< NekDouble > > m_dst
array of function ds evaluations
Definition: CurveMesh.h:175
std::vector< NekDouble > meshsvalue
paramteric coordiates of the mesh nodes
Definition: CurveMesh.h:186
void PeriodicOverwrite(CurveMeshSharedPtr from)
Definition: CurveMesh.cpp:398