00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef _Interpol2D_h
00011 #define _Interpol2D_h
00012
00018 class Interpol2D
00019 {
00020 public:
00021 Interpol2D();
00022 Interpol2D(
00023 unsigned int xdivs, double xmin, double xmax,
00024 unsigned int ydivs, double ymin, double ymax );
00025
00027
00029 void setXmin( double value );
00030 double getXmin() const;
00031 void setXmax( double value );
00032 double getXmax() const;
00033 void setXdivs( unsigned int value );
00034 unsigned int getXdivs() const;
00035 void setDx( double value );
00036 double getDx() const;
00037
00038 void setYmin( double value );
00039 double getYmin() const;
00040 void setYmax( double value );
00041 double getYmax() const;
00042 void setYdivs( unsigned int value );
00043 unsigned int getYdivs() const;
00044 void setDy( double value );
00045 double getDy() const;
00046
00047 void setSy( double value );
00048 double getSy() const;
00049
00050 double getInterpolatedValue(vector<double> xy) const;
00051
00053
00055
00059 void lookupReturn( const Eref& e, double v1, double v2 );
00060 void lookup( double v1, double v2 );
00061
00062 void appendTableVector( vector< vector< double > > value );
00063
00065
00067 double interpolate( double x, double y ) const;
00068 double indexWithoutCheck( double x, double y ) const;
00069 double innerLookup( double x, double y ) const;
00070 bool operator==( const Interpol2D& other ) const;
00071 bool operator<( const Interpol2D& other ) const;
00072
00073
00074 friend istream& operator>>( istream&, Interpol2D& );
00075
00076 double invDy() const {
00077 return invDy_;
00078 }
00079
00080 void setTableValue( vector< unsigned int > index, double value );
00081 double getTableValue( vector< unsigned int > index ) const;
00082
00083 void setTableVector( vector< vector< double > > value );
00084 vector< vector < double > > getTableVector() const;
00085 void appendTableVector(
00086 const vector< vector< double > >& value );
00087
00092 void resize( unsigned int xsize, unsigned int ysize, double init = 0.0 );
00093
00094 unsigned int xdivs() const;
00095 unsigned int ydivs() const;
00096
00097 void print( const string& fname, bool doAppend ) const;
00098 void load( const string& fname, unsigned int skiplines );
00099
00100 static const Cinfo* initCinfo();
00101 static const unsigned int MAX_DIVS;
00102 private:
00103 double xmin_;
00104 double xmax_;
00105 double invDx_;
00106 double ymin_;
00107 double ymax_;
00108 double invDy_;
00109 double sy_;
00110 vector< vector< double > > table_;
00111 };
00112
00113
00114 #endif // _Interpol2D_h