Psi4
sblock_vector.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_lib_libmemtrix_sblock_vector_h_
29 #define _psi_src_lib_libmemtrix_sblock_vector_h_
30 
31 #include <string>
32 
33 #include "block_vector.h"
34 
35 namespace psi{ namespace mcscf{
36 
37 // Smart version of BlockVector
39 {
40 public:
41  SBlockVector();
42  SBlockVector(std::string label, int nirreps, int*& rows_size);
43  SBlockVector(std::string label, int nirreps, vecint& rows_size);
46  block_vector_ = 0;}
47 
48  // Manual allocation
49  void allocate(std::string label, int nirreps, int*& rows_size);
50  void allocate(std::string label, int nirreps, vecint& rows_size);
51 
53  if(block_vector_){
55  block_vector_ = 0;
56  }
57  }
58 
59  // Copy constructor and assignment operator
60  SBlockVector (const SBlockVector& src);
62 
63  // Allow access to the implementation object
64  const BlockVector* operator-> () const {return block_vector_;}
66 
67  // Access the implementation object
69 
70  // Checking functions
71  bool is_allocated() {return (block_vector_);}
72  void check(const char* cstr);
73 
74  void copy(SBlockVector& source);
75 private:
76  SBlockVector(BlockVector* block_vector);
77 
79 };
80 
81 }}
82 
83 #endif // _psi_src_lib_libmemtrix_sblock_vector_h_
void copy(SBlockVector &source)
Definition: sblock_vector.cc:102
void check(const char *cstr)
Definition: sblock_vector.cc:93
const BlockVector * operator->() const
Definition: sblock_vector.h:64
bool subtract_reference()
Definition: block_vector.h:63
std::vector< int > vecint
Definition: block_matrix.h:35
SharedWavefunction mcscf(SharedWavefunction, Options &)
Definition: mcscf.cc:72
Definition: block_vector.h:41
void allocate(std::string label, int nirreps, int *&rows_size)
Definition: sblock_vector.cc:69
BlockVector * block_vector_
Definition: sblock_vector.h:78
void subtract_reference()
Definition: sblock_vector.h:52
BlockVector * getBlockVector()
Definition: sblock_vector.h:68
Definition: sblock_vector.h:38
SBlockVector()
Definition: sblock_vector.cc:38
SBlockVector & operator=(const SBlockVector &src)
Definition: sblock_vector.cc:81
bool is_allocated()
Definition: sblock_vector.h:71
~SBlockVector()
Definition: sblock_vector.h:44