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 #if defined(Epetra_SHOW_DEPRECATED_WARNINGS)
48 #ifdef __GNUC__
49 #warning "The Epetra package is deprecated"
50 #endif
51 #endif
52 
53 
54 
55 #ifndef __cplusplus
56 #define __cplusplus
57 #endif
58 
59 #include <algorithm>
60 // windows defines these but the ones from algorithm
61 // are not macros, so this will let them be used
62 // from algorithm
63 #ifdef max
64 #undef max
65 #endif
66 #ifdef min
67 #undef min
68 #endif
69 
70 #define EPETRA_MAX(x,y) std::max(x,y) /* max function */
71 #define EPETRA_MIN(x,y) std::min(x,y)/* min function */
72 //#define EPETRA_MAX(x,y) (( (x) > (y) ) ? x : y) /* max function */
73 //#define EPETRA_MIN(x,y) (( (x) < (y) ) ? x : y) /* min function */
74 #define EPETRA_SGN(x) (((x) < 0.0) ? -1.0 : 1.0) /* sign function */
75 
76 const double Epetra_MinDouble = 1.0E-100;
77 const double Epetra_MaxDouble = 1.0E+100;
78 const double Epetra_Overflow = 1.79E308; // Used to test if equilibration should be done.
79 const double Epetra_Underflow = 2.23E-308;
80 
81 #ifndef TRILINOS_NO_CONFIG_H
82 
83 /*
84  * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
85  * be undef'd here to avoid warnings when this file is included from another package.
86  * KL 11/25/02
87  */
88 #ifdef PACKAGE
89 #undef PACKAGE
90 #endif
91 
92 #ifdef PACKAGE_NAME
93 #undef PACKAGE_NAME
94 #endif
95 
96 #ifdef PACKAGE_BUGREPORT
97 #undef PACKAGE_BUGREPORT
98 #endif
99 
100 #ifdef PACKAGE_STRING
101 #undef PACKAGE_STRING
102 #endif
103 
104 #ifdef PACKAGE_TARNAME
105 #undef PACKAGE_TARNAME
106 #endif
107 
108 #ifdef PACKAGE_VERSION
109 #undef PACKAGE_VERSION
110 #endif
111 
112 #ifdef VERSION
113 #undef VERSION
114 #endif
115 
116 #include <Epetra_config.h>
117 
118 #ifdef HAVE_MPI
119 #ifndef EPETRA_MPI
120 #define EPETRA_MPI
121 #endif
122 #endif
123 
124 #include <cstdlib>
125 
126 #include <cstdio>
127 using std::sprintf;
128 using std::sscanf;
129 using std::FILE;
130 using std::fopen;
131 using std::fclose;
132 using std::fgets;
133 using std::fprintf;
134 
135 #include <cassert>
136 
137 #include <cstring>
138 #include <string>
139 
140 #include <iostream>
141 
142 #include <sstream>
143 
144 #include <cmath>
145 using std::rand;
146 using std::fabs;
147 using std::atoi;
148 using std::atof;
149 #ifndef __IBMCPP__
150 using std::abs;
151 #endif
152 using std::pow;
153 using std::sqrt;
154 using std::asin;
155 using std::sin;
156 using std::cos;
157 using std::ceil;
158 using std::floor;
159 
160 #include <iomanip>
161 
162 //using std::string;
163 using std::memcpy;
164 using std::strcpy;
165 using std::strcmp;
166 using std::strlen;
167 using std::strchr;
168 using std::strtok;
169 /*
170 For xlC 12.1, malloc and related functions are provided outside the std
171 namespace, so the below three using statements cause conflicting declarations.
172 */
173 #ifndef __clang__
174 #if !defined __IBMCPP__ || ( __IBMCPP__ != 1210 )
175 using std::realloc;
176 using std::malloc;
177 using std::free;
178 #endif
179 #endif
180 
181 //using std::istream;
182 //using std::ostream;
183 //using std::cerr;
184 //using std::cout;
185 //using std::endl;
186 //using std::flush;
187 
188 using std::abort;
189 using std::exit;
190 
191 /*-----------------------------------------------------------------------
192  Must refine the following up to #else TRILINOS_NO_CONFIG_H is defined
193  -----------------------------------------------------------------------*/
194 
195 #ifdef EPETRA_SIMULATE_BOOL
196 #ifdef bool
197 #undef bool
198 #endif
199 #ifdef true
200 #undef true
201 #endif
202 #ifdef false
203 #undef false
204 #endif
205 
206 #define bool int
207 #define true 1
208 #define false 0
209 
210 #endif
211 
212 #ifndef HAVE_FORMAT_IO
213 const bool Epetra_FormatStdout = false; // Set true if the ostream << operator should format output
214 #else
215 const bool Epetra_FormatStdout = true;
216 #endif
217 
218 // Define DefultTracebackMode (HAVE_WARNING_MESSAGES and HAVE_FATAL_MESSAGES can be defined
219 // via the configure script command line)
220 
221 #ifdef HAVE_WARNING_MESSAGES
222 const int DefaultTracebackMode = 2;
223 #elif defined HAVE_FATAL_MESSAGES
224 const int DefaultTracebackMode = 1;
225 #else
226 const int DefaultTracebackMode = 0;
227 #endif
228 
229 #ifndef HAVE_FORTRAN_SUPPORT
230 #ifndef FORTRAN_DISABLED
231 #define FORTRAN_DISABLED
232 #endif
233 #endif
234 
235 #else /*TRILINOS_NO_CONFIG_H is defined*/
236 
237 #ifndef __cplusplus
238 #define __cplusplus
239 #endif
240 
241 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
242 
243 #include <stdlib.h>
244 #include <stdio.h>
245 #include <assert.h>
246 #include <iostream>
247 #include <math.h>
248 #include <string>
249 
250 //using std::string;
251 //using std::istream;
252 //using std::ostream;
253 //using std::cerr;
254 //using std::cout;
255 //using std::endl;
256 //using std::flush;
257 
258 #else
259 
260 #include <cstdlib>
261 #include <cstdio>
262 #include <cassert>
263 #include <iostream>
264 #include <cmath>
265 #include <string>
266 
267 //using std::string;
268 //using std::istream;
269 //using std::ostream;
270 //using std::cerr;
271 //using std::cout;
272 //using std::endl;
273 //using std::flush;
274 
275 #endif
276 
277 
278 
279 #ifdef EPETRA_SIMULATE_BOOL
280 #ifdef bool
281 #undef bool
282 #endif
283 #ifdef true
284 #undef true
285 #endif
286 #ifdef false
287 #undef false
288 #endif
289 
290 #define bool int
291 #define true 1
292 #define false 0
293 
294 #endif
295 
296 const bool Epetra_FormatStdout = true; // Set true if the ostream << operator should format output
297 const int DefaultTracebackMode = 1;
298 
299 #endif /*TRILINOS_NO_CONFIG_H*/
300 
301 // Delete any previous definition of EPETRA_NO_ERROR_REPORTS
302 
303 #ifdef EPETRA_CHK_ERR
304 #undef EPETRA_CHK_ERR
305 #endif
306 #ifdef EPETRA_CHK_PTR
307 #undef EPETRA_CHK_PTR
308 #endif
309 #ifdef EPETRA_CHK_REF
310 #undef EPETRA_CHK_REF
311 #endif
312 
313 // Great little macro obtained from Alan Williams (modified for dynamic switching on/off)
314 
315 #define EPETRA_CHK_ERR(a) { { int epetra_err = a; \
316  if ((epetra_err < 0 && Epetra_Object::GetTracebackMode() > 0) || \
317  (epetra_err > 0 && Epetra_Object::GetTracebackMode() > 1)) { \
318  Epetra_Object::GetTracebackStream() << "Epetra ERROR " << epetra_err << ", " \
319  << __FILE__ << ", line " << __LINE__ << std::endl; }\
320  if (epetra_err != 0) return(epetra_err); }\
321  }
322 
323 // Extension of same macro for pointer, returns zero if bad
324 
325 #define EPETRA_CHK_PTR(a) { if (a == 0 && Epetra_Object::GetTracebackMode() > 0) { \
326  Epetra_Object::GetTracebackStream() << "Epetra returning zero pointer " << ", " \
327  << __FILE__ << ", line " << __LINE__ << std::endl; } \
328  return(a); \
329  }
330 // Extension of same macro for reference, returns a default reference
331 
332 #define EPETRA_CHK_REF(a) { if (Epetra_Object::GetTracebackMode() > 0) {\
333  Epetra_Object::GetTracebackStream() << "Epetra returning default reference " << ", " \
334  << __FILE__ << ", line " << __LINE__ << std::endl; } \
335  return(a); \
336  }
337 
338 #include "Epetra_DLLExportMacro.h"
339 
340 #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