Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-21 10:03:48

0001 /* interpolation/gsl_interp2d.h
0002  * 
0003  * Copyright 2012 David Zaslavsky
0004  * 
0005  * This program is free software; you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation; either version 3 of the License, or (at
0008  * your option) any later version.
0009  * 
0010  * This program is distributed in the hope that it will be useful, but
0011  * WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013  * General Public License for more details.
0014  * 
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program; if not, write to the Free Software
0017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef __GSL_INTERP2D_H__
0021 #define __GSL_INTERP2D_H__
0022 
0023 #include <gsl/gsl_interp.h>
0024 
0025 #undef __BEGIN_DECLS
0026 #undef __END_DECLS
0027 #ifdef __cplusplus
0028 # define __BEGIN_DECLS extern "C" {
0029 # define __END_DECLS }
0030 #else
0031 # define __BEGIN_DECLS /* empty */
0032 # define __END_DECLS /* empty */
0033 #endif
0034 
0035 __BEGIN_DECLS
0036 
0037 typedef struct {
0038     const char* name;
0039     unsigned int min_size;
0040     void * (*alloc)(size_t xsize, size_t ysize);
0041     int    (*init)(void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize);
0042     int    (*eval)(const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z);
0043     int    (*eval_deriv_x) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p);
0044     int    (*eval_deriv_y) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_p);
0045     int    (*eval_deriv_xx) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp);
0046     int    (*eval_deriv_xy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp);
0047     int    (*eval_deriv_yy) (const void *, const double xa[], const double ya[], const double za[], size_t xsize, size_t ysize, double x, double y, gsl_interp_accel*, gsl_interp_accel*, double* z_pp);
0048     void   (*free)(void *);
0049 } gsl_interp2d_type;
0050 
0051 typedef struct {
0052     const gsl_interp2d_type * type; /* interpolation type */
0053     double xmin;                    /* minimum value of x for which data have been provided */
0054     double xmax;                    /* maximum value of x for which data have been provided */
0055     double ymin;                    /* minimum value of y for which data have been provided */
0056     double ymax;                    /* maximum value of y for which data have been provided */
0057     size_t xsize;                   /* number of x values provided */
0058     size_t ysize;                   /* number of y values provided */
0059     void * state;                   /* internal state object specific to the interpolation type */
0060 } gsl_interp2d;
0061 
0062 /* available types */
0063 GSL_VAR const gsl_interp2d_type * gsl_interp2d_bilinear;
0064 GSL_VAR const gsl_interp2d_type * gsl_interp2d_bicubic;
0065 
0066 gsl_interp2d * gsl_interp2d_alloc(const gsl_interp2d_type * T, const size_t xsize,
0067                                   const size_t ysize);
0068 
0069 const char * gsl_interp2d_name(const gsl_interp2d * interp);
0070 size_t gsl_interp2d_min_size(const gsl_interp2d * interp);
0071 size_t gsl_interp2d_type_min_size(const gsl_interp2d_type * T);
0072 int gsl_interp2d_set(const gsl_interp2d * interp, double zarr[],
0073                      const size_t i, const size_t j, const double z);
0074 double gsl_interp2d_get(const gsl_interp2d * interp, const double zarr[],
0075                         const size_t i, const size_t j);
0076 size_t gsl_interp2d_idx(const gsl_interp2d * interp,
0077                         const size_t i, const size_t j);
0078 int gsl_interp2d_init(gsl_interp2d * interp, const double xa[], const double ya[],
0079                       const double za[], const size_t xsize, const size_t ysize);
0080 void gsl_interp2d_free(gsl_interp2d * interp);
0081 
0082 double gsl_interp2d_eval(const gsl_interp2d * interp, const double xarr[],
0083                          const double yarr[], const double zarr[], const double x,
0084                          const double y, gsl_interp_accel * xa, gsl_interp_accel * ya);
0085 
0086 double gsl_interp2d_eval_extrap(const gsl_interp2d * interp,
0087                                 const double xarr[], const double yarr[],
0088                                 const double zarr[], const double x,
0089                                 const double y, gsl_interp_accel * xa,
0090                                 gsl_interp_accel * ya);
0091 
0092 int gsl_interp2d_eval_e(const gsl_interp2d * interp, const double xarr[],
0093                         const double yarr[], const double zarr[],
0094                         const double x, const double y, gsl_interp_accel* xa,
0095                         gsl_interp_accel* ya, double * z);
0096 
0097 #ifndef GSL_DISABLE_DEPRECATED
0098 
0099 int gsl_interp2d_eval_e_extrap(const gsl_interp2d * interp,
0100                                const double xarr[],
0101                                const double yarr[],
0102                                const double zarr[],
0103                                const double x,
0104                                const double y,
0105                                gsl_interp_accel * xa,
0106                                gsl_interp_accel * ya,
0107                                double * z);
0108 
0109 #endif /* !GSL_DISABLE_DEPRECATED */
0110 
0111 int gsl_interp2d_eval_extrap_e(const gsl_interp2d * interp,
0112                                const double xarr[],
0113                                const double yarr[],
0114                                const double zarr[],
0115                                const double x,
0116                                const double y,
0117                                gsl_interp_accel * xa,
0118                                gsl_interp_accel * ya,
0119                                double * z);
0120 
0121 double gsl_interp2d_eval_deriv_x(const gsl_interp2d * interp, const double xarr[],
0122                                  const double yarr[], const double zarr[],
0123                                  const double x, const double y, gsl_interp_accel * xa,
0124                                  gsl_interp_accel * ya);
0125 
0126 int gsl_interp2d_eval_deriv_x_e(const gsl_interp2d * interp, const double xarr[],
0127                                 const double yarr[], const double zarr[],
0128                                 const double x, const double y,
0129                                 gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
0130 
0131 double gsl_interp2d_eval_deriv_y(const gsl_interp2d * interp, const double xarr[],
0132                                  const double yarr[], const double zarr[],
0133                                  const double x, const double y,
0134                                  gsl_interp_accel* xa, gsl_interp_accel* ya);
0135 
0136 int gsl_interp2d_eval_deriv_y_e(const gsl_interp2d * interp, const double xarr[],
0137                                 const double yarr[], const double zarr[],
0138                                 const double x, const double y,
0139                                 gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
0140 
0141 double gsl_interp2d_eval_deriv_xx(const gsl_interp2d * interp, const double xarr[],
0142                                   const double yarr[], const double zarr[],
0143                                   const double x, const double y,
0144                                   gsl_interp_accel * xa, gsl_interp_accel * ya);
0145 
0146 int gsl_interp2d_eval_deriv_xx_e(const gsl_interp2d * interp, const double xarr[],
0147                                  const double yarr[], const double zarr[],
0148                                  const double x, const double y,
0149                                  gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
0150 
0151 double gsl_interp2d_eval_deriv_yy(const gsl_interp2d * interp, const double xarr[],
0152                                   const double yarr[], const double zarr[],
0153                                   const double x, const double y,
0154                                   gsl_interp_accel * xa, gsl_interp_accel * ya);
0155 
0156 int gsl_interp2d_eval_deriv_yy_e(const gsl_interp2d * interp, const double xarr[],
0157                                  const double yarr[], const double zarr[],
0158                                  const double x, const double y,
0159                                  gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
0160 
0161 double gsl_interp2d_eval_deriv_xy(const gsl_interp2d * interp, const double xarr[],
0162                                   const double yarr[], const double zarr[],
0163                                   const double x, const double y,
0164                                   gsl_interp_accel * xa, gsl_interp_accel * ya);
0165 
0166 int gsl_interp2d_eval_deriv_xy_e(const gsl_interp2d * interp, const double xarr[],
0167                                  const double yarr[], const double zarr[],
0168                                  const double x, const double y,
0169                                  gsl_interp_accel * xa, gsl_interp_accel * ya, double * z);
0170 
0171 
0172 __END_DECLS
0173 
0174 #endif /* __GSL_INTERP2D_H__ */