Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Private Attributes | List of all members
Nektar::NekMeshUtils::Node Class Reference

Represents a point in the domain. More...

#include <Node.h>

Public Member Functions

NEKMESHUTILS_EXPORT Node (int pId, NekDouble pX, NekDouble pY, NekDouble pZ)
 Create a new node at a specified coordinate. More...
 
NEKMESHUTILS_EXPORT Node ()
 Copy an existing node. More...
 
NEKMESHUTILS_EXPORT ~Node ()
 
NEKMESHUTILS_EXPORT void SetID (int pId)
 Reset the local id;. More...
 
NEKMESHUTILS_EXPORT int GetID (void)
 Get the local id;. More...
 
NEKMESHUTILS_EXPORT bool operator< (const Node &pSrc)
 Define node ordering based on ID. More...
 
NEKMESHUTILS_EXPORT bool operator== (const Node &pSrc)
 Define node equality based on coordinate. More...
 
NEKMESHUTILS_EXPORT Node operator+ (const Node &pSrc) const
 
NEKMESHUTILS_EXPORT Node operator- (const Node &pSrc) const
 
NEKMESHUTILS_EXPORT Node operator* (const Node &pSrc) const
 
NEKMESHUTILS_EXPORT Node operator* (const NekDouble &alpha) const
 
NEKMESHUTILS_EXPORT Node operator/ (const NekDouble &alpha) const
 
NEKMESHUTILS_EXPORT void operator+= (const Node &pSrc)
 
NEKMESHUTILS_EXPORT void operator*= (const NekDouble &alpha)
 
NEKMESHUTILS_EXPORT void operator/= (const NekDouble &alpha)
 
NEKMESHUTILS_EXPORT NekDouble abs2 () const
 
NEKMESHUTILS_EXPORT NekDouble dot (const Node &pSrc) const
 
NEKMESHUTILS_EXPORT Node curl (const Node &pSrc) const
 
NEKMESHUTILS_EXPORT Array
< OneD, NekDouble
GetLoc ()
 
NEKMESHUTILS_EXPORT
SpatialDomains::PointGeomSharedPtr 
GetGeom (int coordDim)
 Generate a SpatialDomains::PointGeom for this node. More...
 
NEKMESHUTILS_EXPORT NekDouble Distance (NodeSharedPtr &p)
 
NEKMESHUTILS_EXPORT NekDouble Angle (NodeSharedPtr &a, NodeSharedPtr &b)
 

Public Attributes

int m_id
 ID of node. More...
 
NekDouble m_x
 X-coordinate. More...
 
NekDouble m_y
 Y-coordinate. More...
 
NekDouble m_z
 Z-coordinate. More...
 

Private Attributes

SpatialDomains::PointGeomSharedPtr m_geom
 

Detailed Description

Represents a point in the domain.

Such points may either be element vertices, or simply control points on high-order edges/faces, although this information is not contained within this class.

Definition at line 60 of file Node.h.

Constructor & Destructor Documentation

NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Node::Node ( int  pId,
NekDouble  pX,
NekDouble  pY,
NekDouble  pZ 
)
inline

Create a new node at a specified coordinate.

Definition at line 64 of file Node.h.

