queso-0.53.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 
48 #define QUESO_HAS_MPI
49 
51 #define QUESO_EXPECTS_LN_LIKELIHOOD_INSTEAD_OF_MINUS_2_LN
52 
53 #include <iostream>
54 #include <stdlib.h> // For exit()
55 #include <set>
56 #include <vector>
57 #include <mpi.h>
58 #include <queso/asserts.h> // for queso_error handler
59 
60 namespace QUESO {
61 
63 int MyWorldfullRank();
64 
65 #define ML_CODE_HAS_NEW_RESTART_CAPABILITY
66 #undef QUESO_MEMORY_DEBUGGING
67 #undef UQ_DEBUG_PARALLEL_RUNS_IN_DETAIL
68 #undef UQ_ALSO_COMPUTE_MDFS_WITHOUT_KDE
69 #define QUESO_CLASSES_INSTANTIATE_NEW_MAPS
70 #undef QUESO_USES_SEQUENCE_STATISTICAL_OPTIONS
71 #undef QUESO_COMPUTES_EXTRA_POST_PROCESSING_STATISTICS
72 #define QUESO_USES_NEW_RNG_CLASS
73 
74 const int UQ_UNAVAILABLE_RANK = -1;
75 
76 const int UQ_OK_RC = 0;
80 const int UQ_INVALID_QOI_SPEC_RC = -4;
87 const int UQ_MATRIX_SVD_FAILED_RC = -11;
88 
89 #define UQ_FILE_EXTENSION_FOR_MATLAB_FORMAT "m"
90 #define UQ_FILE_EXTENSION_FOR_HDF_FORMAT "h5"
91 
92 
97 // Macros
98 
99 // The following code is a copy-pasta from libmesh. The same licence applies,
100 // so we're good here.
101 //
102 // The queso_do_once macro helps us avoid redundant repeated
103 // repetitions of the same warning messages
104 #undef queso_do_once
105 #define queso_do_once(do_this) \
106  do { \
107  static bool did_this_already = false; \
108  if (!did_this_already) { \
109  did_this_already = true; \
110  do_this; \
111  } } while (0)
112 
113 // The queso_warning macro outputs a file/line/time stamped warning
114 // message, if warnings are enabled.
115 #define queso_warning(message) \
116  queso_do_once(std::cerr << message \
117  << __FILE__ << ", line " << __LINE__ << ", compiled " << __DATE__ << " at " << __TIME__ << " ***" << std::endl;)
118 
119 // The queso_deprecated macro warns that you are using obsoleted code
120 #define queso_deprecated() \
121  queso_warning("*** Warning, this code is deprecated and likely to be removed in future library versions: ");
122 
123 #define UQ_RC_MACRO(macroIRc,givenRank,where,what,retValue) \
124  queso_deprecated(); \
125  if (macroIRc) { \
126  int macroRank = givenRank; \
127  if (macroRank < 0) { \
128  macroRank = QUESO::MyWorldfullRank(); \
129  } \
130  std::cerr << "UQ RC ERROR" \
131  << ", rank " << macroRank \
132  << ", in " << where \
133  << ": " << what \
134  << ", iRc = " << macroIRc \
135  << std::endl; \
136  return retValue; \
137  }
138 
139 #define UQ_TEST_MACRO(test,givenRank,where,what,retValue) \
140  queso_deprecated(); \
141  if (test) { \
142  int macroRank = givenRank; \
143  if (macroRank < 0) { \
144  macroRank = QUESO::MyWorldfullRank(); \
145  } \
146  std::cerr << "UQ TEST ERROR" \
147  << ", rank " << macroRank \
148  << ", in " << where \
149  << ": " << what \
150  << std::endl; \
151  return retValue; \
152  }
153 
154 #define UQ_FATAL_RC_MACRO(macroIRc,givenRank,where,what) \
155  queso_deprecated(); \
156  if (macroIRc) { \
157  int macroRank = givenRank; \
158  if (macroRank < 0) { \
159  macroRank = QUESO::MyWorldfullRank(); \
160  } \
161  std::cerr << "UQ RC FATAL ERROR" \
162  << ", rank " << macroRank \
163  << ", in " << where \
164  << ": " << what \
165  << ", iRC = " << macroIRc \
166  << ". Exiting..." \
167  << std::endl; \
168  queso_error(); \
169  }
170 
171 #define UQ_FATAL_TEST_MACRO(test,givenRank,where,what) \
172  queso_deprecated(); \
173  if (test) { \
174  int macroRank = givenRank; \
175  if (macroRank < 0) { \
176  macroRank = QUESO::MyWorldfullRank(); \
177  } \
178  std::cerr << "UQ TEST FATAL ERROR" \
179  << ", rank " << macroRank \
180  << ", in " << where \
181  << ": " << what \
182  << ". Exiting..." \
183  << std::endl; \
184  queso_error(); \
185  }
186 
187 } // End namespace QUESO
188 
189 #endif // UQ_DEFINES_H
const int UQ_UNAVAILABLE_RANK
Definition: Defines.h:74
const int UQ_FAILED_TO_OPEN_FILE_RC
Definition: Defines.h:83
const int UQ_MATRIX_SVD_FAILED_RC
Definition: Defines.h:87
const int UQ_FAILED_READING_FILE_RC
Definition: Defines.h:85
const int UQ_INVALID_INTERNAL_STATE_RC
Definition: Defines.h:82
int MyWorldfullRank()
Returns the rank of the calling process in the communicator.
Definition: Defines.C:30
const int UQ_MATRIX_IS_NOT_POS_DEFINITE_RC
Definition: Defines.h:84
const int UQ_INVALID_PARAMETER_SPEC_RC
Definition: Defines.h:78
const int UQ_INVALID_INTERNAL_RESULT_RC
Definition: Defines.h:81
const int UQ_OK_RC
Definition: Defines.h:76
const int UQ_INVALID_QOI_SPEC_RC
Definition: Defines.h:80
const int UQ_INCOMPLETE_IMPLEMENTATION_RC
Definition: Defines.h:77
const int UQ_INVALID_SPACE_COMPONENT_ID_RC
Definition: Defines.h:86
const int UQ_INVALID_OBSERVABLE_SPEC_RC
Definition: Defines.h:79

Generated on Thu Jun 11 2015 13:52:31 for queso-0.53.0 by  doxygen 1.8.5