Greens-code
A modular quantum transport code
simple_rectangles.hpp
1 #ifndef CONCRETE_RECTANGLE_HPP
2 #define CONCRETE_RECTANGLE_HPP
3 
4 #include "rectangle.hpp"
5 
6 namespace fortran{
7  struct Block;
8 }
9 
10 /*****************************
11  *
12  * class single_Rectangle
13  *
14  * Hold one slice of one Hamiltonian, solve by direct inversion
15  *
16  */
17 
19 public:
20 
21  single_Rectangle(): my_H(){};
22  virtual ~single_Rectangle() throw() {};
23 
24 protected:
25 
26  bool leaf() const {return true;};
27  size_t size() const {return 1;};
28 
29 private:
30  Hamiltonian::ref my_H;
31 
32  Hamiltonian::const_ref am_leaf_get_H(size_t pos) const {return my_H;};
33  Hamiltonian::ref am_leaf_get_H(size_t pos) {return my_H;};
34 
35  void init();
36 
37  double dy_(const geometry_const_Iterator& pos) const { return my_H->dy(pos);};
38  double dx_(const geometry_const_Iterator& pos) const { return my_H->dy(pos);};
39 
40  void RectangleVisitor( Rectangle_Visitor& v) const;
41 
42  const char* name() const { return "single_Rectangle";}
43 
44  size_t layers_() const { return my_H->layers();};
45  size_t drawing_layers_() const;
46 
47  void createH(Matrix&, const geometry_const_Iterator&, size_t) const;
48 
49  size_t grid_points_() const {return begin().ny();};
50  size_t nx_(size_t) const { return 1;};
51 };
52 
53 
54 /*****************************
55  *
56  * class periodic_Rectangle
57  *
58  * Hold nx slices of one periodic (i.e. not x-dependent)
59  * Hamiltonian, solve by Sanvito
60  *
61  */
62 
64 public:
65 
67  ~periodic_Rectangle() throw() {};
68 
69 protected:
70 
71  bool leaf() const {return true;};
72  size_t size() const { return nx;};
73 
74 private:
75  simple_Hamiltonian::ref my_H;
76  int nx;
77 
78  Hamiltonian::const_ref am_leaf_get_H(size_t pos) const {return my_H;};
79  Hamiltonian::ref am_leaf_get_H(size_t pos) {return my_H;};
80 
81  double dy_(const geometry_const_Iterator&) const {return my_H->dy();};
82  double dx_(const geometry_const_Iterator&) const { return my_H->dx();};
83 
84  const char* name() const { return "periodic_Rectangle";}
85 
86  void createH(Matrix&, const geometry_const_Iterator&, size_t) const;
87 
88  void RectangleVisitor( Rectangle_Visitor& v) const;
89 
90  size_t layers_() const { return my_H->layers();};
91  size_t drawing_layers_() const;
92 
93  void init();
94 
95  size_t grid_points_() const;
96  size_t nx_(size_t) const { return nx;};
97 };
98 
99 /*****************************
100  *
101  * class normal_Rectangle
102  *
103  * Hold nx slices of not necessarily periodic
104  * Hamiltonian, solve by Inversion
105  *
106  */
107 
109 public:
110 
111  normal_Rectangle(){};
112  ~normal_Rectangle() throw() {};
113 
114 protected:
115 
116  bool leaf() const {return true;};
117  size_t size() const { return nx;};
118 
119  void init_nx_H();
120 
121 private:
122  Hamiltonian::ref my_H;
123  int nx;
124 
125  Hamiltonian::const_ref am_leaf_get_H(size_t pos) const {return my_H;};
126  Hamiltonian::ref am_leaf_get_H(size_t pos) {return my_H;};
127 
128  double dy_(const geometry_const_Iterator& pos) const {return my_H->dy(pos);};
129  double dx_(const geometry_const_Iterator& pos) const { return my_H->dx(pos);};
130 
131  const char* name() const { return "Rectangle";}
132 
133  void createH(Matrix&, const geometry_const_Iterator&, size_t) const;
134  void RectangleVisitor( Rectangle_Visitor& v) const;
135 
136  size_t layers_() const { return my_H->layers();};
137  size_t drawing_layers_() const;
138 
139  void init();
140 
141  size_t grid_points_() const;
142  size_t nx_(size_t) const { return nx;};
143 };
144 
161 class Interface;
162 
163 typedef STD_TR1::shared_ptr<Interface> Interface_ref;
164 typedef STD_TR1::shared_ptr<const Interface> Interface_const_ref;
165 
166 class Potential;
167 
168 class rect_Block: public Rectangle{
169 public:
170  rect_Block(){};
171  ~rect_Block() throw() {};
172 
173 protected:
174 
175  size_t size() const {return Rects->size();};
176  bool leaf() const {return false;};
177 
178 private:
179 
180  typedef std::vector<Rectangle::ref> Rect_List;
181  STD_TR1::shared_ptr<Rect_List> Rects;
182 
183  typedef std::vector<Rectangle::ref>::iterator rect_iter;
184  typedef std::vector<Rectangle::ref>::const_iterator c_rect_iter;
185 
186  typedef std::vector<Interface_ref> Inter_List;
187  Inter_List Interfaces;
188 
189  typedef std::vector<Interface_ref>::iterator int_iter;
190  typedef std::vector<Interface_ref>::const_iterator c_int_iter;
191 
192  const char* name() const { return "Block";};
193  void init();
194 
195  Interface_const_ref get_I(size_t pos) const { return Interfaces[pos];};
196 
197  Rectangle::const_ref am_no_leaf_get_R(size_t pos) const { return (*Rects)[pos];};
198  Rectangle::ref am_no_leaf_get_R(size_t pos) { return (*Rects)[pos];};
199 
200  void calculate();
201 
202  void createH(Matrix&) const;
203  void createH(Matrix&, const geometry_const_Iterator&, size_t) const;
204 
205  void RectangleVisitor( Rectangle_Visitor& v) const;
206 
207  double dy_(const geometry_const_Iterator&) const;
208  double dx_(const geometry_const_Iterator&) const;
209  double dphi_(const geometry_const_Iterator&) const;
210 
211  size_t layers_() const;
212  size_t drawing_layers_() const;
213 
214  size_t grid_points_() const;
215  size_t nx_(size_t) const;
216 
217  bool act_as_one_rect;
218 };
219 
220 
221 
222 #endif
Definition: simple_rectangles.hpp:63
Definitions of abstract Rectangle base class.
Definition: iterators.hpp:13
An abstract base class defining potentials, use with ExtPot_Hamiltonian.
Definition: abstract_potential.hpp:38
Definition: noiseless.hpp:11
double dy(const geometry_const_Iterator &ci) const
return offset in y direction to next slice, usually zero
Definition: rectangle.hpp:92
Definition: simple_rectangles.hpp:108
Definition: simple_rectangles.hpp:168
Abstract class that defines a geomeetry.
Definition: rectangle.hpp:31
Definition: rectangle_visitor.hpp:21
Definition: simple_rectangles.hpp:18
Abstract base class describing the interface between adjacent Rectangles.
Definition: interface.hpp:104
Base Matrix class for access to 2D number grids.
Definition: matrix.hpp:82