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

Bilinear interpolation. More...

#include <stdlib.h>
#include <math.h>
#include "../ascot5.h"
#include "linint.h"

Go to the source code of this file.

Functions

void linint2D_init (linint2D_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 linear interpolation struct for scalar 2D data.
 
int linint2D_eval_f (real *f, linint2D_data *str, real x, real y)
 Evaluate interpolated value of 2D scalar field.
 

Detailed Description

Bilinear interpolation.

Definition in file linint2D.c.

Function Documentation

◆ linint2D_init()

void linint2D_init ( linint2D_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 linear interpolation struct for scalar 2D data.

Parameters
strpointer to struct to be initialized
carray where data is stored
n_xnumber of data points in the x direction
n_ynumber of data points in the y direction
bc_xboundary condition for x axis
bc_yboundary condition for y 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

Definition at line 25 of file linint2D.c.

◆ linint2D_eval_f()

int linint2D_eval_f ( real * f,
linint2D_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 bilinear interpolation.

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

Definition at line 58 of file linint2D.c.