36 #ifndef NEKMESHUTILS_MESHELEMENTS_NODE
37 #define NEKMESHUTILS_MESHELEMENTS_NODE
41 #ifdef NEKTAR_USE_MESHGEN
48 namespace NekMeshUtils
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));
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;
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]);
207 NekDouble cosw = (va[0] * vb[0] + va[1] * vb[1] + va[2] * vb[2]) * aw;
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];
213 NekDouble lcn = sqrt(cn[0] * cn[0] + cn[1] * cn[1] + cn[2] * cn[2]);
220 an += 6.2831853071796;
225 #ifdef NEKTAR_USE_MESHGEN // fucntions for cad information
229 CADCurveList[i] = std::pair<CADCurveSharedPtr, NekDouble>(c, t);
235 std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> >(s, uv);
240 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> >
::iterator
241 search = CADCurveList.find(i);
242 ASSERTL0(search->first == i,
"node not on this curve");
244 return search->second.first;
249 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
::
250 iterator search = CADSurfList.find(i);
251 ASSERTL0(search->first == i,
"surface not found");
253 return search->second.first;
258 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> >
::iterator
259 search = CADCurveList.find(i);
260 ASSERTL0(search->first == i,
"node not on this curve");
262 return search->second.second;
265 Array<OneD, NekDouble> GetCADSurfInfo(
int i)
267 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
::
268 iterator search = CADSurfList.find(i);
269 ASSERTL0(search->first == i,
"surface not found");
271 return search->second.second;
274 std::vector<std::pair<int, CADSurfSharedPtr> > GetCADSurfs()
276 std::vector<std::pair<int, CADSurfSharedPtr> > lst;
277 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
::
279 for (s = CADSurfList.begin(); s != CADSurfList.end(); s++)
282 std::pair<int, CADSurfSharedPtr>(s->first, s->second.first));
289 return CADCurveList.size();
294 return CADSurfList.size();
297 void Move(Array<OneD, NekDouble> l,
int s, Array<OneD, NekDouble> uv)
304 std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> >(su, uv);
318 #ifdef NEKTAR_USE_MESHGEN // tag to tell the meshelemnets to include cad
321 std::map<int, std::pair<CADCurveSharedPtr, NekDouble> > CADCurveList;
323 std::map<int, std::pair<CADSurfSharedPtr, Array<OneD, NekDouble> > >
333 NodeSharedPtr
const &p2);
335 NodeSharedPtr
const &p2);
337 NodeSharedPtr
const &p2);
338 std::ostream &
operator<<(std::ostream &os,
const NodeSharedPtr &n);
346 struct NodeHash : std::unary_function<NodeSharedPtr, std::size_t>
350 std::size_t seed = 0;
351 boost::hash_combine(seed, p->m_x);
352 boost::hash_combine(seed, p->m_y);
353 boost::hash_combine(seed, p->m_z);
357 typedef boost::unordered_set<NodeSharedPtr, NodeHash>
NodeSet;
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)
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
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;.
bool operator==(ElmtConfig const &c1, ElmtConfig const &c2)
NEKMESHUTILS_EXPORT ~Node()
NEKMESHUTILS_EXPORT Node operator/(const NekDouble &alpha) const
NekDouble m_y
Y-coordinate.
NEKMESHUTILS_EXPORT void operator*=(const NekDouble &alpha)
Defines a hash function for nodes.
boost::unordered_set< NodeSharedPtr, NodeHash > NodeSet
Represents a point in the domain.
NEKMESHUTILS_EXPORT Node operator*(const NekDouble &alpha) const
NEKMESHUTILS_EXPORT NekDouble abs2() const
bool operator!=(NodeSharedPtr const &p1, NodeSharedPtr const &p2)
NEKMESHUTILS_EXPORT void operator/=(const NekDouble &alpha)
NEKMESHUTILS_EXPORT void SetID(int pId)
Reset the local id;.
boost::shared_ptr< Node > NodeSharedPtr
NEKMESHUTILS_EXPORT Node curl(const Node &pSrc) const
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.
std::ostream & operator<<(std::ostream &os, const NodeSharedPtr &n)
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.
NEKMESHUTILS_EXPORT void operator+=(const Node &pSrc)
#define NEKMESHUTILS_EXPORT
NEKMESHUTILS_EXPORT Node operator*(const Node &pSrc) const
NekDouble m_z
Z-coordinate.
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
boost::shared_ptr< PointGeom > PointGeomSharedPtr
NEKMESHUTILS_EXPORT Array< OneD, NekDouble > GetLoc()
boost::shared_ptr< CADCurve > CADCurveSharedPtr