ASCOT5
|
Bicubic spline interpolation in explicit form. More...
#include <stdlib.h>
#include <math.h>
#include "../ascot5.h"
#include "interp.h"
#include "spline.h"
Go to the source code of this file.
Functions | |
int | interp2Dexpl_init_coeff (real *c, real *f, int n_x, int n_y, int bc_x, int bc_y, real x_min, real x_max, real y_min, real y_max) |
Calculate bicubic spline interpolation coefficients for scalar 2D data. | |
void | interp2Dexpl_init_spline (interp2D_data *str, real *c, int n_x, int n_y, int bc_x, int bc_y, real x_min, real x_max, real y_min, real y_max) |
Initialize a bicubic spline. | |
a5err | interp2Dexpl_eval_f (real *f, interp2D_data *str, real x, real y) |
Evaluate interpolated value of 2D scalar field. | |
a5err | interp2Dexpl_eval_df (real *f_df, interp2D_data *str, real x, real y) |
Evaluate interpolated value and 1st and 2nd derivatives of 2D field. | |
Bicubic spline interpolation in explicit form.
Definition in file interp2Dexpl.c.
int interp2Dexpl_init_coeff | ( | real * | c, |
real * | f, | ||
int | n_x, | ||
int | n_y, | ||
int | bc_x, | ||
int | bc_y, | ||
real | x_min, | ||
real | x_max, | ||
real | y_min, | ||
real | y_max ) |
Calculate bicubic spline interpolation coefficients for scalar 2D data.
This function calculates the bicubic spline interpolation coefficients and stores them in a pre-allocated array. Explicit cofficients are calculated.
For each data point four coefficients are stored for spline-interpolation.
c | allocated array of length n_y*n_x*16 to store the coefficients |
f | 2D data to be interpolated |
n_x | number of data points in the x direction |
n_y | number of data points in the y direction |
bc_x | boundary condition for x axis (0) natural (1) periodic |
bc_y | boundary condition for y axis (0) natural (1) periodic |
x_min | minimum value of the x axis |
x_max | maximum value of the x axis |
y_min | minimum value of the y axis |
y_max | maximum value of the y axis |
Definition at line 33 of file interp2Dexpl.c.
void interp2Dexpl_init_spline | ( | interp2D_data * | str, |
real * | c, | ||
int | n_x, | ||
int | n_y, | ||
int | bc_x, | ||
int | bc_y, | ||
real | x_min, | ||
real | x_max, | ||
real | y_min, | ||
real | y_max ) |
Initialize a bicubic spline.
str | pointer to spline to be initialized |
c | array where coefficients are stored |
n_x | number of data points in the x direction |
n_y | number of data points in the y direction |
bc_x | boundary condition for x axis |
bc_y | boundary condition for y axis |
x_min | minimum value of the x axis |
x_max | maximum value of the x axis |
y_min | minimum value of the y axis |
y_max | maximum value of the y axis |
Definition at line 108 of file interp2Dexpl.c.
a5err interp2Dexpl_eval_f | ( | real * | f, |
interp2D_data * | str, | ||
real | x, | ||
real | y ) |
Evaluate interpolated value of 2D scalar field.
This function evaluates the interpolated value of a 2D scalar field using bicubic spline interpolation coefficients of the explicit form.
f | variable in which to place the evaluated value |
str | data struct for data interpolation |
x | x-coordinate |
y | y-coordinate |
Definition at line 146 of file interp2Dexpl.c.
a5err interp2Dexpl_eval_df | ( | real * | f_df, |
interp2D_data * | str, | ||
real | x, | ||
real | y ) |
Evaluate interpolated value and 1st and 2nd derivatives of 2D field.
This function evaluates the interpolated value of a 2D scalar field and its 1st and 2nd derivatives using bicubic spline interpolation coefficients of the explicit form.
The evaluated values are returned in an array with following elements:
f_df | array in which to place the evaluated values |
str | data struct for data interpolation |
x | x-coordinate |
y | y-coordinate |
Definition at line 220 of file interp2Dexpl.c.