Epetra Package Browser (Single Doxygen Collection)  Development
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Epetra_ConfigDefs.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_CONFIGDEFS_H
45 #define EPETRA_CONFIGDEFS_H
46 
47 #ifndef __cplusplus
48 #define __cplusplus
49 #endif
50 
51 #include <algorithm>
52 // windows defines these but the ones from algorithm
53 // are not macros, so this will let them be used
54 // from algorithm
55 #ifdef max
56 #undef max
57 #endif
58 #ifdef min
59 #undef min
60 #endif
61 
62 #define EPETRA_MAX(x,y) std::max(x,y) /* max function */
63 #define EPETRA_MIN(x,y) std::min(x,y)/* min function */
64 //#define EPETRA_MAX(x,y) (( (x) > (y) ) ? x : y) /* max function */
65 //#define EPETRA_MIN(x,y) (( (x) < (y) ) ? x : y) /* min function */
66 #define EPETRA_SGN(x) (((x) < 0.0) ? -1.0 : 1.0) /* sign function */
67 
68 const double Epetra_MinDouble = 1.0E-100;
69 const double Epetra_MaxDouble = 1.0E+100;
70 const double Epetra_Overflow = 1.79E308; // Used to test if equilibration should be done.
71 const double Epetra_Underflow = 2.23E-308;
72 
73 #ifndef TRILINOS_NO_CONFIG_H
74 
75 /*
76  * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
77  * be undef'd here to avoid warnings when this file is included from another package.
78  * KL 11/25/02
79  */
80 #ifdef PACKAGE
81 #undef PACKAGE
82 #endif
83 
84 #ifdef PACKAGE_NAME
85 #undef PACKAGE_NAME
86 #endif
87 
88 #ifdef PACKAGE_BUGREPORT
89 #undef PACKAGE_BUGREPORT
90 #endif
91 
92 #ifdef PACKAGE_STRING
93 #undef PACKAGE_STRING
94 #endif
95 
96 #ifdef PACKAGE_TARNAME
97 #undef PACKAGE_TARNAME
98 #endif
99 
100 #ifdef PACKAGE_VERSION
101 #undef PACKAGE_VERSION
102 #endif
103 
104 #ifdef VERSION
105 #undef VERSION
106 #endif
107 
108 #include <Epetra_config.h>
109 
110 #ifdef HAVE_MPI
111 #ifndef EPETRA_MPI
112 #define EPETRA_MPI
113 #endif
114 #endif
115 
116 #include <cstdlib>
117 
118 #include <cstdio>
119 using std::sprintf;
120 using std::sscanf;
121 using std::FILE;
122 using std::fopen;
123 using std::fclose;
124 using std::fgets;
125 using std::fprintf;
126 
127 #include <cassert>
128 
129 #include <cstring>
130 #include <string>
131 
132 #include <iostream>
133 
134 #include <sstream>
135 
136 #include <cmath>
137 using std::rand;
138 using std::fabs;
139 using std::atoi;
140 using std::atof;
141 #ifndef __IBMCPP__
142 using std::abs;
143 #endif
144 using std::pow;
145 using std::sqrt;
146 using std::asin;
147 using std::sin;
148 using std::cos;
149 using std::ceil;
150 using std::floor;
151 
152 #include <iomanip>
153 
154 //using std::string;
155 using std::memcpy;
156 using std::strcpy;
157 using std::strcmp;
158 using std::strlen;
159 using std::strchr;
160 using std::strtok;
161 /*
162 For xlC 12.1, malloc and related functions are provided outside the std
163 namespace, so the below three using statements cause conflicting declarations.
164 */
165 #ifndef __clang__
166 #if !defined __IBMCPP__ || ( __IBMCPP__ != 1210 )
167 using std::realloc;
168 using std::malloc;
169 using std::free;
170 #endif
171 #endif
172 
173 //using std::istream;
174 //using std::ostream;
175 //using std::cerr;
176 //using std::cout;
177 //using std::endl;
178 //using std::flush;
179 
180 using std::abort;
181 using std::exit;
182 
183 /*-----------------------------------------------------------------------
184  Must refine the following up to #else TRILINOS_NO_CONFIG_H is defined
185  -----------------------------------------------------------------------*/
186 
187 #ifdef EPETRA_SIMULATE_BOOL
188 #ifdef bool
189 #undef bool
190 #endif
191 #ifdef true
192 #undef true
193 #endif
194 #ifdef false
195 #undef false
196 #endif
197 
198 #define bool int
199 #define true 1
200 #define false 0
201 
202 #endif
203 
204 #ifndef HAVE_FORMAT_IO
205 const bool Epetra_FormatStdout = false; // Set true if the ostream << operator should format output
206 #else
207 const bool Epetra_FormatStdout = true;
208 #endif
209 
210 // Define DefultTracebackMode (HAVE_WARNING_MESSAGES and HAVE_FATAL_MESSAGES can be defined
211 // via the configure script command line)
212 
213 #ifdef HAVE_WARNING_MESSAGES
214 const int DefaultTracebackMode = 2;
215 #elif defined HAVE_FATAL_MESSAGES
216 const int DefaultTracebackMode = 1;
217 #else
218 const int DefaultTracebackMode = 0;
219 #endif
220 
221 #ifndef HAVE_FORTRAN_SUPPORT
222 #ifndef FORTRAN_DISABLED
223 #define FORTRAN_DISABLED
224 #endif
225 #endif
226 
227 #else /*TRILINOS_NO_CONFIG_H is defined*/
228 
229 #ifndef __cplusplus
230 #define __cplusplus
231 #endif
232 
233 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
234 
235 #include <stdlib.h>
236 #include <stdio.h>
237 #include <assert.h>
238 #include <iostream>
239 #include <math.h>
240 #include <string>
241 
242 //using std::string;
243 //using std::istream;
244 //using std::ostream;
245 //using std::cerr;
246 //using std::cout;
247 //using std::endl;
248 //using std::flush;
249 
250 #else
251 
252 #include <cstdlib>
253 #include <cstdio>
254 #include <cassert>
255 #include <iostream>
256 #include <cmath>
257 #include <string>
258 
259 //using std::string;
260 //using std::istream;
261 //using std::ostream;
262 //using std::cerr;
263 //using std::cout;
264 //using std::endl;
265 //using std::flush;
266 
267 #endif
268 
269 
270 
271 #ifdef EPETRA_SIMULATE_BOOL
272 #ifdef bool
273 #undef bool
274 #endif
275 #ifdef true
276 #undef true
277 #endif
278 #ifdef false
279 #undef false
280 #endif
281 
282 #define bool int
283 #define true 1
284 #define false 0
285 
286 #endif
287 
288 const bool Epetra_FormatStdout = true; // Set true if the ostream << operator should format output
289 const int DefaultTracebackMode = 1;
290 
291 #endif /*TRILINOS_NO_CONFIG_H*/
292 
293 // Delete any previous definition of EPETRA_NO_ERROR_REPORTS
294 
295 #ifdef EPETRA_CHK_ERR
296 #undef EPETRA_CHK_ERR
297 #endif
298 #ifdef EPETRA_CHK_PTR
299 #undef EPETRA_CHK_PTR
300 #endif
301 #ifdef EPETRA_CHK_REF
302 #undef EPETRA_CHK_REF
303 #endif
304 
305 // Great little macro obtained from Alan Williams (modified for dynamic switching on/off)
306 
307 #define EPETRA_CHK_ERR(a) { { int epetra_err = a; \
308  if ((epetra_err < 0 && Epetra_Object::GetTracebackMode() > 0) || \
309  (epetra_err > 0 && Epetra_Object::GetTracebackMode() > 1)) { \
310  Epetra_Object::GetTracebackStream() << "Epetra ERROR " << epetra_err << ", " \
311  << __FILE__ << ", line " << __LINE__ << std::endl; }\
312  if (epetra_err != 0) return(epetra_err); }\
313  }
314 
315 // Extension of same macro for pointer, returns zero if bad
316 
317 #define EPETRA_CHK_PTR(a) { if (a == 0 && Epetra_Object::GetTracebackMode() > 0) { \
318  Epetra_Object::GetTracebackStream() << "Epetra returning zero pointer " << ", " \
319  << __FILE__ << ", line " << __LINE__ << std::endl; } \
320  return(a); \
321  }
322 // Extension of same macro for reference, returns a default reference
323 
324 #define EPETRA_CHK_REF(a) { if (Epetra_Object::GetTracebackMode() > 0) {\
325  Epetra_Object::GetTracebackStream() << "Epetra returning default reference " << ", " \
326  << __FILE__ << ", line " << __LINE__ << std::endl; } \
327  return(a); \
328  }
329 
330 #include "Epetra_DLLExportMacro.h"
331 
332 #endif /* EPETRA_CONFIGDEFS_H */
const bool Epetra_FormatStdout
const double Epetra_Underflow
const double Epetra_MaxDouble
const double Epetra_MinDouble
const double Epetra_Overflow
const int DefaultTracebackMode