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