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 _MBADATA_H_
00032 #define _MBADATA_H_
00033
00034 #include <MBAtypedef.h>
00035 #include <vector>
00036 #include <boost/shared_ptr.hpp>
00037
00038
00051
00052 class MBAdata {
00053 friend class MBA;
00054 friend class MBAadaptive;
00055
00056 double umin_, vmin_, umax_, vmax_;
00057
00058 double urange_inv_;
00059 double vrange_inv_;
00060
00061 MBAbaseType baseType_;
00062 double offset_;
00063 boost::shared_ptr<dVec> U_;
00064 boost::shared_ptr<dVec> V_;
00065 boost::shared_ptr<dVec> Zorig_;
00066 std::vector<double> Z_;
00067
00069 void readScatteredData(char filename[]);
00070
00071 void buildOffset();
00072 void buildBaseSurface();
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 void setDomain(double umin, double vmin, double umax, double vmax)
00085 {
00086 umin_ = umin;
00087 vmin_ = vmin;
00088 umax_ = umax;
00089 vmax_ = vmax;
00090 urange_inv_ = double(1) / (umax_ - umin_);
00091 vrange_inv_ = double(1) / (vmax_ - vmin_);
00092 }
00093
00094
00095 void clear() {U_->clear(); V_->clear(); Z_.clear(); Zorig_->clear();}
00096
00097
00098 std::vector<double>& Z() {return Z_;};
00099
00100
00101 void initDefaultDomain();
00102
00103 public:
00104 MBAdata();
00105 ~MBAdata() {}
00106
00108 void init(boost::shared_ptr<dVec> U, boost::shared_ptr<dVec> V, boost::shared_ptr<dVec> Z);
00109
00111 const double& umin() const {return umin_;}
00113 const double& vmin() const {return vmin_;}
00115 const double& umax() const {return umax_;}
00117 const double& vmax() const {return vmax_;}
00118
00119 const double& rangeUInv() const {return urange_inv_;}
00120 const double& rangeVInv() const {return vrange_inv_;}
00121
00122
00123 const boost::shared_ptr<dVec>& U() const {return U_;};
00124 const boost::shared_ptr<dVec>& V() const {return V_;};
00125 const boost::shared_ptr<dVec>& Zorig() const {return Zorig_;};
00126 const std::vector<double>& Z() const {return Z_;};
00127 double U(int i) const {return (*U_)[i];};
00128 double V(int i) const {return (*V_)[i];};
00129
00131 int size() const {return U_->size();}
00132
00133
00134
00135
00136 inline double f() const {return offset_;}
00137 };
00138
00139 #endif //_MBADATA_H_