GPUE  v1.0
GPU Gross-Pitaevskii Equation numerical solver for Bose-Einstein condensates
lattice.h
Go to the documentation of this file.
1 //##############################################################################
16 //##############################################################################
17 
18 #ifndef LATTICEGRAPH_LATTICE_H
19 #define LATTICEGRAPH_LATTICE_H
20 
21 #include <cstdlib>
22 #include <cmath>
23 //#include <algorithm>
24 #include <vector>
25 #include "node.h"
26 #include "edge.h"
27 #include "tracker.h"
28 
29 namespace LatticeGraph {
30 
31  class Lattice {
32 
33  private:
34  std::vector <std::shared_ptr <Node> > vortices; //The vortices (nodes)
35  std::vector <std::shared_ptr <Edge> > edges; //The edges
36 
37  public:
42  Lattice();
47  ~Lattice();
48 
49 //##############################################################################
50 
56  std::vector <std::shared_ptr <Node> > &getVortices();
62  std::vector <std::shared_ptr <Edge> > &getEdges();
63 
64 //##############################################################################
65 
72  std::shared_ptr<Node> getVortexIdx(unsigned int idx);
79  std::shared_ptr<Edge> getEdgeIdx(unsigned int idx);
80 
81 //##############################################################################
82 
89  unsigned int getVortexIdxUid(unsigned int uid);
96  unsigned int getEdgeIdxUid(unsigned int uid);
97 
98 //##############################################################################
99 
107  std::shared_ptr<Node> getVortexUid(unsigned int uid);
115  std::shared_ptr<Edge> getEdgeUid(unsigned int uid);
116 
117 //##############################################################################
118 
126  double getVortexDistance(std::shared_ptr<Node> n1, std::shared_ptr<Node> n2);
134  double getVortexDistanceD(std::shared_ptr<Node> n1, std::shared_ptr<Node> n2);
135 
136 //##############################################################################
137 
144  void setVortex(unsigned int idx, std::shared_ptr<Node> n);
151  void setEdge(unsigned int idx, std::shared_ptr<Edge> e);
152 
153 //##############################################################################
154 
160  void addVortex(std::shared_ptr<Node> n);
166  void addEdge(std::shared_ptr<Edge> e);
173  void addEdge(std::shared_ptr<Node> n1, std::shared_ptr<Node> n2);
181  void addEdge(std::shared_ptr<Edge> e, std::shared_ptr<Node> n1, std::shared_ptr<Node> n2);
182 
183 //##############################################################################
184 
190  void removeVortex(std::shared_ptr<Node> n);
196  void removeVortexIdx(unsigned int idx);
202  void removeVortexUid(unsigned int uid);
203 
204 //##############################################################################
205 
212  void removeEdge(std::shared_ptr<Node> n1, std::shared_ptr<Node> n2);
218  void removeEdge(std::shared_ptr<Edge> e);
224  void removeEdgeUid(unsigned int uid);
230  void removeEdgeIdx(unsigned int idx);
236  void removeEdges(std::shared_ptr<Node> n1);
237 
238 
239 
247  void createVortex(double posx, double posy, int winding);
253  void destroyVortex(unsigned int uid);
254 
255 
256 
262  void createEdges(unsigned int radius);
268  void createEdges(double radius);
269 
270 //##############################################################################
271 
277  void genAdjMat(unsigned int *mat); //generate adjacency matrix
283  void genAdjMat(double *mat); //generate adjacency matrix
289  void adjMatMtca(unsigned int *mat);
295  void adjMatMtca(double *mat);
296 
297 //##############################################################################
298 
305  void swapIdxUid(unsigned int uid1, unsigned int uid2);
312  void swapIdx(unsigned int idx1, unsigned int idx2);
313 
314 //##############################################################################
315 
323  std::weak_ptr<Edge> isConnected(std::shared_ptr<Node> n1, std::shared_ptr<Node> n2);
324  };
325 }
326 #endif //LATTICEGRAPH_LATTICE_H
void createVortex(double posx, double posy, int winding)
Create a vortex at specified location with given winding.
Allow vortex to be treated as node in a graph.
std::vector< std::shared_ptr< Node > > & getVortices()
Returns the vectors for vortices.
void removeEdgeIdx(unsigned int idx)
Remove edge from the lattice based index idx.
unsigned int getEdgeIdxUid(unsigned int uid)
Returns edge index based on UID.
vtxLost idx
Definition: loadVtx.m:15
void swapIdxUid(unsigned int uid1, unsigned int uid2)
Swap the elements at indices based on UID uid1 and uid2.
~Lattice()
Makes stuff anti-exist.
void genAdjMat(unsigned int *mat)
Output adjacency matrix.
std::shared_ptr< Node > getVortexIdx(unsigned int idx)
Returns vortex specified at index idx.
Lattice()
Makes stuff exist.
void removeEdgeUid(unsigned int uid)
Remove edge from the lattice based on UID uid.
Vortex lattice position, orientation, and tracking.
void removeEdges(std::shared_ptr< Node > n1)
Remove all edges from vortex.
void removeVortex(std::shared_ptr< Node > n)
Remove vortex n from the lattice.
void removeVortexUid(unsigned int uid)
Remove vortex from the lattice based on UID uid.
void addVortex(std::shared_ptr< Node > n)
Add vortex (node) to the lattice (graph).
unsigned int getVortexIdxUid(unsigned int uid)
Returns vortex index based on UID.
std::vector< std::shared_ptr< Edge > > & getEdges()
Returns the edges for edges.
void setVortex(unsigned int idx, std::shared_ptr< Node > n)
Set vortex (node) at a specific position.
void removeVortexIdx(unsigned int idx)
Remove vortex from the lattice based on index idx.
std::shared_ptr< Edge > getEdgeUid(unsigned int uid)
Returns edge based on UID.
uid
Definition: vort.py:39
void adjMatMtca(unsigned int *mat)
Format adjacency matrix with Mathematica-friendly output.
void swapIdx(unsigned int idx1, unsigned int idx2)
Swap the elements at indices idx1 and idx2.
std::shared_ptr< Edge > getEdgeIdx(unsigned int idx)
Returns edge specified at index idx.
void createEdges(unsigned int radius)
Generate edges between vortices closer than int radius.
void removeEdge(std::shared_ptr< Node > n1, std::shared_ptr< Node > n2)
Remove edge between n1 and n2 from the lattice.
double getVortexDistance(std::shared_ptr< Node > n1, std::shared_ptr< Node > n2)
Calculates distance between vortices.
std::weak_ptr< Edge > isConnected(std::shared_ptr< Node > n1, std::shared_ptr< Node > n2)
Checks if vortex n1 and n2 are connected.
Y Y range of points % radius
Definition: psi6.m:1
void addEdge(std::shared_ptr< Edge > e)
Add edge e to the lattice (graph). Assumes edge has nodes already.
double getVortexDistanceD(std::shared_ptr< Node > n1, std::shared_ptr< Node > n2)
Calculates distance between vortices.
% Prealloc may improve speed here end save Ek mat
Definition: kinSpec.m:21
std::shared_ptr< Node > getVortexUid(unsigned int uid)
Returns vortex based on UID.
void destroyVortex(unsigned int uid)
Destroy a vortex with UID uid.
Class for creating edges between adjacent vortices in graph.
void setEdge(unsigned int idx, std::shared_ptr< Edge > e)
Set edge at a specific position.