00001 #ifndef __SelectiveThomasLS_H__
00002 #define __SelectiveThomasLS_H__
00003
00004
00005
00030 #include "AbsTriDiagonalLS.hpp"
00031
00032
00033 class SelectiveThomasLS : public AbsTriDiagonalLS
00034 {
00035 private:
00036
00037 RealVector* uOut;
00038 RealVector* dOut;
00039 RealVector* lOut;
00040
00041 RealVector* y;
00042
00043 int* frozenPixel;
00044 double dfrozen;
00045 double dfrozenInv;
00046
00047
00048 protected:
00049
00051 void computeLRdecomposition();
00052
00054 void forwardSubstitution();
00056 void backwardSubstitution();
00057
00058 public:
00059
00060 SelectiveThomasLS(int asize, double cstFrozen=1.0):AbsTriDiagonalLS(asize)
00061 {
00062 uOut= new RealVector(N-1);
00063 dOut= new RealVector(N);
00064 lOut= new RealVector(N-1);
00065
00066 y= new RealVector(N);
00067
00068 dfrozen= cstFrozen;
00069 dfrozenInv= 1.0/dfrozen;
00070
00071 frozenPixel= new int[N];
00072 memset(frozenPixel, 0, N*sizeof(int));
00073 }
00074
00075 virtual void initFreezing(int val=0)
00076 {
00077 memset(frozenPixel, val, N*sizeof(int));
00078 }
00079
00080 virtual ~SelectiveThomasLS(){delete uOut; delete dOut; delete lOut; delete y; delete[] frozenPixel;}
00081
00082 virtual void freeze(int item, int val=0)
00083 {
00084 frozenPixel[item]= val;
00085 }
00086
00087 virtual void loadA(RTriDiagonalMatrix* m);
00088 virtual void loadMatrix(RealVector* u1, RealVector* d1, RealVector* l1);
00089 virtual void loadX(RealVector* data);
00090 virtual void loadB(RealVector* data);
00091
00092
00093 virtual bool solve();
00094
00095
00096 virtual void output()
00097 {
00098 printf("Thomas ");
00099 AbsTriDiagonalLS::output();
00100 }
00101
00102 virtual void output(FILE* file)
00103 {
00104 fprintf(file, "Thomas ");
00105 AbsTriDiagonalLS::output(file);
00106 }
00107 };
00108
00109 #endif
00110
00111