Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

global.H

Go to the documentation of this file.
00001 /*
00002  * Copyright 2000, Brown University, Providence, RI.
00003  * 
00004  *                         All Rights Reserved
00005  * 
00006  * Permission to use, copy, modify, and distribute this software and its
00007  * documentation for any purpose other than its incorporation into a
00008  * commercial product is hereby granted without fee, provided that the
00009  * above copyright notice appear in all copies and that both that
00010  * copyright notice and this permission notice appear in supporting
00011  * documentation, and that the name of Brown University not be used in
00012  * advertising or publicity pertaining to distribution of the software
00013  * without specific, written prior permission.
00014  * 
00015  * BROWN UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
00016  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ANY
00017  * PARTICULAR PURPOSE.  IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE FOR
00018  * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00019  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00020  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00021  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00022  */
00023 #ifndef AMOD_MATH_LIB_INC_GLOBAL_H
00024 #define AMOD_MATH_LIB_INC_GLOBAL_H
00025 
00027 // DESCRIPTION:
00028 //
00029 // The basic include file to be included into any modeler file. It contains
00030 // some very basic stuff, needed almost everywhere in the modeler.
00031 //
00033 
00034 #include <math.h>
00035 
00036 #ifndef DllExp
00037 #include "std/dllimpexp.H"
00038 #endif
00039 
00040 #include "std/config.H"
00041 
00042 // Some compilers don't define these constants
00043 #if defined(WIN32) || defined(__KCC)
00044 #define M_PI        3.14159265358979323846
00045 #define M_PI_2      1.57079632679489661923
00046 #define M_LN2           0.69314718055994530942
00047 #define M_SQRT2         1.41421356237309504880
00048 #endif
00049 
00050 // Include some very frequently used header files so that they do not have
00051 // to be included every time
00052 //
00053 #include <stdio.h>
00054 #include <stdlib.h>
00055 #include <assert.h>
00056 
00057 // Don't use the following global variables directly, use the inline functions
00058 // instead. We have to keep these variables in the header file to be able to
00059 // inline the access functions.
00060 //
00061 extern DllImpExp double       gEpsAbsMath;
00062 extern DllImpExp double       gEpsAbsSqrdMath;
00063 extern DllImpExp const double gEpsNorMath;
00064 extern DllImpExp const double gEpsNorSqrdMath;
00065 extern DllImpExp const double gEpsZeroMath;  // Really a very small value
00066 
00067 
00068 inline double epsAbsMath    () { return gEpsAbsMath;     }
00069 inline double epsAbsSqrdMath() { return gEpsAbsSqrdMath; }
00070 
00071 inline double epsNorMath    () { return gEpsNorMath;     }
00072 inline double epsNorSqrdMath() { return gEpsNorSqrdMath; }
00073 
00074 extern DllImpExp void setEpsAbsMath(double eps);
00075 
00076 // Hack to get around bug in KAI's math functions
00077 #ifdef __KCC
00078 #define sqrt(x)  sqrt(double(x))
00079 #define log(x)   log(double(x))
00080 #define pow(x,y) pow(double(x),double(y))
00081 #endif
00082 
00083 #ifndef GLUE_NEEDS_DOUBLE_STAR_EXPLICIT
00084 template <class T>
00085 inline T operator *(double s, const T &p) { return p * s; }
00086 #endif
00087 
00088 
00089 // ensure numerical error doesn't cause a value outside the range [-1,1]
00090 // to be passed to the acos function.
00091 extern double   Acos(double x);
00092 
00093 // Forward declaration of some commonly used classes so that we do not have to
00094 // forward-declare them in header files every time they are needed.
00095 //
00096 
00097 
00098 #endif

Generated on Mon Sep 15 16:25:56 2003 for gluebase by doxygen1.2.18