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 #include <algorithm>
00040 
00041 #define EPETRA_MAX(x,y) std::max(x,y) /* max function  */
00042 #define EPETRA_MIN(x,y) std::min(x,y)/* min function  */
00043 //#define EPETRA_MAX(x,y) (( (x) > (y) ) ? x : y)     /* max function  */
00044 //#define EPETRA_MIN(x,y) (( (x) < (y) ) ? x : y)     /* min function  */
00045 #define EPETRA_SGN(x) (((x) < 0.0) ? -1.0 : 1.0)  /* sign function */
00046 
00047 const double Epetra_MinDouble = 1.0E-100;
00048 const double Epetra_MaxDouble = 1.0E+100;
00049 const double Epetra_Overflow = 1.79E308; // Used to test if equilibration should be done.
00050 const double Epetra_Underflow = 2.23E-308;
00051 
00052 #ifndef TRILINOS_NO_CONFIG_H
00053 
00054 /*
00055  * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
00056  * be undef'd here to avoid warnings when this file is included from another package.
00057  * KL 11/25/02
00058  */
00059 #ifdef PACKAGE
00060 #undef PACKAGE
00061 #endif
00062 
00063 #ifdef PACKAGE_NAME
00064 #undef PACKAGE_NAME
00065 #endif
00066 
00067 #ifdef PACKAGE_BUGREPORT
00068 #undef PACKAGE_BUGREPORT
00069 #endif
00070 
00071 #ifdef PACKAGE_STRING
00072 #undef PACKAGE_STRING
00073 #endif
00074 
00075 #ifdef PACKAGE_TARNAME
00076 #undef PACKAGE_TARNAME
00077 #endif
00078 
00079 #ifdef PACKAGE_VERSION
00080 #undef PACKAGE_VERSION
00081 #endif
00082 
00083 #ifdef VERSION
00084 #undef VERSION
00085 #endif
00086 
00087 #include <Epetra_config.h>
00088 
00089 #ifdef HAVE_MPI
00090 #ifndef EPETRA_MPI
00091 #define EPETRA_MPI
00092 #endif
00093 #endif
00094 
00095 #ifdef HAVE_CSTDLIB
00096 #include <cstdlib>
00097 #endif
00098 #ifdef HAVE_STDLIB_H
00099 #include <stdlib.h>
00100 #endif
00101 
00102 #ifdef HAVE_CSTDIO
00103 #include <cstdio>
00104 using std::sprintf;
00105 #endif
00106 #ifdef HAVE_STDIO_H
00107 #include <stdio.h>
00108 #endif
00109 
00110 #ifdef HAVE_CASSERT
00111 #include <cassert>
00112 #else
00113 #include <assert.h>
00114 #endif
00115 
00116 #ifdef HAVE_STRING
00117 #include <string>
00118 #endif
00119 #ifdef HAVE_STRING_H
00120 #include <string.h>
00121 #endif
00122 
00123 #ifdef HAVE_IOSTREAM
00124 #include <iostream>
00125 #else
00126 #include <iostream.h>
00127 #endif
00128 
00129 #ifdef HAVE_SSTREAM
00130 #include <sstream>
00131 #endif
00132 
00133 #ifdef HAVE_CMATH
00134 #include <cmath>
00135 using std::rand;
00136 #endif
00137 #ifdef HAVE_MATH_H
00138 #include <math.h>
00139 #endif
00140 
00141 #ifdef HAVE_IOMANIP
00142 #include <iomanip>
00143 #else
00144 #include <iomanip.h>
00145 #endif
00146 
00147 #ifdef HAVE_STRING
00148 using std::string;
00149 #endif
00150 
00151 #ifdef HAVE_IOSTREAM
00152 using std::istream;
00153 using std::ostream;
00154 using std::cerr;
00155 using std::cout;
00156 using std::endl;
00157 using std::flush;
00158 #endif
00159 
00160 /*-----------------------------------------------------------------------
00161   Must refine the following up to #else TRILINOS_NO_CONFIG_H is defined
00162   -----------------------------------------------------------------------*/
00163 
00164 #ifdef EPETRA_SIMULATE_BOOL
00165 #ifdef bool
00166 #undef bool
00167 #endif
00168 #ifdef true
00169 #undef true
00170 #endif
00171 #ifdef false
00172 #undef false
00173 #endif
00174 
00175 #define bool int
00176 #define true 1
00177 #define false 0
00178 
00179 #endif
00180 
00181 #ifndef HAVE_FORMAT_IO
00182 const bool Epetra_FormatStdout = false; // Set true if the ostream << operator should format output
00183 #else
00184 const bool Epetra_FormatStdout = true;
00185 #endif
00186 
00187 // Define DefultTracebackMode (HAVE_WARNING_MESSAGES and HAVE_FATAL_MESSAGES can be defined
00188 // via the configure script command line)
00189 
00190 #ifdef HAVE_WARNING_MESSAGES
00191 const int DefaultTracebackMode = 2;
00192 #elif defined HAVE_FATAL_MESSAGES
00193 const int DefaultTracebackMode = 1;
00194 #else
00195 const int DefaultTracebackMode = 0;
00196 #endif
00197 
00198 #ifndef HAVE_FORTRAN_SUPPORT
00199 #ifndef FORTRAN_DISABLED
00200 #define FORTRAN_DISABLED
00201 #endif
00202 #endif
00203 
00204 #else /*TRILINOS_NO_CONFIG_H is defined*/
00205 
00206 #ifndef __cplusplus
00207 #define __cplusplus
00208 #endif
00209 
00210 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
00211 
00212 #include <stdlib.h>
00213 #include <stdio.h>
00214 #include <assert.h>
00215 #include <iostream>
00216 #include <math.h>
00217 #include <string>
00218 
00219 using std::string;
00220 using std::istream;
00221 using std::ostream;
00222 using std::cerr;
00223 using std::cout;
00224 using std::endl;
00225 using std::flush;
00226 
00227 #else
00228 
00229 #include <cstdlib>
00230 #include <cstdio>
00231 #include <cassert>
00232 #include <iostream>
00233 #include <cmath>
00234 #include <string>
00235 
00236 using std::string;
00237 using std::istream;
00238 using std::ostream;
00239 using std::cerr;
00240 using std::cout;
00241 using std::endl;
00242 using std::flush;
00243 
00244 #endif
00245 
00246 
00247 
00248 #ifdef EPETRA_SIMULATE_BOOL
00249 #ifdef bool
00250 #undef bool
00251 #endif
00252 #ifdef true
00253 #undef true
00254 #endif
00255 #ifdef false
00256 #undef false
00257 #endif
00258 
00259 #define bool int
00260 #define true 1
00261 #define false 0
00262 
00263 #endif
00264 
00265 const bool Epetra_FormatStdout = true; // Set true if the ostream << operator should format output
00266 const int DefaultTracebackMode = 1;
00267 
00268 #endif /*TRILINOS_NO_CONFIG_H*/
00269 
00270 // Delete any previous definition of EPETRA_NO_ERROR_REPORTS
00271 
00272 #ifdef EPETRA_CHK_ERR
00273 #undef EPETRA_CHK_ERR
00274 #endif
00275 #ifdef EPETRA_CHK_PTR
00276 #undef EPETRA_CHK_PTR
00277 #endif
00278 #ifdef EPETRA_CHK_REF
00279 #undef EPETRA_CHK_REF
00280 #endif
00281 
00282 // Great little macro obtained from Alan Williams (modified for dynamic switching on/off)
00283 
00284 #define EPETRA_CHK_ERR(a) { { int epetra_err = a; \
00285                               if ((epetra_err < 0 && Epetra_Object::GetTracebackMode() > 0) || \
00286                                   (epetra_err > 0 && Epetra_Object::GetTracebackMode() > 1)) { \
00287                       Epetra_Object::GetTracebackStream() << "Epetra ERROR " << epetra_err << ", " \
00288                            << __FILE__ << ", line " << __LINE__ << endl; }\
00289                       if (epetra_err != 0) return(epetra_err);  }\
00290                    }
00291 
00292 // Extension of same macro for pointer, returns zero if bad
00293 
00294 #define EPETRA_CHK_PTR(a) { if (a == 0 && Epetra_Object::GetTracebackMode() > 0) { \
00295                       Epetra_Object::GetTracebackStream() << "Epetra returning zero pointer " << ", " \
00296                            << __FILE__ << ", line " << __LINE__ << endl; } \
00297                       return(a); \
00298                    }
00299 // Extension of same macro for reference, returns a default reference
00300 
00301 #define EPETRA_CHK_REF(a) { if (Epetra_Object::GetTracebackMode() > 0) {\
00302                       Epetra_Object::GetTracebackStream() << "Epetra returning default reference " << ", " \
00303                            << __FILE__ << ", line " << __LINE__ << endl; } \
00304                       return(a); \
00305                    }
00306 
00307 #endif /* EPETRA_CONFIGDEFS_H */

Generated on Wed May 12 21:41:05 2010 for Epetra Package Browser (Single Doxygen Collection) by  doxygen 1.4.7