solution.h
00001
00002
00003 #include "myexcept.h"
00004
00005 #ifdef use_namespace
00006 namespace RBD_COMMON {
00007 #endif
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 class R1_R1
00019 {
00020
00021
00022
00023
00024
00025
00026 protected:
00027 Real x;
00028 bool xSet;
00029
00030 public:
00031 Real minX, maxX;
00032 bool minXinf, maxXinf;
00033 R1_R1() : xSet(false), minXinf(true), maxXinf(true) {}
00034 virtual Real operator()() = 0;
00035
00036 virtual void Set(Real X);
00037 Real operator()(Real X) { Set(X); return operator()(); }
00038
00039 virtual bool IsValid(Real X);
00040 operator Real();
00041 };
00042
00043 class SolutionException : public BaseException
00044 {
00045 public:
00046 static unsigned long Select;
00047 SolutionException(const char* a_what = 0);
00048 };
00049
00050 class OneDimSolve
00051 {
00052 R1_R1& function;
00053 Real accX;
00054 Real accY;
00055 int lim;
00056
00057 public:
00058 OneDimSolve(R1_R1& f, Real AccY = 0.0001, Real AccX = 0.0)
00059 : function(f), accX(AccX), accY(AccY) {}
00060
00061 Real Solve(Real Y, Real X, Real Dev, int Lim=100);
00062
00063
00064
00065
00066
00067
00068 private:
00069 Real x[3], y[3];
00070 int L,C,U,Last;
00071 int vpol, hpol;
00072 Real YY;
00073 int i;
00074 void LookAt(int);
00075 bool Finish;
00076 bool Captured;
00077 void VFlip();
00078 void HFlip();
00079 void Flip();
00080 void State(int I, int J, int K);
00081 void Linear(int, int, int);
00082 void Quadratic(int, int, int);
00083 };
00084
00085
00086 #ifdef use_namespace
00087 }
00088 #endif
00089
00090
00091
00092
00093