GPUE  v1.0
GPU Gross-Pitaevskii Equation numerical solver for Bose-Einstein condensates
edge.h
Go to the documentation of this file.
1 //##############################################################################
16  //##############################################################################
17 
18 #ifndef LATTICEGRAPH_EDGE_H
19 #define LATTICEGRAPH_EDGE_H
20 
21 #include <cstdlib>
22 #include <cmath>
23 #include <algorithm>
24 #include <vector>
25 #include "node.h"
26 
27 namespace LatticeGraph {
28 
29  class Node;
30  class Edge {
31 
32 
33  private:
34  static unsigned int suid; //Incremented id for new
35 
36  std::weak_ptr<Node> n1, n2; //Points to the connected nodes
37 
38  int direction; //1 n1->n2, 0 undirected, -1 n2->n1
39 
40  double weight; // 0.0 if not relevant, otherwise +/- reals
41 
42  public:
43  unsigned int uid;
48  Edge();
53  ~Edge();
54 
61  Edge(std::weak_ptr<Node> n1, std::weak_ptr<Node> n2);
70  Edge(std::weak_ptr<Node> n1, std::weak_ptr<Node> n2, int dir, double weight);
71 
72  //##############################################################################
73 
79  unsigned int getUid();
85  unsigned int& getSuid();
91  int getDirection();
97  double getWeight();
104  std::weak_ptr<Node> getVortex(int idx);
105 
106  //##############################################################################
107 
113  void setDirection(int direction);
119  void setWeight(double weight);
120 
121  //##############################################################################
122 
129  void updateVortex(int idx, std::weak_ptr<Node> n_new);
130 
131  //##############################################################################
132 
138  bool isMember(std::weak_ptr<Node> n);
139 
140  //##############################################################################
141 
147  bool operator < (std::shared_ptr<Edge> e) const{
148  return uid < e->getUid();
149  }
150  };
151 }
152 #endif //LATTICEGRAPH_EDGE_H
void setWeight(double weight)
Set the weight of the edge.
unsigned int uid
Definition: edge.h:43
bool isMember(std::weak_ptr< Node > n)
Checks to see if vortex/node n is on edge.
Allow vortex to be treated as node in a graph.
void setDirection(int direction)
Set the direction of the edge.
vtxLost idx
Definition: loadVtx.m:15
std::weak_ptr< Node > getVortex(int idx)
Returns connected vortices (nodes)
unsigned int & getSuid()
Returns static UID value for use in new edge UID.
Edge()
Makes stuff exist.
double getWeight()
Returns the weight of an edge. 0 if unweighted.
unsigned int getUid()
Returns edge UID.
void updateVortex(int idx, std::weak_ptr< Node > n_new)
Updates the connected vortex at either side of edge.
int getDirection()
Returns direction of edge. 1 n1->n2,;-1 n2->n1; 0 undirected.
~Edge()
Makes stuff anti-exist.