Epetra_ConfigDefs.h

Go to the documentation of this file.
00001 
00002 //@HEADER
00003 /*
00004 ************************************************************************
00005 
00006               Epetra: Linear Algebra Services Package 
00007                 Copyright (2001) Sandia Corporation
00008 
00009 Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00010 license for use of this work by or on behalf of the U.S. Government.
00011 
00012 This library is free software; you can redistribute it and/or modify
00013 it under the terms of the GNU Lesser General Public License as
00014 published by the Free Software Foundation; either version 2.1 of the
00015 License, or (at your option) any later version.
00016  
00017 This library is distributed in the hope that it will be useful, but
00018 WITHOUT ANY WARRANTY; without even the implied warranty of
00019 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 Lesser General Public License for more details.
00021  
00022 You should have received a copy of the GNU Lesser General Public
00023 License along with this library; if not, write to the Free Software
00024 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00025 USA
00026 Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00027 
00028 ************************************************************************
00029 */
00030 //@HEADER
00031 
00032 #ifndef EPETRA_CONFIGDEFS_H
00033 #define EPETRA_CONFIGDEFS_H
00034 
00035 #ifndef __cplusplus
00036 #define __cplusplus
00037 #endif
00038 
00039 #define EPETRA_MAX(x,y) (( (x) > (y) ) ? x : y)     /* max function  */
00040 #define EPETRA_MIN(x,y) (( (x) < (y) ) ? x : y)     /* min function  */
00041 #define EPETRA_SGN(x) (((x) < 0.0) ? -1.0 : 1.0)  /* sign function */
00042 
00043 const double Epetra_MinDouble = 1.0E-100;
00044 const double Epetra_MaxDouble = 1.0E+100;
00045 const double Epetra_Overflow = 1.79E308; // Used to test if equilibration should be done.
00046 const double Epetra_Underflow = 2.23E-308;
00047 
00048 #ifdef HAVE_CONFIG_H
00049 
00050 /*
00051  * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
00052  * be undef'd here to avoid warnings when this file is included from another package.
00053  * KL 11/25/02
00054  */
00055 #ifdef PACKAGE
00056 #undef PACKAGE
00057 #endif
00058 
00059 #ifdef PACKAGE_NAME
00060 #undef PACKAGE_NAME
00061 #endif
00062 
00063 #ifdef PACKAGE_BUGREPORT
00064 #undef PACKAGE_BUGREPORT
00065 #endif
00066 
00067 #ifdef PACKAGE_STRING
00068 #undef PACKAGE_STRING
00069 #endif
00070 
00071 #ifdef PACKAGE_TARNAME
00072 #undef PACKAGE_TARNAME
00073 #endif
00074 
00075 #ifdef PACKAGE_VERSION
00076 #undef PACKAGE_VERSION
00077 #endif
00078 
00079 #ifdef VERSION
00080 #undef VERSION
00081 #endif
00082 
00083 #include <Epetra_config.h>
00084 
00085 #ifdef HAVE_MPI
00086 #ifndef EPETRA_MPI
00087 #define EPETRA_MPI
00088 #endif
00089 #endif
00090 
00091 #ifdef HAVE_CSTDLIB
00092 #include <cstdlib>
00093 #endif
00094 #ifdef HAVE_STDLIB_H
00095 #include <stdlib.h>
00096 #endif
00097 
00098 #ifdef HAVE_CSTDIO
00099 #include <cstdio>
00100 using std::sprintf;
00101 #endif
00102 #ifdef HAVE_STDIO_H
00103 #include <stdio.h>
00104 #endif
00105 
00106 #ifdef HAVE_CASSERT
00107 #include <cassert>
00108 #else
00109 #include <assert.h>
00110 #endif
00111 
00112 #ifdef HAVE_STRING
00113 #include <string>
00114 #endif
00115 #ifdef HAVE_STRING_H
00116 #include <string.h>
00117 #endif
00118 
00119 #ifdef HAVE_IOSTREAM
00120 #include <iostream>
00121 #else
00122 #include <iostream.h>
00123 #endif
00124 
00125 
00126 #ifdef HAVE_CMATH
00127 #include <cmath>
00128 using std::rand;
00129 #endif
00130 #ifdef HAVE_MATH_H
00131 #include <math.h>
00132 #endif
00133 
00134 #ifdef HAVE_IOMANIP
00135 #include <iomanip>
00136 #else
00137 #include <iomanip.h>
00138 #endif
00139 
00140 #ifdef HAVE_STRING
00141 using std::string;
00142 #endif
00143 
00144 #ifdef HAVE_IOSTREAM
00145 using std::istream;
00146 using std::ostream;
00147 using std::cerr;
00148 using std::cout;
00149 using std::endl;
00150 using std::flush;
00151 #endif
00152 
00153 /*-----------------------------------------------------------------------
00154   Must refine the following up to #else HAVE_CONFIG_H is not defined
00155   -----------------------------------------------------------------------*/
00156 
00157 #ifdef EPETRA_SIMULATE_BOOL
00158 #ifdef bool
00159 #undef bool
00160 #endif
00161 #ifdef true
00162 #undef true
00163 #endif
00164 #ifdef false
00165 #undef false
00166 #endif
00167 
00168 #define bool int
00169 #define true 1
00170 #define false 0
00171 
00172 #endif
00173 
00174 #ifndef HAVE_FORMAT_IO
00175 const bool Epetra_FormatStdout = false; // Set true if the ostream << operator should format output
00176 #else
00177 const bool Epetra_FormatStdout = true;
00178 #endif
00179 
00180 // Define DefultTracebackMode (HAVE_WARNING_MESSAGES and HAVE_FATAL_MESSAGES can be defined
00181 // via the configure script command line)
00182 
00183 #ifdef HAVE_WARNING_MESSAGES
00184 const int DefaultTracebackMode = 2;
00185 #elif defined HAVE_FATAL_MESSAGES
00186 const int DefaultTracebackMode = 1;
00187 #else
00188 const int DefaultTracebackMode = 0;
00189 #endif
00190 
00191 #else /*HAVE_CONFIG_H is not defined*/
00192 
00193 #ifndef __cplusplus
00194 #define __cplusplus
00195 #endif
00196 
00197 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
00198 
00199 #include <stdlib.h>
00200 #include <stdio.h>
00201 #include <assert.h>
00202 #include <iostream>
00203 #include <math.h>
00204 #include <string>
00205 
00206 using std::string;
00207 using std::istream;
00208 using std::ostream;
00209 using std::cerr;
00210 using std::cout;
00211 using std::endl;
00212 using std::flush;
00213 
00214 #else
00215 
00216 #include <cstdlib>
00217 #include <cstdio>
00218 #include <cassert>
00219 #include <iostream>
00220 #include <cmath>
00221 #include <string>
00222 
00223 using std::string;
00224 using std::istream;
00225 using std::ostream;
00226 using std::cerr;
00227 using std::cout;
00228 using std::endl;
00229 using std::flush;
00230 
00231 #endif
00232 
00233 
00234 
00235 #ifdef EPETRA_SIMULATE_BOOL
00236 #ifdef bool
00237 #undef bool
00238 #endif
00239 #ifdef true
00240 #undef true
00241 #endif
00242 #ifdef false
00243 #undef false
00244 #endif
00245 
00246 #define bool int
00247 #define true 1
00248 #define false 0
00249 
00250 #endif
00251 
00252 const bool Epetra_FormatStdout = true; // Set true if the ostream << operator should format output
00253 const int DefaultTracebackMode = 1;
00254 
00255 #endif /*HAVE_CONFIG_H*/
00256 
00257 // Delete any previous definition of EPETRA_NO_ERROR_REPORTS
00258 
00259 #ifdef EPETRA_CHK_ERR
00260 #undef EPETRA_CHK_ERR
00261 #endif
00262 #ifdef EPETRA_CHK_PTR
00263 #undef EPETRA_CHK_PTR
00264 #endif
00265 #ifdef EPETRA_CHK_REF
00266 #undef EPETRA_CHK_REF
00267 #endif
00268 
00269 // Great little macro obtained from Alan Williams (modified for dynamic switching on/off)
00270 
00271 #define EPETRA_CHK_ERR(a) { { int epetra_err = a; \
00272                               if ((epetra_err < 0 && Epetra_Object::GetTracebackMode() > 0) || \
00273                                   (epetra_err > 0 && Epetra_Object::GetTracebackMode() > 1)) { \
00274                       cerr << "Epetra ERROR " << epetra_err << ", " \
00275                            << __FILE__ << ", line " << __LINE__ << endl; }\
00276                       if (epetra_err != 0) return(epetra_err);  }\
00277                    }
00278 
00279 // Extension of same macro for pointer, returns zero if bad
00280 
00281 #define EPETRA_CHK_PTR(a) { if (a == 0 && Epetra_Object::GetTracebackMode() > 0) { \
00282                       cerr << "Epetra returning zero pointer " << ", " \
00283                            << __FILE__ << ", line " << __LINE__ << endl; } \
00284                       return(a); \
00285                    }
00286 // Extension of same macro for reference, returns a default reference
00287 
00288 #define EPETRA_CHK_REF(a) { if (Epetra_Object::GetTracebackMode() > 0) {\
00289                       cerr << "Epetra returning default reference " << ", " \
00290                            << __FILE__ << ", line " << __LINE__ << endl; } \
00291                       return(a); \
00292                    }
00293 
00294 #endif /* EPETRA_CONFIGDEFS_H */

Generated on Thu Sep 18 12:37:57 2008 for Epetra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1