ASCOT5
Loading...
Searching...
No Matches
Functions
interp3Dexpl.c File Reference

Tricubic spline interpolation in explicit form. More...

#include <stdlib.h>
#include <math.h>
#include "../ascot5.h"
#include "../consts.h"
#include "interp.h"
#include "spline.h"

Go to the source code of this file.

Functions

int interp3Dexpl_init_coeff (real *c, real *f, int n_x, int n_y, int n_z, int bc_x, int bc_y, int bc_z, real x_min, real x_max, real y_min, real y_max, real z_min, real z_max)
 Calculate tricubic spline interpolation coefficients for 3D data.
 
void interp3Dexpl_init_spline (interp3D_data *str, real *c, int n_x, int n_y, int n_z, int bc_x, int bc_y, int bc_z, real x_min, real x_max, real y_min, real y_max, real z_min, real z_max)
 Initialize a tricubic spline.
 
a5err interp3Dexpl_eval_f (real *f, interp3D_data *str, real x, real y, real z)
 Evaluate interpolated value of 3D scalar field.
 
a5err interp3Dexpl_eval_df (real *f_df, interp3D_data *str, real x, real y, real z)
 Evaluate interpolated value of 3D field and 1st and 2nd derivatives.
 

Detailed Description

Tricubic spline interpolation in explicit form.

Definition in file interp3Dexpl.c.

Function Documentation

◆ interp3Dexpl_init_coeff()

int interp3Dexpl_init_coeff ( real * c,
real * f,
int n_x,
int n_y,
int n_z,
int bc_x,
int bc_y,
int bc_z,
real x_min,
real x_max,
real y_min,
real y_max,
real z_min,
real z_max )

Calculate tricubic spline interpolation coefficients for 3D data.

This function calculates the tricubic spline interpolation coefficients for the given data and stores them in an array. Explicit cofficients are calculated.

Parameters
callocated array of length n_z*n_y*n_x*64 to store the coefficients
f3D data to be interpolated
n_xnumber of data points in the x direction
n_ynumber of data points in the y direction
n_znumber of data points in the z direction
bc_xboundary condition for x axis
bc_yboundary condition for y axis
bc_zboundary condition for z axis
x_minminimum value of the x axis
x_maxmaximum value of the x axis
y_minminimum value of the y axis
y_maxmaximum value of the y axis
z_minminimum value of the z axis
z_maxmaximum value of the z axis
Returns
zero if initialization succeeded

Definition at line 37 of file interp3Dexpl.c.

◆ interp3Dexpl_init_spline()

void interp3Dexpl_init_spline ( interp3D_data * str,
real * c,
int n_x,
int n_y,
int n_z,
int bc_x,
int bc_y,
int bc_z,
real x_min,
real x_max,
real y_min,
real y_max,
real z_min,
real z_max )

Initialize a tricubic spline.

Parameters
strpointer to spline to be initialized
carray where coefficients are stored
n_xnumber of data points in the x direction
n_ynumber of data points in the y direction
n_znumber of data points in the z direction
bc_xboundary condition for x axis
bc_yboundary condition for y axis
bc_zboundary condition for z axis
x_minminimum value of the x axis
x_maxmaximum value of the x axis
y_minminimum value of the y axis
y_maxmaximum value of the y axis
z_minminimum value of the z axis
z_maxmaximum value of the z axis

Definition at line 153 of file interp3Dexpl.c.

◆ interp3Dexpl_eval_f()

a5err interp3Dexpl_eval_f ( real * f,
interp3D_data * str,
real x,
real y,
real z )

Evaluate interpolated value of 3D scalar field.

This function evaluates the interpolated value of a 3D scalar field using tricubic spline interpolation coefficients of the explicit form.

Parameters
fvariable in which to place the evaluated value
strdata struct for data interpolation
xx-coordinate
yy-coordinate
zz-coordinate
Returns
zero on success and one if (x,y,z) point is outside the grid.

< Index jump to cell

Definition at line 200 of file interp3Dexpl.c.

◆ interp3Dexpl_eval_df()

a5err interp3Dexpl_eval_df ( real * f_df,
interp3D_data * str,
real x,
real y,
real z )

Evaluate interpolated value of 3D field and 1st and 2nd derivatives.

This function evaluates the interpolated value of a 3D 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[0] = f
  • f_df[1] = f_x
  • f_df[2] = f_y
  • f_df[3] = f_z
  • f_df[4] = f_xx
  • f_df[5] = f_yy
  • f_df[6] = f_zz
  • f_df[7] = f_xy
  • f_df[8] = f_xz
  • f_df[9] = f_yz
Parameters
f_dfarray in which to place the evaluated values
strdata struct for data interpolation
xx-coordinate
yy-coordinate
zz-coordinate
Returns
zero on success and one if (x,y,z) point is outside the grid.

Definition at line 340 of file interp3Dexpl.c.