Epetra Package Browser (Single Doxygen Collection) Development
Epetra_ConfigDefs.h
Go to the documentation of this file.
00001 /*
00002 //@HEADER
00003 // ************************************************************************
00004 // 
00005 //               Epetra: Linear Algebra Services Package 
00006 //                 Copyright 2001 Sandia Corporation
00007 // 
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00039 // 
00040 // ************************************************************************
00041 //@HEADER
00042 */
00043 
00044 #ifndef EPETRA_CONFIGDEFS_H
00045 #define EPETRA_CONFIGDEFS_H
00046 
00047 #ifndef __cplusplus
00048 #define __cplusplus
00049 #endif
00050 
00051 #include <algorithm>
00052 // windows defines these but the ones from algorithm
00053 // are not macros, so this will let them be used 
00054 // from algorithm
00055 #ifdef max
00056 #undef max
00057 #endif
00058 #ifdef min
00059 #undef min
00060 #endif
00061 
00062 #define EPETRA_MAX(x,y) std::max(x,y) /* max function  */
00063 #define EPETRA_MIN(x,y) std::min(x,y)/* min function  */
00064 //#define EPETRA_MAX(x,y) (( (x) > (y) ) ? x : y)     /* max function  */
00065 //#define EPETRA_MIN(x,y) (( (x) < (y) ) ? x : y)     /* min function  */
00066 #define EPETRA_SGN(x) (((x) < 0.0) ? -1.0 : 1.0)  /* sign function */
00067 
00068 const double Epetra_MinDouble = 1.0E-100;
00069 const double Epetra_MaxDouble = 1.0E+100;
00070 const double Epetra_Overflow = 1.79E308; // Used to test if equilibration should be done.
00071 const double Epetra_Underflow = 2.23E-308;
00072 
00073 #ifndef TRILINOS_NO_CONFIG_H
00074 
00075 /*
00076  * The macros PACKAGE, PACKAGE_NAME, etc, get defined for each package and need to
00077  * be undef'd here to avoid warnings when this file is included from another package.
00078  * KL 11/25/02
00079  */
00080 #ifdef PACKAGE
00081 #undef PACKAGE
00082 #endif
00083 
00084 #ifdef PACKAGE_NAME
00085 #undef PACKAGE_NAME
00086 #endif
00087 
00088 #ifdef PACKAGE_BUGREPORT
00089 #undef PACKAGE_BUGREPORT
00090 #endif
00091 
00092 #ifdef PACKAGE_STRING
00093 #undef PACKAGE_STRING
00094 #endif
00095 
00096 #ifdef PACKAGE_TARNAME
00097 #undef PACKAGE_TARNAME
00098 #endif
00099 
00100 #ifdef PACKAGE_VERSION
00101 #undef PACKAGE_VERSION
00102 #endif
00103 
00104 #ifdef VERSION
00105 #undef VERSION
00106 #endif
00107 
00108 #include <Epetra_config.h>
00109 
00110 #ifdef HAVE_MPI
00111 #ifndef EPETRA_MPI
00112 #define EPETRA_MPI
00113 #endif
00114 #endif
00115 
00116 #include <cstdlib>
00117 
00118 #include <cstdio>
00119 using std::sprintf;
00120 using std::sscanf;
00121 using std::FILE;
00122 using std::fopen;
00123 using std::fclose;
00124 using std::fgets;
00125 using std::fprintf;
00126 
00127 #include <cassert>
00128 
00129 #include <cstring>
00130 #include <string>
00131 
00132 #include <iostream>
00133 
00134 #include <sstream>
00135 
00136 #include <cmath>
00137 using std::rand;
00138 using std::fabs;
00139 using std::atoi;
00140 using std::atof;
00141 using std::abs;
00142 using std::pow;
00143 using std::sqrt;
00144 using std::asin;
00145 using std::sin;
00146 using std::cos;
00147 using std::ceil;
00148 using std::floor;
00149 
00150 #include <iomanip>
00151 
00152 using std::string;
00153 using std::memcpy;
00154 using std::strcpy;
00155 using std::strcmp;
00156 using std::strlen;
00157 using std::strchr;
00158 using std::strtok;
00159 using std::realloc;
00160 using std::malloc;
00161 using std::free;
00162 
00163 using std::istream;
00164 using std::ostream;
00165 using std::cerr;
00166 using std::cout;
00167 using std::endl;
00168 using std::flush;
00169 
00170 using std::abort;
00171 using std::exit;
00172 
00173 /*-----------------------------------------------------------------------
00174   Must refine the following up to #else TRILINOS_NO_CONFIG_H is defined
00175   -----------------------------------------------------------------------*/
00176 
00177 #ifdef EPETRA_SIMULATE_BOOL
00178 #ifdef bool
00179 #undef bool
00180 #endif
00181 #ifdef true
00182 #undef true
00183 #endif
00184 #ifdef false
00185 #undef false
00186 #endif
00187 
00188 #define bool int
00189 #define true 1
00190 #define false 0
00191 
00192 #endif
00193 
00194 #ifndef HAVE_FORMAT_IO
00195 const bool Epetra_FormatStdout = false; // Set true if the ostream << operator should format output
00196 #else
00197 const bool Epetra_FormatStdout = true;
00198 #endif
00199 
00200 // Define DefultTracebackMode (HAVE_WARNING_MESSAGES and HAVE_FATAL_MESSAGES can be defined
00201 // via the configure script command line)
00202 
00203 #ifdef HAVE_WARNING_MESSAGES
00204 const int DefaultTracebackMode = 2;
00205 #elif defined HAVE_FATAL_MESSAGES
00206 const int DefaultTracebackMode = 1;
00207 #else
00208 const int DefaultTracebackMode = 0;
00209 #endif
00210 
00211 #ifndef HAVE_FORTRAN_SUPPORT
00212 #ifndef FORTRAN_DISABLED
00213 #define FORTRAN_DISABLED
00214 #endif
00215 #endif
00216 
00217 #else /*TRILINOS_NO_CONFIG_H is defined*/
00218 
00219 #ifndef __cplusplus
00220 #define __cplusplus
00221 #endif
00222 
00223 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
00224 
00225 #include <stdlib.h>
00226 #include <stdio.h>
00227 #include <assert.h>
00228 #include <iostream>
00229 #include <math.h>
00230 #include <string>
00231 
00232 using std::string;
00233 using std::istream;
00234 using std::ostream;
00235 using std::cerr;
00236 using std::cout;
00237 using std::endl;
00238 using std::flush;
00239 
00240 #else
00241 
00242 #include <cstdlib>
00243 #include <cstdio>
00244 #include <cassert>
00245 #include <iostream>
00246 #include <cmath>
00247 #include <string>
00248 
00249 using std::string;
00250 using std::istream;
00251 using std::ostream;
00252 using std::cerr;
00253 using std::cout;
00254 using std::endl;
00255 using std::flush;
00256 
00257 #endif
00258 
00259 
00260 
00261 #ifdef EPETRA_SIMULATE_BOOL
00262 #ifdef bool
00263 #undef bool
00264 #endif
00265 #ifdef true
00266 #undef true
00267 #endif
00268 #ifdef false
00269 #undef false
00270 #endif
00271 
00272 #define bool int
00273 #define true 1
00274 #define false 0
00275 
00276 #endif
00277 
00278 const bool Epetra_FormatStdout = true; // Set true if the ostream << operator should format output
00279 const int DefaultTracebackMode = 1;
00280 
00281 #endif /*TRILINOS_NO_CONFIG_H*/
00282 
00283 // Delete any previous definition of EPETRA_NO_ERROR_REPORTS
00284 
00285 #ifdef EPETRA_CHK_ERR
00286 #undef EPETRA_CHK_ERR
00287 #endif
00288 #ifdef EPETRA_CHK_PTR
00289 #undef EPETRA_CHK_PTR
00290 #endif
00291 #ifdef EPETRA_CHK_REF
00292 #undef EPETRA_CHK_REF
00293 #endif
00294 
00295 // Great little macro obtained from Alan Williams (modified for dynamic switching on/off)
00296 
00297 #define EPETRA_CHK_ERR(a) { { int epetra_err = a; \
00298                               if ((epetra_err < 0 && Epetra_Object::GetTracebackMode() > 0) || \
00299                                   (epetra_err > 0 && Epetra_Object::GetTracebackMode() > 1)) { \
00300                       Epetra_Object::GetTracebackStream() << "Epetra ERROR " << epetra_err << ", " \
00301                            << __FILE__ << ", line " << __LINE__ << endl; }\
00302                       if (epetra_err != 0) return(epetra_err);  }\
00303                    }
00304 
00305 // Extension of same macro for pointer, returns zero if bad
00306 
00307 #define EPETRA_CHK_PTR(a) { if (a == 0 && Epetra_Object::GetTracebackMode() > 0) { \
00308                       Epetra_Object::GetTracebackStream() << "Epetra returning zero pointer " << ", " \
00309                            << __FILE__ << ", line " << __LINE__ << endl; } \
00310                       return(a); \
00311                    }
00312 // Extension of same macro for reference, returns a default reference
00313 
00314 #define EPETRA_CHK_REF(a) { if (Epetra_Object::GetTracebackMode() > 0) {\
00315                       Epetra_Object::GetTracebackStream() << "Epetra returning default reference " << ", " \
00316                            << __FILE__ << ", line " << __LINE__ << endl; } \
00317                       return(a); \
00318                    }
00319 
00320 #include "Epetra_DLLExportMacro.h"
00321 
00322 #endif /* EPETRA_CONFIGDEFS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines