Object-oriented Scientific Computing Library: Version 0.910
twod_eqi_intp.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006-2012, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_TWOD_EQI_INTP_H
00024 #define O2SCL_TWOD_EQI_INTP_H
00025 
00026 #include <iostream>
00027 #include <string>
00028 
00029 #ifndef DOXYGENP
00030 namespace o2scl {
00031 #endif
00032 
00033   /** \brief Two-dimensional interpolation for equally-spaced intervals
00034 
00035       \note This class is unfinished.
00036 
00037       This implements the relations from Abramowitz and Stegun:
00038       \f[
00039       f(x_0+p h,y_0+q k)=
00040       \f]
00041       3-point
00042       \f[
00043       (1-p-q) f_{0,0}+p f_{1,0}+q f_{0,1}
00044       \f]
00045       4-point
00046       \f[
00047       (1-p)(1-q) f_{0,0}+p(1-q)f_{1,0}+q(1-p)f_{0,1}+pqf_{1,1}
00048       \f]
00049       6-point
00050       \f[
00051       \frac{q(q-1)}{2}f_{0,-1}+\frac{p(p-1)}{2}f_{-1,0}+
00052       (1+pq-p^2-q^2)f_{0,0}+\frac{p(p-2q+1)}{2}f_{1,0}+
00053       \frac{q(q-2p+1)}{2}f_{0,1}+pqf_{1,1}
00054       \f]
00055   */
00056   class twod_eqi_intp {
00057   public:
00058     
00059     twod_eqi_intp();
00060 
00061     /** \brief Perform the 2-d interpolation 
00062      */
00063     double interp(double x, double y);
00064 
00065     /** \brief Offset in x-direction 
00066      */
00067     double xoff;
00068     
00069     /** \brief Offset in y-direction 
00070      */
00071     double yoff;
00072 
00073     /** \brief Set the interpolation type
00074 
00075         - 3: 3-point
00076         - 4: 4-point
00077         - 6: 6-point (default)
00078      */
00079     int set_type(int type) {
00080       if (type<=0) itype=6;
00081       else if (type<=3) itype=3;
00082       else if (type>=5) itype=6;
00083       else type=4;
00084       return 0;
00085     }
00086 
00087 #ifndef DOXYGENP
00088 
00089   protected:
00090 
00091     int itype;
00092 
00093 #endif
00094 
00095   };
00096   
00097 #ifndef DOXYGENP
00098 }
00099 #endif
00100 
00101 #endif
00102 
00103 
00104 
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.