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 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{ namespace psimrcc{
40 
41 class CCIndex;
42 
44 public:
45  // Class Constructor and Destructor
46  explicit CCIndexIterator(std::string str);
47  explicit CCIndexIterator(std::string str,int select_irrep);
48  explicit CCIndexIterator(CCIndex* index);
49  explicit CCIndexIterator(CCIndex* index,int select_irrep);
51 
52  // Class Public Methods
53  bool first();
54  void next();
55  bool end() {return(absolute >= max_abs);}
56 
57  template <int N>
58  short ind_abs() {return tuples[absolute][N];}
59 
60  int sym() {return symmetry;}
61  size_t rel() {return relative;}
62  size_t abs() {return absolute;}
63 private:
64  // Class private functions
65  void startup(int min_sym,int max_sym);
66 
67  // Generica data
68  int nirreps;
69 
70  // Index object
72 
73  // Internal iterator
74  size_t relative; // Relative address of the current tuple
75  size_t absolute; // Absolute address of the current tuple
76  size_t max_abs; // Max absolute address of the current tuple
77  size_t min_abs; // Min absolute address of the current tuple
78  int symmetry; // Symmetry of the current tuple
80 
81  // Properties of the tuples
82  int nelements;
84  short** tuples;
85  std::vector<size_t> block_last;
86  std::vector<int> block_symmetry;
87 };
88 
89 }} /* End Namespaces */
90 
91 #endif // _psi_src_bin_psimrcc_index_iterator_h_
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:87
size_t abs()
Definition: index_iterator.h:62
std::vector< int > block_symmetry
Definition: index_iterator.h:86
std::vector< size_t > block_last
Definition: index_iterator.h:85
Definition: index_iterator.h:43
int sym()
Definition: index_iterator.h:60
void next()
Definition: index_iterator.cc:100
Definition: index.h:67
CCIndexIterator(std::string str)
Definition: index_iterator.cc:38
size_t rel()
Definition: index_iterator.h:61
int ** element_irrep
Definition: index_iterator.h:83
int nelements
Definition: index_iterator.h:82
size_t absolute
Definition: index_iterator.h:75
int nirreps
Definition: index_iterator.h:68
size_t min_abs
Definition: index_iterator.h:77
bool end()
Definition: index_iterator.h:55
bool first()
Definition: index_iterator.cc:88
short ind_abs()
Definition: index_iterator.h:58
size_t max_abs
Definition: index_iterator.h:76
size_t relative
Definition: index_iterator.h:74
short ** tuples
Definition: index_iterator.h:84
int current_block
Definition: index_iterator.h:79
int symmetry
Definition: index_iterator.h:78
CCIndex * ccindex
Definition: index_iterator.h:71
~CCIndexIterator()
Definition: index_iterator.cc:66
void startup(int min_sym, int max_sym)
Definition: index_iterator.cc:70