Greens-code
A modular quantum transport code
complicated_rectangle.hpp
1 #ifndef COMPLICATED_RECTANGLE_HPP
2 #define COMPLICATED_RECTANGLE_HPP
3 
4 namespace fortran{
5  struct Block;
6 }
7 
8 #include "rectangle.hpp"
9 #include "interface.hpp"
10 
11 
13 
28 class rotated_matrix;
29 
30 class rotated_rect: public Rectangle{
31 public:
32  rotated_rect(){};
33  ~rotated_rect() throw() {};
34 
35 protected:
36 
37  bool leaf() const { return false;};
38  size_t size() const { return 2;};
39 
40 private:
41  typedef STD_TR1::shared_ptr< std::vector<int> > mat_index_ref;
42  const char* name() const { return "rotated_rect";};
43 
44  void init();
45 
46  Rectangle::const_ref am_no_leaf_get_R(size_t pos) const {
47  return (pos == 0) ? left_rect : right_rect;};
48  Rectangle::ref am_no_leaf_get_R(size_t pos) {
49  return (pos == 0) ? left_rect : right_rect;};
50 
51  complex bpar;
52  bool upwards;
53  mutable double ist_x;
54  mutable double ist_y;
55  int ist;
56 
57  Rectangle::ref left_rect;
58  Rectangle::ref right_rect;
59  Interface::ref inter;
60 
61  Interface_const_ref get_I(size_t pos) const { return inter;};
62 
63  mutable mat_index_ref matrix_indizes;
64  mutable STD_TR1::shared_ptr<Vector> Lambda;
65 
66  STD_TR1::shared_ptr<rotated_matrix> my_mat;
67 
68  void set_coordinates() const;
69  void set_coordinates_upwards(std::vector<point>&) const;
70  void set_coordinates_not_upwards(std::vector<point>&) const;
71 
72  void createH(Matrix&) const;
73  void createH(Matrix&,
74  const geometry_const_Iterator& pos,
75  size_t nx) const;
76  void RectangleVisitor( Rectangle_Visitor& v) const;
77 
78  double dx_(const geometry_const_Iterator&) const;
79  double dy_(const geometry_const_Iterator&) const;
80  double dphi_(const geometry_const_Iterator&) const;
81 
82  size_t layers_() const;
83  size_t drawing_layers_() const;
84 
85  size_t nx_(size_t) const;
86  size_t grid_points_() const;
87 };
88 
89 
91 
101 class cylinder: public Rectangle{
102 public:
103  cylinder(){};
104  ~cylinder() throw() {};
105 
106 protected:
107 
108  size_t size() const {return 1;};
109  bool leaf() const {return false;};
110 
111 private:
112  size_t myN;
113 
114  Rectangle::ref my_rect;
115 
116  Interface::ref my_inter;
117 
118  Interface_const_ref get_I(size_t pos) const { return my_inter;};
119 
120  const char* name() const { return "cylinder";};
121  void init();
122 
123  Rectangle::const_ref am_no_leaf_get_R(size_t pos) const { return my_rect;};
124  Rectangle::ref am_no_leaf_get_R(size_t pos) { return my_rect;};
125 
126  void calculate();
127 
128  void createH(Matrix&) const;
129  void createH(Matrix&,
130  const geometry_const_Iterator& pos,
131  size_t nx) const;
132  void RectangleVisitor( Rectangle_Visitor& v) const;
133 
134  double dy_(const geometry_const_Iterator&) const;
135  double dx_(const geometry_const_Iterator&) const;
136 
137  size_t layers_() const;
138  size_t drawing_layers_() const;
139 
140  size_t grid_points_() const;
141  size_t nx_(size_t) const;
142 
143  double bloch_k;
144 
145 };
146 
147 class rect_Block;
148 
181 class many_Rects: public Rectangle{
182 public:
183  typedef STD_TR1::shared_ptr<many_Rects> ref;
184  typedef STD_TR1::shared_ptr<const many_Rects> const_ref;
185 
186  many_Rects();
187  ~many_Rects() throw() {};
188 
189 protected:
190 
191  size_t size() const;
192  bool leaf() const;
193 
194 private:
195 
196  size_t counter;
197  int gen_count;
198  bool randomize_rects;
199  bool use_generic_Interface;
200 
201  typedef std::vector<Interface::ref> Interface_Vec;
202  typedef STD_TR1::shared_ptr<Interface_Vec> Interface_Vec_p;
203  Interface_Vec_p Interfaces;
204 
205  typedef std::list<Rectangle::ref> Rect_List;
206  typedef STD_TR1::shared_ptr<Rect_List> Rect_List_p;
207  Rect_List_p Rects;
208 
209  Rectangle::ref actual_Rect;
210 
211  void Fibonacci(int);
212 
213  Rectangle::ref combine();
214  Rectangle::ref combine(const Rect_List&);
215 
216  Interface::ref get_Interface();
217 
218  Rect_List_p generate(Rect_List_p) const;
219 
220  const char* name() const { return "Fibonacci_rectangles";};
221  void init();
222  void init_from_clone(loadable_Object::const_ref);
223 
224  void init_basic();
225 
226  Interface_const_ref get_I(size_t pos) const;
227 
228  Rectangle::const_ref am_no_leaf_get_R(size_t pos) const;
229  Rectangle::ref am_no_leaf_get_R(size_t pos);
230 
231  void createH(Matrix&) const;
232  void createH(Matrix&,
233  const geometry_const_Iterator& pos,
234  size_t nx) const;
235  void RectangleVisitor( Rectangle_Visitor& v) const;
236 
237  double dy_(const geometry_const_Iterator&) const;
238  double dx_(const geometry_const_Iterator&) const;
239  double dphi_(const geometry_const_Iterator&) const;
240 
241  size_t layers_() const;
242  size_t drawing_layers_() const;
243 
244  size_t grid_points_() const;
245  size_t nx_(size_t) const;
246 };
247 
248 #endif
Create a sequence of random rects using a Fibonacci-like algorithm.
Definition: complicated_rectangle.hpp:181
Definitions of abstract Rectangle base class.
Definition: iterators.hpp:13
Definition: noiseless.hpp:11
Definition: complicated_rectangle.cpp:29
Wrap contained geometry together with periodic boundary conditions.
Definition: complicated_rectangle.hpp:101
Definition: simple_rectangles.hpp:168
Abstract class that defines a geomeetry.
Definition: rectangle.hpp:31
Definition: rectangle_visitor.hpp:21
Base Matrix class for access to 2D number grids.
Definition: matrix.hpp:82
Definition: complicated_rectangle.hpp:30