00001 #ifndef _InvCapPress 00002 #define _InvCapPress 00003 00004 #include <assert.h> 00005 #include "fbsinverse.h" 00006 #include "finterpolate.h" 00007 #include "sfunctions.h" 00008 #include "opointer.h" 00009 00010 class InvCapPress : public Function1D 00011 { 00012 private: 00013 Function1D &_P; // 1D function that maps [a,b] , 0 <= a < b <=1 , onto (0,infty) 00014 // Note: Pc(a) may be +infty 00015 // Pc(b)=0 00016 // Pc must be decreasing on (a,b] 00017 double _a, _b; // [a,b] is the domain of f 00018 double _Pmax; // bisection will be used for p on (Pmax,infty) 00019 // interpolation will be used for p on [0,Pmax] 00020 double _smax; // Pc(smax)=Pmax 00021 unsigned _N; // number of subintervals used for the interpolation 00022 double _Tol; // tolerance used in the bisection method 00023 00024 OPointer<BSInverse> PInv, PInvL; // Pointers to bisection inverse functions 00025 // PInv - bisection inverse function to be used for p on (Pmax,infty) 00026 // PInvL - bisection inverse function to be interpolated and then 00027 // used for p on [0,Pmax] 00028 00029 OPointer<FInterpolate> PInvInt; // Pointer to linear interpolate of the bisection inverse function 00030 // PInvInt - Interpolate to be used for p on [0,Pmax] 00031 00032 00033 public: 00034 InvCapPress(Function1D &P, double a, double b, double smax, unsigned N, double Tol); 00035 00036 virtual double operator()(double P, unsigned cmp) const; 00037 00038 virtual ~InvCapPress(); 00039 00040 }; 00041 00042 #endif