Psi4
index_iterator.h
Go to the documentation of this file.
1 /*
2  * @BEGIN LICENSE
3  *
4  * Psi4: an open-source quantum chemistry software package
5  *
6  * Copyright (c) 2007-2017 The Psi4 Developers.
7  *
8  * The copyrights for code used from other parties are included in
9  * the corresponding files.
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License along
22  * with this program; if not, write to the Free Software Foundation, Inc.,
23  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24  *
25  * @END LICENSE
26  */
27 
28 #ifndef _psi_src_bin_psimrcc_index_iterator_h_
29 #define _psi_src_bin_psimrcc_index_iterator_h_
30 
36 #include <string>
37 
38 namespace psi{ namespace psimrcc{
39 
40 class CCIndex;
41 
43 public:
44  // Class Constructor and Destructor
45  explicit CCIndexIterator(std::string str);
46  explicit CCIndexIterator(std::string str,int select_irrep);
47  explicit CCIndexIterator(CCIndex* index);
48  explicit CCIndexIterator(CCIndex* index,int select_irrep);
50 
51  // Class Public Methods
52  bool first();
53  void next();
54  bool end() {return(absolute >= max_abs);}
55 
56  template <int N>
57  short ind_abs() {return tuples[absolute][N];}
58 
59  int sym() {return symmetry;}
60  size_t rel() {return relative;}
61  size_t abs() {return absolute;}
62 private:
63  // Class private functions
64  void startup(int min_sym,int max_sym);
65 
66  // Generica data
67  int nirreps;
68 
69  // Index object
71 
72  // Internal iterator
73  size_t relative; // Relative address of the current tuple
74  size_t absolute; // Absolute address of the current tuple
75  size_t max_abs; // Max absolute address of the current tuple
76  size_t min_abs; // Min absolute address of the current tuple
77  int symmetry; // Symmetry of the current tuple
79 
80  // Properties of the tuples
81  int nelements;
83  short** tuples;
84  std::vector<size_t> block_last;
85  std::vector<int> block_symmetry;
86 };
87 
88 }} /* End Namespaces */
89 
90 #endif // _psi_src_bin_psimrcc_index_iterator_h_
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:86
size_t abs()
Definition: index_iterator.h:61
std::vector< int > block_symmetry
Definition: index_iterator.h:85
std::vector< size_t > block_last
Definition: index_iterator.h:84
Definition: index_iterator.h:42
int sym()
Definition: index_iterator.h:59
void next()
Definition: index_iterator.cc:99
Definition: index.h:66
CCIndexIterator(std::string str)
Definition: index_iterator.cc:37
size_t rel()
Definition: index_iterator.h:60
int ** element_irrep
Definition: index_iterator.h:82
int nelements
Definition: index_iterator.h:81
size_t absolute
Definition: index_iterator.h:74
int nirreps
Definition: index_iterator.h:67
size_t min_abs
Definition: index_iterator.h:76
bool end()
Definition: index_iterator.h:54
bool first()
Definition: index_iterator.cc:87
short ind_abs()
Definition: index_iterator.h:57
size_t max_abs
Definition: index_iterator.h:75
size_t relative
Definition: index_iterator.h:73
short ** tuples
Definition: index_iterator.h:83
int current_block
Definition: index_iterator.h:78
int symmetry
Definition: index_iterator.h:77
CCIndex * ccindex
Definition: index_iterator.h:70
~CCIndexIterator()
Definition: index_iterator.cc:65
void startup(int min_sym, int max_sym)
Definition: index_iterator.cc:69