Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00011 #include "fvar.hpp"
00012 #ifdef __TURBOC__
00013 #pragma hdrstop
00014 #endif
00015
00016 #include <stdlib.h>
00017 #include <stdio.h>
00018 #include <math.h>
00019
00020 double dmin(double,double);
00021 double dmax(double, double);
00022
00023 #define USE_BARD_PEN
00024
00029 double boundpin(const prevariable& xx, double fmin, double fmax,const double& s)
00030 {
00031 double tinv;
00032 double x=value(xx);
00033
00034 if (x < fmin)
00035 {
00036 if (ad_printf)
00037 (*ad_printf)("variable out of bounds in boundpin: variable = %lg", x);
00038 if (ad_printf) (*ad_printf)("; min = %lg", fmin);
00039 if (ad_printf) (*ad_printf)("; max = %lg\n", fmax);
00040
00041 x=dmin(fmin+.001,fmin+.01*(fmax-fmin));
00042 }
00043
00044 if (x > fmax)
00045 {
00046 if (ad_printf)
00047 (*ad_printf)("variable out of bounds in boundpin: variable = %lg", x);
00048 if (ad_printf) (*ad_printf)("; min = %lg", fmin);
00049 if (ad_printf) (*ad_printf)("; max = %lg\n", fmax);
00050
00051 x=dmax(fmax-.001,fmax-.01*(fmax-fmin));
00052 }
00053
00054 tinv=::asin(2.*(x-fmin)/(fmax-fmin)-1.)/1.57079632679489661;
00055 return(s*tinv);
00056 }