/home/doxygen/libascend/compiler/func.h

Go to the documentation of this file.
00001 /*  ASCEND modelling environment
00002     Copyright (C) 1990, 1993, 1994 Thomas Guthrie Epperly
00003     Copyright (C) 2006 Carnegie Mellon University
00004 
00005     This program is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2, or (at your option)
00008     any later version.
00009 
00010     This program is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License
00016     along with this program; if not, write to the Free Software
00017     Foundation, Inc., 59 Temple Place - Suite 330,
00018     Boston, MA 02111-1307, USA.
00019 *//*
00029     by Tom Epperly
00030     Version: $Revision: 1.16 $
00031     Version control file: $RCSfile: func.h,v $
00032     Date last modified: $Date: 2001/01/31 22:23:57 $
00033     Last modified by: $Author: ballan $
00034 */
00035 
00036 #ifndef ASC_FUNC_H
00037 #define ASC_FUNC_H
00038 
00043 #include <utilities/ascConfig.h>
00044 #include "functype.h"
00045 #include "compiler.h"
00046 #include "dimen.h"
00047 
00048 /*
00049  *  the following should be ifdefed to deal with math.h values
00050  */
00051 #define F_ERF_COEF    1.1283791670955130      
00052 #define F_LOG10_COEF  0.4342944819032518      
00053 #define F_PI          3.1415926535897932385E0
00054 #define F_PI_HALF     1.5707963267948966192E0
00055 #define F_LIM_EXP     709.78                  
00056 #define F_LIM_CUBE    5.6438030941223618e101  
00057 #define F_LIM_SQR     1.0e154                 
00060 #ifdef __STDC__
00061 # if __STDC__
00062 
00068 ASC_DLLSPEC double cbrt(double);
00069 #  ifdef HAVE_ERF
00070 extern double erf(double);
00071 #  endif /* HAVE_ERF */
00072 # endif /* __STDC__ == 1*/
00073 
00077 #endif /* stdc defined */
00078 
00079 
00080 extern CONST struct Func *LookupFunc(CONST char *name);
00119 extern CONST struct Func *LookupFuncById(enum Func_enum id);
00125 extern double FuncGetLnmEpsilon(void);
00129 #define FuncGetLnmEpsilon() (g_lnm_epsilon)
00130 
00131 
00132 extern void FuncSetLnmEpsilon(double e);
00137 ASC_DLLSPEC double g_lnm_epsilon;
00138 #define FuncSetLnmEpsilon(e) \
00139    (e>(double)0.0 ? g_lnm_epsilon=e : FPRINTF(ASCERR,"bad lnm eps"))
00140 
00141 
00146 ASC_DLLSPEC double cbrt(double);
00147 #ifdef HAVE_ERF
00148 extern double erf(double);
00149 #endif /* HAVE_ERF */
00150 
00151 
00152 #ifdef NDEBUG
00153 # define ascnint(d) (((int) (d)>=0.0 ? floor((d) + 0.5) : -floor(0.5 - (d))))
00154 
00159 #else
00160 # define ascnint(a) ascnintF(a)
00161 
00166 ASC_DLLSPEC int ascnintF(double);
00171 #endif
00172 
00173 
00174 ASC_DLLSPEC double dln(double x);
00175 ASC_DLLSPEC double dln2(double x);
00176 ASC_DLLSPEC double dlog10(double x);
00177 ASC_DLLSPEC double dlog102(double x);
00178 ASC_DLLSPEC double lnm(double x);
00179 ASC_DLLSPEC double dlnm(double x);
00180 ASC_DLLSPEC double dlnm2(double x);
00203 ASC_DLLSPEC double dtanh(double x);
00204 ASC_DLLSPEC double dtanh2(double x);
00205 ASC_DLLSPEC double arcsinh(double x);
00206 ASC_DLLSPEC double arccosh(double x);
00207 ASC_DLLSPEC double arctanh(double x);
00208 ASC_DLLSPEC double darcsinh(double x);
00209 ASC_DLLSPEC double darcsinh2(double x);
00210 ASC_DLLSPEC double darccosh(double x);
00211 ASC_DLLSPEC double darccosh2(double x);
00212 ASC_DLLSPEC double darctanh(double x);
00213 ASC_DLLSPEC double darctanh2(double x);
00218 ASC_DLLSPEC double sqr(double x);
00219 ASC_DLLSPEC double dsqr(double x);
00220 ASC_DLLSPEC double dsqr2(double x);
00221 ASC_DLLSPEC double cube(double x);
00222 ASC_DLLSPEC double dcube(double x);
00223 ASC_DLLSPEC double dcube2(double x);
00228 ASC_DLLSPEC double asc_ipow(double a, int n);
00229 ASC_DLLSPEC double asc_d1ipow(double a, int n);
00230 ASC_DLLSPEC double asc_d2ipow(double a, int n);
00244 ASC_DLLSPEC double hold(double x);
00254 ASC_DLLSPEC double dsqrt(double x);
00255 ASC_DLLSPEC double dsqrt2(double x);
00256 ASC_DLLSPEC double dcbrt(double x);
00257 ASC_DLLSPEC double dcbrt2(double x);
00258 ASC_DLLSPEC double dfabs(double x);
00259 ASC_DLLSPEC double dfabs2(double x);
00260 ASC_DLLSPEC double dhold(double x);
00261 #define dhold2 dhold
00262 
00269 ASC_DLLSPEC double dasin(double x);
00270 ASC_DLLSPEC double dasin2(double x);
00271 ASC_DLLSPEC double dcos(double x);
00272 ASC_DLLSPEC double dcos2(double x);
00273 ASC_DLLSPEC double dacos(double x);
00274 ASC_DLLSPEC double dacos2(double x);
00275 ASC_DLLSPEC double dtan(double x);
00276 ASC_DLLSPEC double dtan2(double x);
00277 ASC_DLLSPEC double datan(double x);
00278 ASC_DLLSPEC double datan2(double x);
00283 #ifdef HAVE_ERF
00284 ASC_DLLSPEC double derf(double x);
00285 ASC_DLLSPEC double derf2(double x);
00286 #endif /* HAVE_ERF */
00287 
00291 ASC_DLLSPEC CONST char *FuncName(CONST struct Func *f);
00297 extern CONST char *FuncCName(CONST struct Func *f);
00302 extern CONST char *FuncDeriv1CName(CONST struct Func *f);
00307 extern CONST char *FuncDeriv2CName(CONST struct Func *f);
00312 ASC_DLLSPEC enum Func_enum FuncId(CONST struct Func *f);
00317 extern CONST dim_type *FuncDimens(CONST struct Func *f);
00327 extern double FuncEval(CONST struct Func *f, double u);
00332 extern double FuncEvalSafe(CONST struct Func *f,
00333                            double u,
00334                            enum safe_err *not_safe);
00339 extern double FuncDeriv(CONST struct Func *f, double u);
00344 extern double FuncDerivSafe(CONST struct Func *f,
00345                             double u,
00346                             enum safe_err *not_safe);
00351 extern double FuncDeriv2(CONST struct Func *f, double u);
00356 extern double FuncDeriv2Safe(CONST struct Func *f,
00357                              double u,
00358                              enum safe_err *not_safe);
00363 #ifdef CHRIS_FUNC
00364 
00365 extern struct Interval FuncRange(CONST struct Func *f, struct Interval i);
00370 extern void FuncSlope(CONST struct Func *f,
00371                       unsigned long nvar,
00372                       struct Interval *center,
00373                       struct Interval *range,
00374                       struct Interval *slope);
00379 extern struct Interval FuncIDeriv(CONST struct Func *f, struct Interval i);
00384 extern double ArgMin(CONST struct Func *f, double lower, double upper);
00389 extern double ArgMax(CONST struct Func *f, double lower, double upper);
00394 extern double ConvexEnv(CONST struct Func *f, double x,
00395                         double lower, double upper);
00401 extern double ConvexEnvDeriv(CONST struct Func *f, double x,
00402                              double lower, double upper);
00408 extern double ConcaveEnv(CONST struct Func *f, double x,
00409                          double lower, double upper);
00415 extern double ConcaveEnvDeriv(CONST struct Func *f, double x,
00416                               double lower, double upper);
00422 #endif /* CHRIS_FUNC */
00423 
00424 /* @} */
00425 
00426 #endif /* ASC_FUNC_H */

Generated on Thu Jul 17 04:00:10 2008 for libascend by  doxygen 1.5.1