Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Line.cpp
Go to the documentation of this file.
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Line.cpp
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: Mesh manipulation objects.
33 //
34 ////////////////////////////////////////////////////////////////////////////////
35 
37 using namespace std;
38 
39 namespace Nektar
40 {
41 namespace NekMeshUtils
42 {
43 
44 LibUtilities::ShapeType Line::m_type =
46  LibUtilities::eSegment, Line::create, "Line");
47 
48 /**
49  * @brief Create a line element.
50  */
51 Line::Line(ElmtConfig pConf,
52  vector<NodeSharedPtr> pNodeList,
53  vector<int> pTagList)
54  : Element(pConf, GetNumNodes(pConf), pNodeList.size())
55 {
56  m_tag = "S";
57  m_dim = 1;
58  m_taglist = pTagList;
59  int n = m_conf.m_order - 1;
60 
61  // Add vertices
62  for (int i = 0; i < 2; ++i)
63  {
64  m_vertex.push_back(pNodeList[i]);
65  }
66  vector<NodeSharedPtr> edgeNodes;
67  if (m_conf.m_order > 1)
68  {
69  for (int j = 0; j < n; ++j)
70  {
71  edgeNodes.push_back(pNodeList[2 + j]);
72  }
73  }
74  m_edge.push_back(boost::shared_ptr<Edge>(new Edge(
75  pNodeList[0], pNodeList[1], edgeNodes, m_conf.m_edgeCurveType)));
76 }
77 
79 {
80  // Create edge vertices.
83 
84  p[0] = m_vertex[0]->GetGeom(coordDim);
85  p[1] = m_vertex[1]->GetGeom(coordDim);
86 
87  if (m_edge[0]->m_edgeNodes.size() > 0)
88  {
91  m_id, m_edge[0]->m_curveType);
92 
93  c->m_points.push_back(p[0]);
94  for (int i = 0; i < m_edge[0]->m_edgeNodes.size(); ++i)
95  {
96  c->m_points.push_back(m_edge[0]->m_edgeNodes[i]->GetGeom(coordDim));
97  }
98  c->m_points.push_back(p[1]);
99 
101  m_id, 2, p, c);
102  }
103  else
104  {
106  m_id, 2, p);
107  }
108 
109  return ret;
110 }
111 
112 /**
113  * @brief Return the number of nodes defining a line.
114  */
115 unsigned int Line::GetNumNodes(ElmtConfig pConf)
116 {
117  return pConf.m_order + 1;
118 }
119 }
120 }
Basic information about an element.
Definition: Element.h:58
Represents an edge which joins two points.
Definition: Edge.h:61
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
STL namespace.
ElementFactory & GetElementFactory()
Definition: Element.cpp:47
ElmtConfig m_conf
Contains configuration of the element.
Definition: Element.h:493
boost::shared_ptr< Curve > CurveSharedPtr
Definition: Curve.hpp:62
std::vector< int > m_taglist
List of integers specifying properties of the element.
Definition: Element.h:497
LibUtilities::PointsType m_edgeCurveType
Distribution of points in edges.
Definition: Element.h:101
unsigned int m_order
Order of the element.
Definition: Element.h:96
static NEKMESHUTILS_EXPORT unsigned int GetNumNodes(ElmtConfig pConf)
Return the number of nodes defining a line.
Definition: Line.cpp:115
std::vector< NodeSharedPtr > m_vertex
List of element vertex nodes.
Definition: Element.h:499
unsigned int m_dim
Dimension of the element.
Definition: Element.h:491
boost::shared_ptr< SegGeom > SegGeomSharedPtr
Definition: Geometry2D.h:60
std::vector< EdgeSharedPtr > m_edge
List of element edges.
Definition: Element.h:501
std::string m_tag
Tag character describing the element.
Definition: Element.h:495
virtual NEKMESHUTILS_EXPORT SpatialDomains::GeometrySharedPtr GetGeom(int coordDim)
Generate a Nektar++ geometry object for this element.
Definition: Line.cpp:78
unsigned int m_id
ID of the element.
Definition: Element.h:489
LibUtilities::PointsType m_curveType
Volume curve type.
Definition: Element.h:507
boost::shared_ptr< Geometry > GeometrySharedPtr
Definition: Geometry.h:53
boost::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:60
Base class for element definitions.
Definition: Element.h:115
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215