65  : m_id(pId), m_x(pX), m_y(pY), m_z(pZ), m_geom()
66  {
67  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
SpatialDomains::PointGeomSharedPtr m_geom
Definition: Node.h:328
NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Node::Node ( )
inline

Copy an existing node.

Definition at line 72 of file Node.h.

Referenced by curl(), operator*(), operator+(), operator-(), and operator/().

72  : m_id(0), m_x(0.0), m_y(0.0), m_z(0.0), m_geom()
73  {
74  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
SpatialDomains::PointGeomSharedPtr m_geom
Definition: Node.h:328
NEKMESHUTILS_EXPORT Nektar::NekMeshUtils::Node::~Node ( )
inline

Definition at line 75 of file Node.h.

76  {
77  }

Member Function Documentation

NEKMESHUTILS_EXPORT NekDouble Nektar::NekMeshUtils::Node::abs2 ( ) const
inline

Definition at line 148 of file Node.h.

References m_x, m_y, and m_z.

Referenced by Nektar::Utilities::ProcessSpherigon::GenerateNormals(), Nektar::Utilities::ProcessPerAlign::Process(), and Nektar::Utilities::ProcessSpherigon::Process().

149  {
150  return m_x * m_x + m_y * m_y + m_z * m_z;
151  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT NekDouble Nektar::NekMeshUtils::Node::Angle ( NodeSharedPtr a,
NodeSharedPtr b 
)
inline

Definition at line 192 of file Node.h.

References m_x, m_y, and m_z.

193  {
194  Array<OneD, NekDouble> va(3), vb(3), cn(3);
195  va[0] = a->m_x - m_x;
196  va[1] = a->m_y - m_y;
197  va[2] = a->m_z - m_z;
198  vb[0] = b->m_x - m_x;
199  vb[1] = b->m_y - m_y;
200  vb[2] = b->m_z - m_z;
201 
202  NekDouble lva = sqrt(va[0] * va[0] + va[1] * va[1] + va[2] * va[2]);
203  NekDouble lvb = sqrt(vb[0] * vb[0] + vb[1] * vb[1] + vb[2] * vb[2]);
204 
205  NekDouble aw = 1.0 / (lva * lvb);
206 
207  NekDouble cosw = (va[0] * vb[0] + va[1] * vb[1] + va[2] * vb[2]) * aw;
208 
209  cn[0] = vb[1] * va[2] - vb[2] * va[1];
210  cn[1] = vb[2] * va[0] - vb[0] * va[2];
211  cn[2] = vb[0] * va[1] - vb[1] * va[0];
212 
213  NekDouble lcn = sqrt(cn[0] * cn[0] + cn[1] * cn[1] + cn[2] * cn[2]);
214 
215  NekDouble sinw = aw * lcn;
216 
217  NekDouble an = atan2(sinw, cosw);
218 
219  if (an < 0)
220  an += 6.2831853071796;
221 
222  return an;
223  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
double NekDouble
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT Node Nektar::NekMeshUtils::Node::curl ( const Node pSrc) const
inline

Definition at line 158 of file Node.h.

References m_id, m_x, m_y, m_z, and Node().

Referenced by Nektar::Utilities::InputTec::SortEdgeNodes(), Nektar::Utilities::InputStar::SortEdgeNodes(), Nektar::Utilities::InputTec::SortFaceNodes(), and Nektar::Utilities::InputStar::SortFaceNodes().

159  {
160  return Node(m_id,
161  m_y * pSrc.m_z - m_z * pSrc.m_y,
162  m_z * pSrc.m_x - m_x * pSrc.m_z,
163  m_x * pSrc.m_y - m_y * pSrc.m_x);
164  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
Definition: Node.h:72
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT NekDouble Nektar::NekMeshUtils::Node::Distance ( NodeSharedPtr p)
inline

Definition at line 185 of file Node.h.

References m_x, m_y, and m_z.

186  {
187  return sqrt((m_x - p->m_x) * (m_x - p->m_x) +
188  (m_y - p->m_y) * (m_y - p->m_y) +
189  (m_z - p->m_z) * (m_z - p->m_z));
190  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT NekDouble Nektar::NekMeshUtils::Node::dot ( const Node pSrc) const
inline

Definition at line 153 of file Node.h.

References m_x, m_y, and m_z.

Referenced by Nektar::Utilities::ProcessSpherigon::Process(), Nektar::Utilities::InputTec::SortEdgeNodes(), Nektar::Utilities::InputStar::SortEdgeNodes(), Nektar::Utilities::InputTec::SortFaceNodes(), and Nektar::Utilities::InputStar::SortFaceNodes().

154  {
155  return m_x * pSrc.m_x + m_y * pSrc.m_y + m_z * pSrc.m_z;
156  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT SpatialDomains::PointGeomSharedPtr Nektar::NekMeshUtils::Node::GetGeom ( int  coordDim)
inline

Generate a SpatialDomains::PointGeom for this node.

Definition at line 176 of file Node.h.

References Nektar::MemoryManager< DataType >::AllocateSharedPtr(), m_id, m_x, m_y, and m_z.

177  {
180  coordDim, m_id, m_x, m_y, m_z);
181 
182  return ret;
183  }
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
boost::shared_ptr< PointGeom > PointGeomSharedPtr
Definition: Geometry.h:60
NEKMESHUTILS_EXPORT int Nektar::NekMeshUtils::Node::GetID ( void  )
inline

Get the local id;.

Definition at line 86 of file Node.h.

References m_id.

87  {
88  return m_id;
89  }
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Array<OneD, NekDouble> Nektar::NekMeshUtils::Node::GetLoc ( )
inline

Definition at line 166 of file Node.h.

References m_x, m_y, and m_z.

167  {
168  Array<OneD, NekDouble> out(3);
169  out[0] = m_x;
170  out[1] = m_y;
171  out[2] = m_z;
172  return out;
173  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT Node Nektar::NekMeshUtils::Node::operator* ( const Node pSrc) const
inline

Definition at line 112 of file Node.h.

References m_id, m_x, m_y, m_z, and Node().

113  {
114  return Node(m_id, m_x * pSrc.m_x, m_y * pSrc.m_y, m_z * pSrc.m_z);
115  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
Definition: Node.h:72
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT Node Nektar::NekMeshUtils::Node::operator* ( const NekDouble alpha) const
inline

Definition at line 117 of file Node.h.

References m_id, m_x, m_y, m_z, and Node().

118  {
119  return Node(m_id, alpha * m_x, alpha * m_y, alpha * m_z);
120  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
Definition: Node.h:72
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Node::operator*= ( const NekDouble alpha)
inline

Definition at line 134 of file Node.h.

References m_x, m_y, and m_z.

135  {
136  m_x *= alpha;
137  m_y *= alpha;
138  m_z *= alpha;
139  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT Node Nektar::NekMeshUtils::Node::operator+ ( const Node pSrc) const
inline

Definition at line 102 of file Node.h.

References m_id, m_x, m_y, m_z, and Node().

103  {
104  return Node(m_id, m_x + pSrc.m_x, m_y + pSrc.m_y, m_z + pSrc.m_z);
105  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
Definition: Node.h:72
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Node::operator+= ( const Node pSrc)
inline

Definition at line 127 of file Node.h.

References m_x, m_y, and m_z.

128  {
129  m_x += pSrc.m_x;
130  m_y += pSrc.m_y;
131  m_z += pSrc.m_z;
132  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT Node Nektar::NekMeshUtils::Node::operator- ( const Node pSrc) const
inline

Definition at line 107 of file Node.h.

References m_id, m_x, m_y, m_z, and Node().

108  {
109  return Node(m_id, m_x - pSrc.m_x, m_y - pSrc.m_y, m_z - pSrc.m_z);
110  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
Definition: Node.h:72
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT Node Nektar::NekMeshUtils::Node::operator/ ( const NekDouble alpha) const
inline

Definition at line 122 of file Node.h.

References m_id, m_x, m_y, m_z, and Node().

123  {
124  return Node(m_id, m_x / alpha, m_y / alpha, m_z / alpha);
125  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
Definition: Node.h:72
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Node::operator/= ( const NekDouble alpha)
inline

Definition at line 141 of file Node.h.

References m_x, m_y, and m_z.

142  {
143  m_x /= alpha;
144  m_y /= alpha;
145  m_z /= alpha;
146  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::Node::operator< ( const Node pSrc)
inline

Define node ordering based on ID.

Definition at line 92 of file Node.h.

References m_id.

93  {
94  return (m_id < pSrc.m_id);
95  }
int m_id
ID of node.
Definition: Node.h:310
NEKMESHUTILS_EXPORT bool Nektar::NekMeshUtils::Node::operator== ( const Node pSrc)
inline

Define node equality based on coordinate.

Definition at line 97 of file Node.h.

References m_x, m_y, and m_z.

98  {
99  return m_x == pSrc.m_x && m_y == pSrc.m_y && m_z == pSrc.m_z;
100  }
NekDouble m_y
Y-coordinate.
Definition: Node.h:314
NekDouble m_x
X-coordinate.
Definition: Node.h:312
NekDouble m_z
Z-coordinate.
Definition: Node.h:316
NEKMESHUTILS_EXPORT void Nektar::NekMeshUtils::Node::SetID ( int  pId)
inline

Reset the local id;.

Definition at line 80 of file Node.h.

References m_id.

81  {
82  m_id = pId;
83  }
int m_id
ID of node.
Definition: Node.h:310

Member Data Documentation

SpatialDomains::PointGeomSharedPtr Nektar::NekMeshUtils::Node::m_geom
private

Definition at line 328 of file Node.h.

int Nektar::NekMeshUtils::Node::m_id
NekDouble Nektar::NekMeshUtils::Node::m_x
NekDouble Nektar::NekMeshUtils::Node::m_y
NekDouble Nektar::NekMeshUtils::Node::m_z