00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, 2008, 2009, 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 /** 00034 \brief Two-dimensional interpolation for equally-spaced intervals 00035 00036 \note This class is unfinished. 00037 00038 This implements the relations from Abramowitz and Stegun: 00039 \f[ 00040 f(x_0+p h,y_0+q k)= 00041 \f] 00042 3-point 00043 \f[ 00044 (1-p-q) f_{0,0}+p f_{1,0}+q f_{0,1} 00045 \f] 00046 4-point 00047 \f[ 00048 (1-p)(1-q) f_{0,0}+p(1-q)f_{1,0}+q(1-p)f_{0,1}+pqf_{1,1} 00049 \f] 00050 6-point 00051 \f[ 00052 \frac{q(q-1)}{2}f_{0,-1}+\frac{p(p-1)}{2}f_{-1,0}+ 00053 (1+pq-p^2-q^2)f_{0,0}+\frac{p(p-2q+1)}{2}f_{1,0}+ 00054 \frac{q(q-2p+1)}{2}f_{0,1}+pqf_{1,1} 00055 \f] 00056 */ 00057 class twod_eqi_intp { 00058 public: 00059 00060 twod_eqi_intp(); 00061 00062 /** \brief Perform the 2-d interpolation 00063 */ 00064 double interp(double x, double y); 00065 00066 /** \brief Offset in x-direction 00067 */ 00068 double xoff; 00069 00070 /** \brief Offset in y-direction 00071 */ 00072 double yoff; 00073 00074 /** \brief Set the interpolation type 00075 00076 - 3: 3-point 00077 - 4: 4-point 00078 - 6: 6-point (default) 00079 */ 00080 int set_type(int type) { 00081 if (type<=0) itype=6; 00082 else if (type<=3) itype=3; 00083 else if (type>=5) itype=6; 00084 else type=4; 00085 return 0; 00086 } 00087 00088 #ifndef DOXYGENP 00089 00090 protected: 00091 00092 int itype; 00093 00094 #endif 00095 00096 }; 00097 00098 #ifndef DOXYGENP 00099 } 00100 #endif 00101 00102 #endif 00103 00104 00105
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page