Greens-code
A modular quantum transport code
generate_wavefunction.hpp
1 #ifndef GENERATE_WF_HPP
2 #define GENERATE_WF_HPP
3 
4 #include <vector>
5 #include <list>
6 
7 #include "my_mkl.hpp"
8 #include "executable.hpp"
9 #include "points.hpp"
10 
11 #include <memory>
12 
13 #include "state.hpp"
14 
15 #include "abstract_state_worker.hpp"
16 
18 
20 
25 class Bild{
26 public:
28  double d() const { return d_;};
29 
31  double width() const { return width_;};
33  double length() const { return length_;};
35  size_t nx() const { return nx_;};
37  size_t ny() const { return ny_;};
39  size_t size() const { return data.size();};
41  const point& pos_0() const { return pos_0_;};
43  double rotation() const { return rotation_;};
45  complex pixel(size_t ix, size_t iy) const {
46  size_t index(ix + iy * nx());
47  return index < size() ? data[index] : complex(0.);};
49  void set_pixel(size_t ix, size_t iy, complex v) {
50  size_t index(ix + iy * nx());
51  if (index < size()) data[index] = v;
52  }
54  void multiply_by_number(complex v){
55  for(std::vector<complex>::iterator value=data.begin();value!=data.end();value++) *value *= v;
56  }
57 
58  typedef std::vector<complex>::const_iterator const_iterator;
59 
60  const_iterator begin() const { return data.begin();};
61  const_iterator end() const { return data.end();};
62 
63  std::unique_ptr<Bild> identical_image_from_vector(Vector& d)
64  const;
65 
67  std::unique_ptr< std::vector<complex> > identical_vector_from_image(void) const;
68 
69  static
70  std::unique_ptr<Bild> image_from_vector(Vector& data,
71  double d,
72  int nx,
73  int ny);
74 private:
75  friend class image_Factory;
76  friend class image_slice_coloring;
77 
78  std::vector<complex> data;
79 
80  Bild(){};
81  Bild(const Bild&); // blocked
82 
83  double d_;
84 
85  double width_;
86  double length_;
87  point pos_0_;
88  double rotation_;
89 
90  size_t nx_;
91  size_t ny_;
92 
93  state* s;
94 
95 };
96 
98 
115 public:
116 
117  typedef STD_TR1::shared_ptr<image_Factory> ref;
118 
119  image_Factory(){}
120  ~image_Factory() throw() {}
121 
122  std::unique_ptr<Bild> Image(MPI_Comm comm,
123  const state s,
124  const size_t drawing_layer);
125 
126 private:
127 
128  double min_x;
129  double max_x;
130  double min_y;
131  double max_y;
132 
133  double rotation_;
134 
135  std::unique_ptr<Bild> prepbild;
136 
137  STD_TR1::shared_ptr< std::list< STD_TR1::shared_ptr< abstract_image_parser> > >
138  my_image_parsers;
139 
140  void process_wv_(MPI_Comm, const state s);
141 
142  void init_state_worker();
143 
144  void prepare_Image_(const STD_TR1::shared_ptr<const Rectangle>&);
145 
146  const char* name() const {return "Image";};
147 
148  void setup_data_();
149  void post_process_(MPI_Comm);
150 
151  double zoom;
152 
153 };
154 
155 
156 #endif
size_t size() const
total number of pixels
Definition: generate_wavefunction.hpp:39
Class to contain wave-function image data.
Definition: generate_wavefunction.hpp:25
double rotation() const
rotation of the geometry
Definition: generate_wavefunction.hpp:43
complex pixel(size_t ix, size_t iy) const
value of wavefunction at pixel ix,iy
Definition: generate_wavefunction.hpp:45
Helper class to draw images efficiently.
Definition: pencils.hpp:13
double d() const
length (in units of the Hamiltonian geometry) of one pixel
Definition: generate_wavefunction.hpp:28
Abstract base class to process calculated wavefunctions.
Definition: image_parser.hpp:21
size_t nx() const
number of pixels in x direction
Definition: generate_wavefunction.hpp:35
void set_pixel(size_t ix, size_t iy, complex v)
change value of wavefunction at pixel ix,iy
Definition: generate_wavefunction.hpp:49
A class to create wavefunctions out of eigenstates, scattering states, or geometries.
Definition: generate_wavefunction.hpp:114
std::unique_ptr< std::vector< complex > > identical_vector_from_image(void) const
Added by AG.
Definition: generate_wavefunction.cpp:62
Definition: state.hpp:24
double length() const
length of the image (in units of the Hamiltonian geometry
Definition: generate_wavefunction.hpp:33
double width() const
width of the image (in units of the Hamiltonian geometry
Definition: generate_wavefunction.hpp:31
Definition: points.hpp:12
const point & pos_0() const
position where to start drawing the image
Definition: generate_wavefunction.hpp:41
size_t ny() const
number of pixels in y direction
Definition: generate_wavefunction.hpp:37
void multiply_by_number(complex v)
multiply whole image with complex number v; Added by AG
Definition: generate_wavefunction.hpp:54
abstract base class to work on wavefunctions (states)
Definition: abstract_state_worker.hpp:23