36 #ifndef NEKMESHUTILS_MESHELEMENTS_NODE
37 #define NEKMESHUTILS_MESHELEMENTS_NODE
48 namespace NekMeshUtils
192 return sqrt((
m_x - p->m_x) * (
m_x - p->m_x) +
193 (
m_y - p->m_y) * (
m_y - p->m_y) +
194 (
m_z - p->m_z) * (
m_z - p->m_z));
200 va[0] = a->m_x -
m_x;
201 va[1] = a->m_y -
m_y;
202 va[2] = a->m_z -
m_z;
203 vb[0] = b->m_x -
m_x;
204 vb[1] = b->m_y -
m_y;
205 vb[2] = b->m_z -
m_z;
207 NekDouble lva = sqrt(va[0] * va[0] + va[1] * va[1] + va[2] * va[2]);
208 NekDouble lvb = sqrt(vb[0] * vb[0] + vb[1] * vb[1] + vb[2] * vb[2]);
212 NekDouble cosw = (va[0] * vb[0] + va[1] * vb[1] + va[2] * vb[2]) * aw;
214 cn[0] = vb[1] * va[2] - vb[2] * va[1];
215 cn[1] = vb[2] * va[0] - vb[0] * va[2];
216 cn[2] = vb[0] * va[1] - vb[1] * va[0];
218 NekDouble lcn = sqrt(cn[0] * cn[0] + cn[1] * cn[1] + cn[2] * cn[2]);
225 an += 6.2831853071796;
234 CADCurveList[i] = std::pair<CADCurveSharedPtr, NekDouble>(c, t);
240 std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> >(s, uv);
245 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> >
::iterator
247 ASSERTL0(search->first == i,
"node not on this curve");
249 return search->second.first;
254 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
::
256 ASSERTL0(search->first == i,
"surface not found");
258 return search->second.first;
263 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> >
::iterator
265 ASSERTL0(search->first == i,
"node not on this curve");
267 return search->second.second;
272 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
::
274 ASSERTL0(search->first == i,
"surface not found");
276 return search->second.second;
281 std::vector<std::pair<int, CADCurveSharedPtr> > lst;
282 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> >
::iterator c;
286 std::pair<int, CADCurveSharedPtr>(c->first, c->second.first));
293 std::vector<std::pair<int, CADSurfSharedPtr> > lst;
299 std::pair<int, CADSurfSharedPtr>(s->first, s->second.first));
321 std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> >(su, uv);
330 CADCurveList[s] = std::pair<CADCurveSharedPtr, NekDouble>(cu, t);
335 std::vector<std::pair<int, std::string> > ret;
336 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> >
::iterator c;
339 std::stringstream ss;
340 ss << std::scientific << std::setprecision(8);
341 ss << c->second.second;
342 ret.push_back(std::pair<int, std::string>(c->first, ss.str()));
349 std::vector<std::pair<int, std::string> > ret;
354 std::stringstream ss;
355 ss << std::scientific << std::setprecision(8);
356 ss << s->second.second[0] <<
" " << s->second.second[1];
357 ret.push_back(std::pair<int, std::string>(s->first, ss.str()));
368 A[0] = locA[0] -
m_x;
369 A[1] = locA[1] -
m_y;
370 A[2] = locA[2] -
m_z;
371 B[0] = locB[0] -
m_x;
372 B[1] = locB[1] -
m_y;
373 B[2] = locB[2] -
m_z;
375 CP[0] =
A[1] * B[2] -
A[2] * B[1];
376 CP[1] = -1.0 * (
A[0] * B[2] -
A[2] * B[0]);
377 CP[2] =
A[0] * B[1] -
A[1] * B[0];
379 NekDouble ang = sqrt(CP[0] * CP[0] + CP[1] * CP[1] + CP[2] * CP[2]);
381 ang /= sqrt(
A[0] *
A[0] +
A[1] *
A[1] +
A[2] *
A[2]);
382 ang /= sqrt(B[0] * B[0] + B[1] * B[1] + B[2] * B[2]);
384 NekDouble dot = N[0] * CP[0] + N[1] * CP[1] + N[2] * CP[2];
390 ang = 2.0 * M_PI -
ang;
408 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
417 NodeSharedPtr
const &p2);
419 NodeSharedPtr
const &p2);
421 NodeSharedPtr
const &p2);
422 std::ostream &
operator<<(std::ostream &os,
const NodeSharedPtr &n);
430 struct NodeHash : std::unary_function<NodeSharedPtr, std::size_t>
434 std::size_t seed = 0;
435 boost::hash_combine(seed, p->m_x);
436 boost::hash_combine(seed, p->m_y);
437 boost::hash_combine(seed, p->m_z);
441 typedef boost::unordered_set<NodeSharedPtr, NodeHash>
NodeSet;
static NekDouble ang(NekDouble x, NekDouble y)
bool operator<(NodeSharedPtr const &p1, NodeSharedPtr const &p2)
Defines ordering between two NodeSharedPtr objects.
NEKMESHUTILS_EXPORT SpatialDomains::PointGeomSharedPtr GetGeom(int coordDim)
Generate a SpatialDomains::PointGeom for this node.
NEKMESHUTILS_EXPORT NekDouble dot(const Node &pSrc) const
NEKMESHUTILS_EXPORT NekDouble Angle(NodeSharedPtr &a, NodeSharedPtr &b)
#define ASSERTL0(condition, msg)
void MoveCurve(Array< OneD, NekDouble > l, int s, NekDouble t)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
std::vector< std::pair< int, std::string > > GetCADSurfInfoVector()
std::size_t operator()(NodeSharedPtr const &p) const
NEKMESHUTILS_EXPORT bool operator<(const Node &pSrc)
Define node ordering based on ID.
NEKMESHUTILS_EXPORT int GetID(void)
Get the local id;.
NEKMESHUTILS_EXPORT ~Node()
NEKMESHUTILS_EXPORT Node operator/(const NekDouble &alpha) const
NekDouble m_y
Y-coordinate.
NEKMESHUTILS_EXPORT void operator*=(const NekDouble &alpha)
std::vector< std::pair< int, std::string > > GetCADCurveInfoVector()
Defines a hash function for nodes.
void Move(Array< OneD, NekDouble > l, int s, Array< OneD, NekDouble > uv)
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Represents a point in the domain.
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
Compares two element config structs.
NEKMESHUTILS_EXPORT Node operator*(const NekDouble &alpha) const
NEKMESHUTILS_EXPORT NekDouble abs2() const
void SetCADSurf(int i, CADSurfSharedPtr s, Array< OneD, NekDouble > uv)
bool operator!=(NodeSharedPtr const &p1, NodeSharedPtr const &p2)
Compares two nodes for inequality based on IDs.
NEKMESHUTILS_EXPORT void operator/=(const NekDouble &alpha)
NEKMESHUTILS_EXPORT void SetID(int pId)
Reset the local id;.
CADCurveSharedPtr GetCADCurve(int i)
boost::shared_ptr< Node > NodeSharedPtr
NEKMESHUTILS_EXPORT Node curl(const Node &pSrc) const
NEKMESHUTILS_EXPORT NodeSharedPtr copy()
NEKMESHUTILS_EXPORT Node operator+(const Node &pSrc) const
NEKMESHUTILS_EXPORT bool operator==(const Node &pSrc)
Define node equality based on coordinate.
NEKMESHUTILS_EXPORT Node()
Copy an existing node.
NekDouble Angle(Array< OneD, NekDouble > locA, Array< OneD, NekDouble > locB, Array< OneD, NekDouble > N)
std::map< int, std::pair< CADSurfSharedPtr, Array< OneD, NekDouble > > > CADSurfList
list of cadsurfs the node lies on
std::ostream & operator<<(std::ostream &os, const NodeSharedPtr &n)
Print description of node to given ostream.
boost::shared_ptr< CADSurf > CADSurfSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
NEKMESHUTILS_EXPORT NekDouble Distance(NodeSharedPtr &p)
NekDouble m_x
X-coordinate.
std::map< int, std::pair< CADCurveSharedPtr, NekDouble > > CADCurveList
list of cadcurves the node lies on
NEKMESHUTILS_EXPORT void operator+=(const Node &pSrc)
#define NEKMESHUTILS_EXPORT
CADSurfSharedPtr GetCADSurf(int i)
NekDouble GetCADCurveInfo(int i)
std::vector< std::pair< int, CADCurveSharedPtr > > GetCADCurves()
Array< OneD, NekDouble > GetCADSurfInfo(int i)
NEKMESHUTILS_EXPORT Node operator*(const Node &pSrc) const
NekDouble m_z
Z-coordinate.
void SetCADCurve(int i, CADCurveSharedPtr c, NekDouble t)
NEKMESHUTILS_EXPORT Node operator-(const Node &pSrc) const
NEKMESHUTILS_EXPORT Node(int pId, NekDouble pX, NekDouble pY, NekDouble pZ)
Create a new node at a specified coordinate.
SpatialDomains::PointGeomSharedPtr m_geom
std::vector< std::pair< int, CADSurfSharedPtr > > GetCADSurfs()
boost::shared_ptr< PointGeom > PointGeomSharedPtr
NEKMESHUTILS_EXPORT Array< OneD, NekDouble > GetLoc()
boost::shared_ptr< CADCurve > CADCurveSharedPtr