Psi4
debugging.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-2019 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_debugging_h
30 #define _psi_src_bin_psimrcc_debugging_h
31 /***************************************************************************
32  * PSIMRCC
33  * Copyright (C) 2007 by Francesco Evangelista and Andrew Simmonett
34  * frank@ccc.uga.edu andysim@ccc.uga.edu
35  * A multireference coupled cluster code
36  ***********
37  ****************************************************************/
39 
40 namespace psi {
41 namespace psimrcc {
42 
43 // #define NODEBUG
44 #ifdef NODEBUG
45 #define DEBUGGING(level, statements)
46 #else
47 #define DEBUGGING(level, statements) \
48  if (debugging->is_level(level)) { \
49  statements \
50  }
51 #endif
52 
53 #ifdef NODEBUG
54 #define START_TIMER(level, title)
55 #else
56 #define START_TIMER(level, title) \
57  Timer timer; \
58  if (debugging->is_level(level)) { \
59  outfile->Printf("\n %-48s ...", title); \
60  }
61 #endif
62 
63 #ifdef NODEBUG
64 #define END_TIMER(level)
65 #else
66 #define END_TIMER(level) \
67  if (debugging->is_level(level)) { \
68  outfile->Printf(" done. Timing %10.4f s", timer.get()); \
69  }
70 #endif
71 
75 class Debugging {
76  public:
77  Debugging(Options& options);
78  ~Debugging() { delete[] level; }
79 
80  bool is_level(int n) { return (n <= 10 ? level[n] : false); }
81 
82  private:
84  bool* level;
85 };
86 
87 extern Debugging* debugging;
88 }
89 } // namespace psi
90 
91 #endif // _psi_src_bin_psimrcc_debugging_h
PsiReturnType psimrcc(SharedWavefunction, Options &)
Definition: psimrcc/main.cc:86
Debugging * debugging
Definition: psimrcc/main.cc:83
Definition: debugging.h:75
Options & options_
Definition: debugging.h:83
bool * level
Definition: debugging.h:84
Definition: liboptions.h:352
Debugging(Options &options)
Definition: debugging.cc:42
bool is_level(int n)
Definition: debugging.h:80
~Debugging()
Definition: debugging.h:78