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

Generated on Tue Jun 5 2018 19:48:54 for queso-0.57.1 by  doxygen 1.8.5