QNANO
Selected_Manybody_States_with_Maps.h
1 #ifndef QNANO_NEW_SELECTED_MANYBODY_STATES_WITH_MAPS_DEFINED_H
2 #define QNANO_NEW_SELECTED_MANYBODY_STATES_WITH_MAPS_DEFINED_H
3 
4 #include <map>
5 #include "manybody/Selected_Manybody_States.h"
6 
7 
9 public:
10  typedef std::map<Fermion_Double_Index, int>::iterator map_iter;
11  typedef std::map<Fermion_Double_Index, int>::const_iterator map_const_iter;
12  typedef std::map<int, Fermion_Double_Index>::iterator rev_map_iter;
13  typedef std::map<int, Fermion_Double_Index>::const_iterator rev_map_const_iter;
14 
15  std::map<Fermion_Double_Index, int> map;
16  std::map<int, Fermion_Double_Index> rev_map;
17 
18 
19  virtual size_t size()const{return map.size();}
20  void clear(){map.clear();}
21  map_const_iter begin()const{return map.begin();}
22  map_const_iter end()const{return map.end();}
23  bool is_contained(const Fermion_Double_Index &fi)const;
24 
25 
26  int find(const Fermion_Double_Index &fi)const;
27  int find_check(const Fermion_Double_Index &fi)const;
28  Fermion_Double_Index find_reverse(int index)const;
29 
30  void check_consistency()const;
31 
32  void add_if_not_contained(const Fermion_Double_Index &fi);
33  void add_from_file(const std::string &fname, int rank_e, int rank_h, int max_nr_e, int max_nr_h);
34 
35  void print(std::ostream &os=std::cout)const;
36  void print(const std::string &fname)const{
37  std::ofstream ofs(fname.c_str());
38  print(ofs);
39  }
40 
41  void add_all(int rank_e, int rank_h, int nr_e, int nr_h, int start_e=0, int start_h=0);
42  void add_singles(int nr_e, int nr_h);
43 
44  void swap(Selected_Manybody_States_with_Maps &other);
45 };
46 #endif
Definition: Selected_Manybody_States.h:13
Definition: Fermion_Double_Index.h:14
Definition: Selected_Manybody_States_with_Maps.h:8