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 2011 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 #ifndef __IBMCPP__
00142 using std::abs;
00143 #endif
00144 using std::pow;
00145 using std::sqrt;
00146 using std::asin;
00147 using std::sin;
00148 using std::cos;
00149 using std::ceil;
00150 using std::floor;
00151 
00152 #include <iomanip>
00153 
00154 using std::string;
00155 using std::memcpy;
00156 using std::strcpy;
00157 using std::strcmp;
00158 using std::strlen;
00159 using std::strchr;
00160 using std::strtok;
00161 using std::realloc;
00162 using std::malloc;
00163 using std::free;
00164 
00165 using std::istream;
00166 using std::ostream;
00167 using std::cerr;
00168 using std::cout;
00169 using std::endl;
00170 using std::flush;
00171 
00172 using std::abort;
00173 using std::exit;
00174 
00175 /*-----------------------------------------------------------------------
00176   Must refine the following up to #else TRILINOS_NO_CONFIG_H is defined
00177   -----------------------------------------------------------------------*/
00178 
00179 #ifdef EPETRA_SIMULATE_BOOL
00180 #ifdef bool
00181 #undef bool
00182 #endif
00183 #ifdef true
00184 #undef true
00185 #endif
00186 #ifdef false
00187 #undef false
00188 #endif
00189 
00190 #define bool int
00191 #define true 1
00192 #define false 0
00193 
00194 #endif
00195 
00196 #ifndef HAVE_FORMAT_IO
00197 const bool Epetra_FormatStdout = false; // Set true if the ostream << operator should format output
00198 #else
00199 const bool Epetra_FormatStdout = true;
00200 #endif
00201 
00202 // Define DefultTracebackMode (HAVE_WARNING_MESSAGES and HAVE_FATAL_MESSAGES can be defined
00203 // via the configure script command line)
00204 
00205 #ifdef HAVE_WARNING_MESSAGES
00206 const int DefaultTracebackMode = 2;
00207 #elif defined HAVE_FATAL_MESSAGES
00208 const int DefaultTracebackMode = 1;
00209 #else
00210 const int DefaultTracebackMode = 0;
00211 #endif
00212 
00213 #ifndef HAVE_FORTRAN_SUPPORT
00214 #ifndef FORTRAN_DISABLED
00215 #define FORTRAN_DISABLED
00216 #endif
00217 #endif
00218 
00219 #else /*TRILINOS_NO_CONFIG_H is defined*/
00220 
00221 #ifndef __cplusplus
00222 #define __cplusplus
00223 #endif
00224 
00225 #if defined(SGI) || defined(SGI64) || defined(SGI32) || defined(CPLANT)
00226 
00227 #include <stdlib.h>
00228 #include <stdio.h>
00229 #include <assert.h>
00230 #include <iostream>
00231 #include <math.h>
00232 #include <string>
00233 
00234 using std::string;
00235 using std::istream;
00236 using std::ostream;
00237 using std::cerr;
00238 using std::cout;
00239 using std::endl;
00240 using std::flush;
00241 
00242 #else
00243 
00244 #include <cstdlib>
00245 #include <cstdio>
00246 #include <cassert>
00247 #include <iostream>
00248 #include <cmath>
00249 #include <string>
00250 
00251 using std::string;
00252 using std::istream;
00253 using std::ostream;
00254 using std::cerr;
00255 using std::cout;
00256 using std::endl;
00257 using std::flush;
00258 
00259 #endif
00260 
00261 
00262 
00263 #ifdef EPETRA_SIMULATE_BOOL
00264 #ifdef bool
00265 #undef bool
00266 #endif
00267 #ifdef true
00268 #undef true
00269 #endif
00270 #ifdef false
00271 #undef false
00272 #endif
00273 
00274 #define bool int
00275 #define true 1
00276 #define false 0
00277 
00278 #endif
00279 
00280 const bool Epetra_FormatStdout = true; // Set true if the ostream << operator should format output
00281 const int DefaultTracebackMode = 1;
00282 
00283 #endif /*TRILINOS_NO_CONFIG_H*/
00284 
00285 // Delete any previous definition of EPETRA_NO_ERROR_REPORTS
00286 
00287 #ifdef EPETRA_CHK_ERR
00288 #undef EPETRA_CHK_ERR
00289 #endif
00290 #ifdef EPETRA_CHK_PTR
00291 #undef EPETRA_CHK_PTR
00292 #endif
00293 #ifdef EPETRA_CHK_REF
00294 #undef EPETRA_CHK_REF
00295 #endif
00296 
00297 // Great little macro obtained from Alan Williams (modified for dynamic switching on/off)
00298 
00299 #define EPETRA_CHK_ERR(a) { { int epetra_err = a; \
00300                               if ((epetra_err < 0 && Epetra_Object::GetTracebackMode() > 0) || \
00301                                   (epetra_err > 0 && Epetra_Object::GetTracebackMode() > 1)) { \
00302                       Epetra_Object::GetTracebackStream() << "Epetra ERROR " << epetra_err << ", " \
00303                            << __FILE__ << ", line " << __LINE__ << endl; }\
00304                       if (epetra_err != 0) return(epetra_err);  }\
00305                    }
00306 
00307 // Extension of same macro for pointer, returns zero if bad
00308 
00309 #define EPETRA_CHK_PTR(a) { if (a == 0 && Epetra_Object::GetTracebackMode() > 0) { \
00310                       Epetra_Object::GetTracebackStream() << "Epetra returning zero pointer " << ", " \
00311                            << __FILE__ << ", line " << __LINE__ << endl; } \
00312                       return(a); \
00313                    }
00314 // Extension of same macro for reference, returns a default reference
00315 
00316 #define EPETRA_CHK_REF(a) { if (Epetra_Object::GetTracebackMode() > 0) {\
00317                       Epetra_Object::GetTracebackStream() << "Epetra returning default reference " << ", " \
00318                            << __FILE__ << ", line " << __LINE__ << endl; } \
00319                       return(a); \
00320                    }
00321 
00322 #include "Epetra_DLLExportMacro.h"
00323 
00324 #endif /* EPETRA_CONFIGDEFS_H */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines