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