GPUE  v1.0
GPU Gross-Pitaevskii Equation numerical solver for Bose-Einstein condensates
node.h
Go to the documentation of this file.
1 //##############################################################################
16  //##############################################################################
17 
18 #ifndef LATTICEGRAPH_NODE_H
19 #define LATTICEGRAPH_NODE_H
20 
21 #include <cstdlib>
22 #include <cmath>
23 #include <memory>
24 #include <vector>
25 #include "edge.h"
26 #include "tracker.h"
27 
28 //##############################################################################
29 
30 namespace LatticeGraph {
31  class Edge;
32  class Node {
33 
34  private:
35  static unsigned int suid;
36  Vtx::Vortex data;
37  std::vector<std::weak_ptr <Edge> > edges; //all connected edges
38 
39  public:
40  unsigned int uid;
41 
42  Node();
43  ~Node();
44 
45  Node(Vtx::Vortex &data);
46 
47 //##############################################################################
48 
54  unsigned int getUid();
60  unsigned int& getSuid();
72  std::vector<std::weak_ptr <Edge> > &getEdges();
79  std::weak_ptr<Edge> getEdge(int idx);
86  std::shared_ptr<Node> getConnectedNode(std::shared_ptr<Edge> e);
92  void getConnectedNodes(unsigned int &nodes);
93 
94 //##############################################################################
95 
101  void setData(Vtx::Vortex &data);
102 
103 //##############################################################################
104  //void addEdge(std::shared_ptr<Node> n, int dir, double weight);
105 
111  void addEdge(std::weak_ptr<Edge> e);
112 
113 //##############################################################################
114 
120  void removeEdge(std::shared_ptr<Node> n);
126  void removeEdgeUid(unsigned int uid);
132  void removeEdgeIdx(unsigned int idx);
138  void removeEdge(std::weak_ptr<Edge> e);
143  void removeEdges();
144 
145 //##############################################################################
146  };
147 }
148 #endif //LATTICEGRAPH_NODE_H
void removeEdgeIdx(unsigned int idx)
Remove edge with index idx.
void removeEdge(std::shared_ptr< Node > n)
Remove edge connecting this to Node n.
vtxLost idx
Definition: loadVtx.m:15
unsigned int & getSuid()
Get vortex (node) static UID for new UID generation.
Vortex lattice position, orientation, and tracking.
Vtx::Vortex & getData()
Get vortex (node) data struct.
unsigned int getUid()
Get vortex (node) UID.
void removeEdges()
Remove all connected edges.
void getConnectedNodes(unsigned int &nodes)
Get all connected nodes to the current vortex. PassByRef.
std::shared_ptr< Node > getConnectedNode(std::shared_ptr< Edge > e)
Get the node on the other side of the edge e.
std::weak_ptr< Edge > getEdge(int idx)
Get edge at index idx. Assumes indices exist.
unsigned int uid
Definition: node.h:40
void addEdge(std::weak_ptr< Edge > e)
Add edge e to the current vortex (node)
void setData(Vtx::Vortex &data)
Set the vortex data (in node)
std::vector< std::weak_ptr< Edge > > & getEdges()
Get all connected edges to vortex (node)
void removeEdgeUid(unsigned int uid)
Remove edge with UID uid.
Class for creating edges between adjacent vortices in graph.