queso-0.56.0
Defines.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------bl-
2 //--------------------------------------------------------------------------
3 //
4 // QUESO - a library to support the Quantification of Uncertainty
5 // for Estimation, Simulation and Optimization
6 //
7 // Copyright (C) 2008-2015 The PECOS Development Team
8 //
9 // This library is free software; you can redistribute it and/or
10 // modify it under the terms of the Version 2.1 GNU Lesser General
11 // Public License as published by the Free Software Foundation.
12 //
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // Lesser General Public License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public
19 // License along with this library; if not, write to the Free Software
20 // Foundation, Inc. 51 Franklin Street, Fifth Floor,
21 // Boston, MA 02110-1301 USA
22 //
23 //-----------------------------------------------------------------------el-
24 
25 #ifndef UQ_DEFINES_H
26 #define UQ_DEFINES_H
27 
28 #include <queso/config_queso.h>
29 #include <queso/asserts.h>
30 
31 #ifdef QUESO_HAVE_GLPK
32 #define QUESO_HAS_GLPK
33 #endif
34 
35 #ifdef QUESO_HAVE_HDF5
36 #define QUESO_HAS_HDF5
37 #endif
38 
39 #ifdef QUESO_HAVE_TRILINOS
40 #define QUESO_HAS_TRILINOS
41 #endif
42 
43 #ifdef QUESO_HAVE_ANN
44 #define QUESO_HAS_ANN
45 #endif
46 
47 #ifdef QUESO_HAVE_MPI
48 #define QUESO_HAS_MPI
49 #endif
50 
52 #define QUESO_EXPECTS_LN_LIKELIHOOD_INSTEAD_OF_MINUS_2_LN
53 
54 // Use GSL inline functions
55 #define HAVE_INLINE
56 
57 // And only do GSL range-checking if we're really debugging
58 #ifndef DEBUG
59 #define GSL_RANGE_CHECK_OFF
60 #endif
61 
62 #include <iostream>
63 #include <stdlib.h> // For exit()
64 #include <set>
65 #include <vector>
66 
67 #ifdef QUESO_HAS_MPI
68 #include <mpi.h>
69 #endif
70 
71 #include <queso/asserts.h> // for queso_error handler
72 
73 namespace QUESO {
74 
76 int MyWorldfullRank();
77 
78 #define ML_CODE_HAS_NEW_RESTART_CAPABILITY
79 #undef QUESO_MEMORY_DEBUGGING
80 #undef UQ_DEBUG_PARALLEL_RUNS_IN_DETAIL
81 #undef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
82 #define QUESO_CLASSES_INSTANTIATE_NEW_MAPS
83 #undef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
84 #undef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
85 #define QUESO_USES_NEW_RNG_CLASS
86 
87 const int UQ_UNAVAILABLE_RANK = -1;
88 
89 const int UQ_OK_RC = 0;
93 const int UQ_INVALID_QOI_SPEC_RC = -4;
100 const int UQ_MATRIX_SVD_FAILED_RC = -11;
101 
102 #define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT "m"
103 #define UQ_FILE_EXTENSION_FOR_TXT_FORMAT "txt"
104 #define UQ_FILE_EXTENSION_FOR_HDF_FORMAT "h5"
105 
106 
111 // Macros
112 
113 // The following code is a copy-pasta from libmesh. The same licence applies,
114 // so we're good here.
115 //
116 // The queso_do_once macro helps us avoid redundant repeated
117 // repetitions of the same warning messages
118 #undef queso_do_once
119 #define queso_do_once(do_this) \
120  do { \
121  static bool did_this_already = false; \
122  if (!did_this_already) { \
123  did_this_already = true; \
124  do_this; \
125  } } while (0)
126 
127 // The queso_warning macro outputs a file/line/time stamped warning
128 // message, if warnings are enabled.
129 #define queso_warning(message) \
130  queso_do_once(std::cerr << message \
131  << __FILE__ << ", line " << __LINE__ << ", compiled " << __DATE__ << " at " << __TIME__ << " ***" << std::endl;)
132 
133 // The queso_deprecated macro warns that you are using obsoleted code
134 #define queso_deprecated() \
135  queso_warning("*** Warning, this code is deprecated and likely to be removed in future library versions: ");
136 
137 #define UQ_RC_MACRO(macroIRc,givenRank,where,what,retValue) \
138  queso_deprecated(); \
139  if (macroIRc) { \
140  int macroRank = givenRank; \
141  if (macroRank < 0) { \
142  macroRank = QUESO::MyWorldfullRank(); \
143  } \
144  std::cerr << "UQ RC ERROR" \
145  << ", rank " << macroRank \
146  << ", in " << where \
147  << ": " << what \
148  << ", iRc = " << macroIRc \
149  << std::endl; \
150  return retValue; \
151  }
152 
153 #define UQ_TEST_MACRO(test,givenRank,where,what,retValue) \
154  queso_deprecated(); \
155  if (test) { \
156  int macroRank = givenRank; \
157  if (macroRank < 0) { \
158  macroRank = QUESO::MyWorldfullRank(); \
159  } \
160  std::cerr << "UQ TEST ERROR" \
161  << ", rank " << macroRank \
162  << ", in " << where \
163  << ": " << what \
164  << std::endl; \
165  return retValue; \
166  }
167 
168 #define UQ_FATAL_RC_MACRO(macroIRc,givenRank,where,what) \
169  queso_deprecated(); \
170  if (macroIRc) { \
171  int macroRank = givenRank; \
172  if (macroRank < 0) { \
173  macroRank = QUESO::MyWorldfullRank(); \
174  } \
175  std::cerr << "UQ RC FATAL ERROR" \
176  << ", rank " << macroRank \
177  << ", in " << where \
178  << ": " << what \
179  << ", iRC = " << macroIRc \
180  << ". Exiting..." \
181  << std::endl; \
182  queso_error(); \
183  }
184 
185 #define UQ_FATAL_TEST_MACRO(test,givenRank,where,what) \
186  queso_deprecated(); \
187  if (test) { \
188  int macroRank = givenRank; \
189  if (macroRank < 0) { \
190  macroRank = QUESO::MyWorldfullRank(); \
191  } \
192  std::cerr << "UQ TEST FATAL ERROR" \
193  << ", rank " << macroRank \
194  << ", in " << where \
195  << ": " << what \
196  << ". Exiting..." \
197  << std::endl; \
198  queso_error(); \
199  }
200 
201 } // End namespace QUESO
202 
203 #endif // UQ_DEFINES_H
const int UQ_OK_RC
Definition: Defines.h:89
const int UQ_MATRIX_IS_NOT_POS_DEFINITE_RC
Definition: Defines.h:97
const int UQ_INVALID_QOI_SPEC_RC
Definition: Defines.h:93
const int UQ_INVALID_OBSERVABLE_SPEC_RC
Definition: Defines.h:92
int MyWorldfullRank()
Returns the rank of the calling process in the communicator.
Definition: Defines.C:33
const int UQ_INVALID_PARAMETER_SPEC_RC
Definition: Defines.h:91
const int UQ_INCOMPLETE_IMPLEMENTATION_RC
Definition: Defines.h:90
const int UQ_FAILED_TO_OPEN_FILE_RC
Definition: Defines.h:96
const int UQ_MATRIX_SVD_FAILED_RC
Definition: Defines.h:100
const int UQ_INVALID_INTERNAL_RESULT_RC
Definition: Defines.h:94
const int UQ_INVALID_SPACE_COMPONENT_ID_RC
Definition: Defines.h:99
const int UQ_FAILED_READING_FILE_RC
Definition: Defines.h:98
const int UQ_INVALID_INTERNAL_STATE_RC
Definition: Defines.h:95
const int UQ_UNAVAILABLE_RANK
Definition: Defines.h:87

Generated on Tue Nov 29 2016 10:53:10 for queso-0.56.0 by  doxygen 1.8.5