QNANO
Selected_Manybody_States_with_Hash_Table.h
1 #ifndef QNANO_NEW_SELECTED_MANYBODY_STATES_WITH_HASH_TABLE_DEFINED_H
2 #define QNANO_NEW_SELECTED_MANYBODY_STATES_WITH_HASH_TABLE_DEFINED_H
3 
4 #include "manybody/Selected_Manybody_States.h"
5 #include "tools/Index_Hash_Table.h"
6 
7 
9 public:
11 
12 
13  virtual size_t size()const{return HT.size();}
14  void clear(){HT.clear();}
15  bool is_contained(const Fermion_Double_Index &fi)const{
16  return HT.get_index(fi)>=0;
17  }
18 
19  int find(const Fermion_Double_Index &fi)const{
20  return HT.get_index(fi);
21  }
22  int find_check(const Fermion_Double_Index &fi)const;
23  Fermion_Double_Index find_reverse(int index)const{
24  return HT.get_key(index);
25  }
26 
27  void check_consistency()const{}
28 
29  void add_if_not_contained(const Fermion_Double_Index &fi){
30  HT.add(fi);
31  }
32  void add_from_file(const std::string &fname, int rank_e, int rank_h, int max_nr_e, int max_nr_h);
33 
34  void print(std::ostream &os=std::cout)const;
35  void print(const std::string &fname)const{
36  std::ofstream ofs(fname.c_str());
37  print(ofs);
38  }
39 
40  void add_all(int rank_e, int rank_h, int nr_e, int nr_h, int start_e=0, int start_h=0);
41  void add_singles(int nr_e, int nr_h);
42 
43 
45  : HT(other.HT){
46  }
47  Selected_Manybody_States_with_Hash_Table(size_t start_size=1024) : HT(Hash_Fermion_Double_Index,start_size){
48  }
49 
50 };
51 #endif
Definition: Selected_Manybody_States.h:13
Definition: Fermion_Double_Index.h:14
Definition: Selected_Manybody_States_with_Hash_Table.h:8