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