00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef _MBA_H_
00032 #define _MBA_H_
00033 
00034 #include <MBAtypedef.h>
00035 #include <UCBtypedef.h>
00036 #include <GenMatrix.h>
00037 #include <MBAdata.h>
00038 
00039 #include <vector>
00040 #include <boost/shared_ptr.hpp>
00041 
00042 #include <UCBsplineSurface.h>
00043 
00072 
00073 class MBA {
00074   
00075   MBAdata data_;
00076   int m_,n_; 
00077   boost::shared_ptr<GenMatrixType> PHI_;
00078 
00079   static const std::vector<UCBspl_real> smoothing_filter_;
00080 
00081   GenMatrix<UCBspl_real> delta_; 
00082   GenMatrix<UCBspl_real> omega_; 
00083   
00084   void BAalg();
00085   double f_pure(double u, double v) const; 
00086 
00087   
00088   void flagZeros(GenMatrix<bool>& qwe_) const;
00089 
00090   
00091 
00092 
00093 
00094   bool adjustForBaseSurface();
00095 
00096 public:
00097 
00098   MBA(){};
00099 
00102   MBA(boost::shared_ptr<dVec> U, boost::shared_ptr<dVec> V, boost::shared_ptr<dVec> Z)
00103      {data_.init(U, V, Z);}
00104     
00105  ~MBA(){}
00106 
00110   void init(boost::shared_ptr<dVec> U, boost::shared_ptr<dVec> V, boost::shared_ptr<dVec> Z)
00111      {data_.init(U, V, Z);}
00112 
00115   void init(UCBspl::SplineSurface& surf);
00116 
00117 
00118   
00119 
00120 
00121 
00122 
00123 
00124   
00125   
00126 
00135   void setDomain(double umin, double vmin, double umax, double vmax)
00136                  {data_.setDomain(umin,vmin,umax,vmax);}
00137 
00146   void setBaseType(MBAbaseType baseType) {data_.baseType_ = baseType;}
00147   
00149   void setBaseValue(double base) {data_.offset_ = base; data_.baseType_ = MBA_CONSTVAL;}
00150   
00170   void MBAalg(int m0, int n0, int h = 0, int smoothing_steps = 0);    
00171   
00173         const MBAdata& getData() const {return data_;}
00174 
00176   void readScatteredData(char filename[]) {data_.readScatteredData(filename);}
00177 
00179   void smoothZeros(int no_iter);
00180 
00183   UCBspl::SplineSurface getSplineSurface() const {return UCBspl::SplineSurface(PHI_, data_.umin(), data_.vmin(),
00184                                                   data_.umax(), data_.vmax());}
00185 
00193   void getIndexDomain(int& m, int& n) const {m = m_; n = n_;}
00194 
00203   void cleanup(int type = 0);
00204 
00207   boost::shared_ptr<GenMatrixType> PHI() const {return PHI_;}
00208 
00209   
00210   void checkSparsity() const;
00211   
00212   void checkError() const;
00213 
00214   static void smoothMatrix(GenMatrixType& matrix, int no_iter);
00215 
00216 };
00217 
00218 #endif