NESSi  v1.0.2
The NonEquilibrium Systems Simulation Library
cntr_distributed_timestep_array_impl.hpp
Go to the documentation of this file.
1 #ifndef CNTR_DISTRIBUTED_TIMESTEP_ARRAY_IMPL_H
2 #define CNTR_DISTRIBUTED_TIMESTEP_ARRAY_IMPL_H
3 
7 
8 namespace cntr {
9 
10 /* #######################################################################################
11 #
12 # CONSTRUCTION/DESTRUCTION
13 #
14 ########################################################################################*/
16  n_=data_.n();
17  tid_=data_.tid();
18  ntasks_=data_.ntasks();
19  G_=std::vector<cntr::herm_matrix_timestep_view<T> >(n_);
20  tstp_=-2;
21  nt_=-2;
22  ntau_=-1;
23  size_=0;
24  sig_=-1;
25 }
27  // donothing
28 }
30  // default
31  n_=a.n();
32  tid_=a.tid();
33  ntasks_=a.ntasks();
34  data_=a.data(); // note: this copies the data of a
35  tstp_=a.tstp();
36  nt_=a.nt();
37  ntau_=a.ntau();
38  size_=a.size();
39  sig_=a.sig();
40  G_=a.G(); // this copies only the pointers of G_[j], they still point to the data of a
41  // reset G_[j] to point to the new data
42  for(int j=0;j<n_;j++) G_[j].set_to_data(data_.block(j),tstp_,ntau_,size_,sig_);
43 }
45  if(this==&a) return *this;
46  n_=a.n();
47  tid_=a.tid();
48  ntasks_=a.ntasks();
49  data_=a.data(); // note: this copies the data of a
50  tstp_=a.tstp();
51  nt_=a.nt();
52  ntau_=a.ntau();
53  size_=a.size();
54  sig_=a.sig();
55  G_=a.G(); // this copies only the poiters of G_[j], they still point to the data of a
56  // reset G_[j] to point to the new data
57  for(int j=0;j<n_;j++) G_[j].set_to_data(data_.block(j),tstp_,ntau_,size_,sig_);
58  return *this;
59 }
60 
87 template <typename T> distributed_timestep_array<T>::distributed_timestep_array(int n,int nt,int ntau,int size,int sig,bool mpi){
88  assert(-1<=nt && 0<=ntau && sig*sig==1 && 1<=size);
89  int size_tstp=(ntau+1+2*(nt+1))*size*size;
90  int maxlen=size_tstp;
91  data_=cntr::distributed_array<std::complex<T> >(n,maxlen,mpi);
92  n_=data_.n();
93  tid_=data_.tid();
94  ntasks_=data_.ntasks();
95  tstp_=-2;
96  nt_=nt;
97  ntau_=ntau;
98  size_=size;
99  sig_=sig;
100  // they all point nowhere, since tstp=-2
101  G_=std::vector<cntr::herm_matrix_timestep_view<T> >(n_);
102 }
103 
120 template <typename T> void distributed_timestep_array<T>::reset_tstp(int tstp){
121  assert(-1<=tstp && -1<=nt_);
122  int blocksize=(ntau_+1+2*(tstp+1))*size_*size_;
123  tstp_=tstp;
124  data_.reset_blocksize(blocksize);
125  for(int j=0;j<n_;j++) G_[j].set_to_data(data_.block(j),tstp_,ntau_,size_,sig_);
126 }
127 
141 template <typename T> void distributed_timestep_array<T>::clear(void){
142  data_.clear();
143 }
144 
161  assert(0<=j && 0<=n_-1);
162  return G_[j];
163 }
164 
180 template <typename T> void distributed_timestep_array<T>::mpi_bcast_block(int j){
181  data_.mpi_bcast_block(j);
182 }
183 
197 template <typename T> void distributed_timestep_array<T>::mpi_bcast_all(void){
198  data_.mpi_bcast_all();
199 }
200 
201 }
202 #endif
Class herm_matrix_timestep_view serves for interfacing with class herm_matrix_timestep without copyi...
cntr::herm_matrix_timestep_view< T > & G(int j)
Get the pointer to the herm_matrix_timestep for the j-th block
distributed_array< std::complex< T > > data(void) const
distributed_timestep_array< T > & operator=(const distributed_timestep_array &a)
void mpi_bcast_block(int j)
MPI broadcast equivalent for the j-th block
Specialization of the distributed_array in which data-blocks are associated with the herm_matrix_tim...
Auxiliary data structure for handling set of data blocks and includes usual MPI processes on them...
void mpi_bcast_all(void)
MPI allgather equivalent
void reset_tstp(int tstp)
Reset the data to new timestep of herm_matrix_timestep
std::vector< cntr::herm_matrix_timestep_view< T > > G(void) const