Streamer fluid modeling - An overview of ARCoS
1.0
|
New interpolation routines. More...
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <math.h>
#include "grid.h"
#include "interpol2.h"
#include "parameters.h"
#include "proto.h"
#include "rz_array.h"
#include "species.h"
Go to the source code of this file.
Macros | |
#define | anm(N_, M_) this->stencil[(N_) * this->method->q + (M_)] |
Functions | |
static double | gen_apply (interpol_t *this, double r, double z) |
gen_apply ?????. | |
void | bilin_set_coeffs (interpol_t *this) |
For bilinear interpolations, the standard fallback routines are too slow, so we define optimized routines to increase performance. The results, however, should be the same. | |
void | quadlog_set_coeffs (interpol_t *this) |
double | quadlog_apply (interpol_t *this, double r, double z) |
interpol_t * | interpol_new_a (double Lr, double Lz, interpol_method_t *method) |
Creates a new interpolator that uses a given method. | |
void | interpol_free (interpol_t *this) |
Frees the interpolator. | |
void | interpol_set_stencil (interpol_t *this, double r0, double z0,...) |
Sets the stencil of the interpolation object. | |
void | interpol_set_stencil_at (grid_t *grid, interpol_t *this, double r0, double z0, rz_array_t *ar, int ir, int iz, int itheta) |
Sets the stencil reading from an array. | |
void | interpol_set_coeffs (interpol_t *this) |
Calculates the coefficients of the interpolating polynomial. | |
double | interpol_apply (interpol_t *this, double r, double z) |
Evaluates the interpolating polynomial. | |
double | bilin_apply (interpol_t *this, double r, double z) |
Variables | |
double | matrix_zero [] = {1.0} |
interpol_method_t | interpol_zero |
interpol_method_t | interpol_zero_masses |
double | matrix_quadratic [] |
interpol_method_t | interpol_quadratic |
interpol_method_t | interpol_quadratic_masses |
double | matrix_wackers [] |
In this approach, we make sure that the interpolation error at the matrix center (anm(2, 2)) is zero (this is used by J. Wackers' code) | |
interpol_method_t | interpol_wackers |
interpol_method_t | interpol_wackers_masses |
double | matrix_averaged [] |
interpol_method_t | interpol_averaged |
interpol_method_t | interpol_averaged_masses |
double | matrix_bilin [] |
interpol_method_t | interpol_bilin |
interpol_method_t | interpol_bilin_masses |
interpol_method_t | interpol_quadlog |
interpol_method_t * | interpol_methods_index [MAX_INTERPOL_METHODS] |
New interpolation routines.
We want to obtain a function from another one
which is known only in some points of a stencil,
.
We approximate as
where ,
being the order of the interpolating function plus one.
The coefficients are calculated from
as
Thus, to define an interpolation method, we only need the matrix , which has
elements.
HOWEVER, using this general interpolation matrix turns out to be too slow. Hence we define also specific routines that have the same interface and that are called transparently. Thus the calling program does not have to worry about the internals of how the interpolation is computed.
Definition in file interpol2.c.
#define anm | ( | N_, | |
M_ | |||
) | this->stencil[(N_) * this->method->q + (M_)] |
Definition at line 40 of file interpol2.c.
|
static |
gen_apply ?????.
Definition at line 211 of file interpol2.c.
void bilin_set_coeffs | ( | interpol_t * | this | ) |
For bilinear interpolations, the standard fallback routines are too slow, so we define optimized routines to increase performance. The results, however, should be the same.
Definition at line 363 of file interpol2.c.
void quadlog_set_coeffs | ( | interpol_t * | this | ) |
double quadlog_apply | ( | interpol_t * | this, |
double | r, | ||
double | z | ||
) |
interpol_t* interpol_new_a | ( | double | Lr, |
double | Lz, | ||
interpol_method_t * | method | ||
) |
Creates a new interpolator that uses a given method.
Definition at line 49 of file interpol2.c.
void interpol_free | ( | interpol_t * | this | ) |
Frees the interpolator.
Definition at line 70 of file interpol2.c.
void interpol_set_stencil | ( | interpol_t * | this, |
double | r0, | ||
double | z0, | ||
... | |||
) |
Sets the stencil of the interpolation object.
r0 and z0 are the coordinates of the bottom-left corner of the stencil (the [0,0] point).
Definition at line 83 of file interpol2.c.
void interpol_set_stencil_at | ( | grid_t * | grid, |
interpol_t * | this, | ||
double | r0, | ||
double | z0, | ||
rz_array_t * | ar, | ||
int | ir, | ||
int | iz, | ||
int | itheta | ||
) |
Sets the stencil reading from an array.
ir, iz give the index of the cell in the array corresponding to the stencil origin.
Definition at line 116 of file interpol2.c.
void interpol_set_coeffs | ( | interpol_t * | this | ) |
Calculates the coefficients of the interpolating polynomial.
Has to be called after interpol_set_stencil.
Definition at line 161 of file interpol2.c.
double interpol_apply | ( | interpol_t * | this, |
double | r, | ||
double | z | ||
) |
Evaluates the interpolating polynomial.
Definition at line 190 of file interpol2.c.
double bilin_apply | ( | interpol_t * | this, |
double | r, | ||
double | z | ||
) |
Definition at line 382 of file interpol2.c.
double matrix_zero[] = {1.0} |
You are not supposed to understand these numbers. Refer to InterpolArrays.nb
Definition at line 246 of file interpol2.c.
interpol_method_t interpol_zero |
Definition at line 248 of file interpol2.c.
interpol_method_t interpol_zero_masses |
Definition at line 252 of file interpol2.c.
double matrix_quadratic[] |
Coefficients for a 9-point stencil quadratic interpolation.
Definition at line 260 of file interpol2.c.
interpol_method_t interpol_quadratic |
Definition at line 282 of file interpol2.c.
interpol_method_t interpol_quadratic_masses |
Definition at line 286 of file interpol2.c.
double matrix_wackers[] |
In this approach, we make sure that the interpolation error at the matrix center (anm(2, 2)) is zero (this is used by J. Wackers' code)
Definition at line 293 of file interpol2.c.
interpol_method_t interpol_wackers |
Definition at line 313 of file interpol2.c.
interpol_method_t interpol_wackers_masses |
Definition at line 317 of file interpol2.c.
double matrix_averaged[] |
Definition at line 322 of file interpol2.c.
interpol_method_t interpol_averaged |
Definition at line 342 of file interpol2.c.
interpol_method_t interpol_averaged_masses |
Definition at line 346 of file interpol2.c.
double matrix_bilin[] |
Definition at line 351 of file interpol2.c.
interpol_method_t interpol_bilin |
Definition at line 396 of file interpol2.c.
interpol_method_t interpol_bilin_masses |
Definition at line 403 of file interpol2.c.
interpol_method_t interpol_quadlog |
Definition at line 432 of file interpol2.c.
interpol_method_t* interpol_methods_index[MAX_INTERPOL_METHODS] |
Definition at line 437 of file interpol2.c.