Greens-code
A modular quantum transport code
funcs.hpp
1 #ifndef FUNC_CPP_HEADER_INPU
2 #define FUNC_CPP_HEADER_INPU
3 
4 #include "funcs_base.hpp"
5 #include <list>
6 
7 class expression;
8 class ncexpression;
9 class cexpression;
10 
12 {
13 public:
14  ~real2complex_wrapper() throw() {};
15  real2complex_wrapper(function_Object::ref given_real_func) : real_func(given_real_func) {
16  real_func->initialize(real_func);
17  };
18 
19 private:
20  const char* name() const {return "real2complex_wrapper";};
21 
22  void init_func();
23 
24  complex value(const double) const;
25 
26  function_Object::ref real_func;
27 };
28 
30 {
31 public:
32  ~real2complex_2d_wrapper() throw() {};
33  real2complex_2d_wrapper(function2d_Object::ref given_real_func) : real_func(given_real_func) {};
34 
35 private:
36  const char* name() const {return "real2complex_2d_wrapper";};
37 
38  void init_func();
39 
40  complex value(const double,const double) const;
41 
42  function2d_Object::ref real_func;
43 };
44 
46 public:
47  virtual ~parsed_complex_func() throw() {};
48 private:
49  STD_TR1::shared_ptr<cexpression> expr;
50  STD_TR1::shared_ptr<cexpression> expr_2;
51 
52  const char* name() const {return "parsed_complex_function";};
53 
54  void init_func();
55 
56  complex value(const double) const;
57 };
58 
66 public:
67  virtual ~translated2d_func() throw() {};
68 private:
69  STD_TR1::shared_ptr<
70  std::list< function2d_Object::ref > > funcs;
71 
72 
73  function2d_Object::ref fxy;
74  function2d_Object::ref yp;
75  function2d_Object::ref xp;
76 
77  const char* name() const {return "translated2d_function";};
78 
79  void init_func();
80 
81  double value(const double,const double) const;
82 };
83 
85 
95 public:
96  virtual ~parsed_complex2d_func() throw() {};
97 private:
98  STD_TR1::shared_ptr<ncexpression> expr;
99  STD_TR1::shared_ptr<ncexpression> expr_2;
100 
101  const char* name() const {return "parsed_complex2d_function";};
102 
103  void init_func();
104 
105  complex value(const double,const double) const;
106 };
107 
108 /*
109 2d Gaussian distribution with standard deviation stddeviation. volume represents the "height", standing for the integral value over R2 (default value 1)
110 
111 TODO: stddeviation is presumably wrong
112 */
114 public:
115  virtual ~gaussian2d_func() throw() {};
116 
117 private:
118  double stddeviation;
119  double volume;
120 
121  const char* name() const {return "gaussian2d_function";};
122 
123  void init_func();
124 
125  double value(const double,const double) const;
126 };
127 
128 /*
129 Potential of a pointload -q_potential at a distance -d_load appart from the 2d layer
130 
131 */
133 public:
134  virtual ~pointload2d_func() throw() {};
135 
136 private:
137  double q_potential;
138  double d_load;
139 
140  const char* name() const {return "pointload2d_function";};
141 
142  void init_func();
143 
144  double value(const double,const double) const;
145 };
146 
147 
148 /*
149 a radial function expanded into 2d
150 */
152 public:
153  STD_TR1::shared_ptr<expression> expr;
154 
155  virtual ~radial2d_func() throw() {};
156 
157 private:
158 
159  const char* name() const {return "radial2d_function";};
160 
161  void init_func();
162 
163  double value(const double,const double) const;
164 };
165 
166 
168 public:
169  virtual ~sine2d_func() throw() {};
170 
171 private:
172  double amplitude;
173  double lambdax;
174  double lambday;
175 
176  const char* name() const {return "sine2d_function";};
177 
178  void init_func();
179 
180  double value(const double,const double) const;
181 };
182 
184 public:
185  virtual ~periodic2d_func() throw() {};
186 private:
187 
188  const char* name() const {return "periodic2d_function";};
189 
190  function2d_Object::ref f;
191 
192  double vector1_x,vector1_y;
193  double vector2_x,vector2_y;
194  double angle;
195 
196  void init_func();
197 
198  double value(const double,const double) const;
199 
200 };
201 
203 
217 public:
218  ~modify_vector() throw() {};
219 private:
220  const char* name() const {return "modify_vector";};
221 
222  size_t determine_size();
223  void init_vector();
224  void lazy_init() const;
225 };
226 
228 
242 public:
243  ~combine_vectors() throw() {};
244 private:
245  const char* name() const {return "combine_vectors";};
246 
247  size_t determine_size();
248  void init_vector();
249 };
250 
251 
253 
270 public:
271  virtual ~random_vector() throw() {};
272 
273 private:
274  const char* name() const {return "random_vector";};
275 
276  void init_vector();
277 };
278 
280 
298 public:
299  virtual ~random_smooth_vector() throw() {};
300 
301 private:
302  const char* name() const {return "random_smooth_vector";};
303 
304  void init_vector();
305 };
306 
308 
323 public:
324  virtual ~expand_2d_vector() throw() {};
325 
326 private:
327  size_t nx, ny, data_ny;
328 
329  vector_Object::ref data;
330 
331  const char* name() const {return "expand_2d_vector";};
332 
333  size_t determine_size();
334  void init_vector();
335  void lazy_init() const;
336 };
337 
339 
364 public:
365  virtual ~random_smooth2d_vector() throw() {};
366 
367 private:
368  double dx, dy, correlation, amp, dis;
369  int nx, ny, periodic_y,periodic_x;
370  int shift_to_zero;
371  function_Object::ref rand_dist_func;
372 
373  const char* name() const {return "random_smooth2d_vector";};
374 
375  size_t determine_size();
376  void init_vector();
377  void lazy_init() const;
378 };
379 
381 
391 public:
392  virtual ~input_file_vector() throw() {};
393 
394 private:
395  const char* name() const {return "input_vector";};
396 
397  void init_vector();
398 };
399 
401 
409 public:
410  ~parsed_vector_Object() throw() {};
411 private:
412  const char* name() const {return "parsed_vector";};
413 
414  void init_vector();
415 };
416 
418 
426 public:
427  ~vector_step_function() throw() {};
428 
429 private:
430  vector_Object::ref data;
431  double ddy, Wy;
432  int ny;
433  bool discrete;// true: interpret f(x) as f(int(x)), false: interpolate: f(x) = f(int(y *f/ Wy))
434 
435  const char* name() const { return "vector_step_function"; };
436 
437  void init_func();
438 
439  double value(const double) const;
440 };
441 
443 
456 public:
457  ~vector_step_function2d() throw() {};
458 
459 private:
460  vector_Object::ref data;
461  double ddx, ddy, Wx, Wy;
462  int ny, nx;
463  bool flip_nxy;
464 
465  const char* name() const { return "vector_step_function2d"; };
466 
467  void init_func();
468 
469  double value(const double, const double) const;
470 };
471 
473 
486 public:
487  ~complex_vector_step_function2d() throw() {};
488 
489 private:
490  vector_Object::ref data;
491  vector_Object::ref data_imag;
492  double ddx, ddy, Wx, Wy;
493  int ny;
494 
495  const char* name() const { return "complex_vector_step_function2d"; };
496 
497  void init_func();
498 
499  complex value(const double, const double) const;
500 };
501 
502 
513  /* creating vector with random numbers from [distance-amplitude/2,distance+amplitude/2 */
514 
515 public:
516  virtual ~totally_random_vector() throw() {};
517 
518 private:
519  const char* name() const {return "totally_random_vector";};
520 
521  void init_vector();
522 };
523 
539 public:
540  virtual ~double_QPC_on_cyl_vector() throw() {};
541 private:
542  int nx,ny,gap1,gap2,wall,y_leftlead;
543  const char* name() const { return "Double_QPC";};
544 
545  size_t determine_size();
546  void init_vector();
547  void lazy_init() const;
548 };
549 
551 public:
552  virtual ~single_QPC_on_cyl_vector() throw() {};
553 private:
554  int nx,ny,gap1,wall,y_leftlead;
555  const char* name() const { return "Single_QPC";};
556 
557  size_t determine_size();
558  void init_vector();
559  void lazy_init() const;
560 };
561 
563 public:
564  virtual ~single_QPC_on_long_cyl_vector() throw() {};
565 private:
566  int nx,ny,gap1,wall,y_leftlead;
567  const char* name() const { return "Single_QPC_long";};
568 
569  size_t determine_size();
570  void init_vector();
571  void lazy_init() const;
572 };
573 
575 public:
576  virtual ~single_QPC_on_straight() throw() {};
577 private:
578  int nx,ny,gap1,wall,y_leftlead;
579  const char* name() const { return "Single_horizontal_QPC";};
580 
581  size_t determine_size();
582  void init_vector();
583  void lazy_init() const;
584 };
585 
587 
588 public:
589  virtual ~cut_simple_obstacles() throw() {};
590 private:
591  int nx,ny, do_rect, phi;
592  std::vector< double > xpositions;
593  std::vector< double > ypositions;
594  std::vector< double > radii;
595  std::vector< double > width;
596  std::vector< double > height;
597  std::vector< double > potentials;
598  //std::vector< double > pot_real;
599  //std::vector< double > pot_imag;
600  const char* name() const {return "simple_obst";};
601 
602  size_t determine_size();
603  void init_vector();
604  void lazy_init() const;
605 };
606 
608 
609 public:
610  virtual ~cut_random_obstacles() throw() {};
611 private:
612  int nx,ny;
613  int randomize_radii;
614  int breakconf;
615  double dx,dy;
616  double r_max;
617  double d_min;
618  double circle_pot,background_pot;
619  double filling_factor;
620  int number_of_circles;
621 
622  const char* name() const {return "random_obstacles";};
623  size_t determine_size();
624  void init_vector();
625  void lazy_init() const;
626 
627 };
628 
629 
631 
642 class const_vector : public vector_Object {
643 
644 public:
645  virtual ~const_vector() throw() {};
646 private:
647  int nx,ny;
648  double bulk_pot;
649  double border_pot;
650  int border_width;
651 
652  const char* name() const {return "const_vector";};
653  size_t determine_size();
654  void init_vector();
655  void lazy_init() const;
656 
657 };
658 
660 public:
661  virtual ~interpolate_vector() throw() {};
662 
663 private:
664  int nx0,ny0;
665  int zoom;
666  vector_Object::ref data;
667  int nx,ny;
668  std::string filename;
669  const char* name() const {return "interpolate_vector";};
670  size_t determine_size();
671  void init_vector();
672  void lazy_init() const;
673 };
674 
676 
677 public:
678  virtual ~sine_boundary() throw() {};
679 private:
680  int nx;
681  double dx,dy,epsilon,delta,k;
682 
683  const char * name() const { return "sine_boundary";}
684  size_t determine_size();
685  void init_vector();
686  void lazy_init() const;
687 
688 };
689 
690 
691 #endif
Definition: funcs_base.hpp:80
Definition: funcs.hpp:675
Step Function, generated from vector data.
Definition: funcs.hpp:485
Definition: funcs.hpp:151
Definition: funcs_base.hpp:107
Base class for a 1D Vector.
Definition: funcs_base.hpp:143
Definition: funcs.hpp:183
Function (Step Function = old, as of 2019 bilinear interpolation), generated from vector data...
Definition: funcs.hpp:455
Name: Double_QPC (class double_QPC_on_cyl_vector) Creates a double QPC in y-direction with gap sizes ...
Definition: funcs.hpp:538
Definition: funcs.hpp:132
Definition: funcs_base.hpp:10
Definition: funcs.hpp:113
Definition: math_parser.hpp:16
Step Function, generated from vector data.
Definition: funcs.hpp:425
Fill a vector with random numbers so that the numbers lie smoothly together.
Definition: funcs.hpp:297
Definition: funcs.hpp:167
Change a vector according to a mathematical formula.
Definition: funcs.hpp:216
Parsed complex 2D function, use x, y, and I.
Definition: funcs.hpp:94
Definition: funcs.hpp:574
Definition: funcs.hpp:11
Definition: math_parser.hpp:105
Definition: funcs.hpp:586
Fill a 2d matrix with random numbers so that the numbers form a smooth 2d surface.
Definition: funcs.hpp:363
Definition: funcs.hpp:45
Definition: funcs.hpp:607
Vector reading its values from an input file.
Definition: funcs.hpp:390
Definition: funcs_base.hpp:43
Definition: funcs.hpp:562
expand an existing 2d vector (sort of zooming in), by a factor two
Definition: funcs.hpp:322
Definition: funcs.hpp:659
Definition: funcs.hpp:29
Definition: math_parser.hpp:53
Combine two vectors according to a mathematical formula.
Definition: funcs.hpp:241
totally_random_vector is a vector of completely random numbers Parameters: {itemize} {N: size of vect...
Definition: funcs.hpp:512
Definition: funcs.hpp:550
Fill a vector with random numbers.
Definition: funcs.hpp:269
A 2d function object, taking another 2d function, and translating the positions, yielding f(xp(x...
Definition: funcs.hpp:65
Vector with constant value c for all elements inside a rectangle, except at the boundary.
Definition: funcs.hpp:642
Vector using a parsable string expression to set its values.
Definition: funcs.hpp:408