34 int n_x,
int n_y,
int bc_x,
int bc_y,
39 real* f_x = malloc(n_x*
sizeof(
real));
40 real* f_y = malloc(n_y*
sizeof(
real));
45 if(f_x == NULL || f_y == NULL || c_x == NULL || c_y == NULL) {
55 for(
int i_y=0; i_y<n_y; i_y++) {
56 for(
int i_x=0; i_x<n_x; i_x++) {
57 f_x[i_x] = f[i_y*n_x+i_x];
60 for(
int i_x=0; i_x<n_x-1; i_x++) {
61 for(
int i_c=0; i_c<4; i_c++) {
62 c[i_y*n_x*16+i_x*16+i_c] = c_x[i_x*4+i_c];
69 for(
int i_x=0; i_x<n_x-1; i_x++) {
70 for(
int i_s=0; i_s<4; i_s++) {
71 for(
int i_y=0; i_y<n_y; i_y++) {
72 f_y[i_y] = c[i_y*n_x*16+i_x*16+i_s];
75 for(
int i_y=0; i_y<n_y-1; i_y++) {
77 for(
int i_c=i_s; i_c<16; i_c=i_c+4) {
78 c[i_y*n_x*16+i_x*16+i_c] = c_y[i_y*4+i_ct];
109 int n_x,
int n_y,
int bc_x,
int bc_y,
116 real x_grid = (x_max - x_min) / ( n_x - 1 * (bc_x ==
NATURALBC) );
117 real y_grid = (y_max - y_min) / ( n_y - 1 * (bc_y ==
NATURALBC) );
174 int n = i_y*str->
n_x*16+i_x*16;
188 str->
c[n+ 0]+dx*str->
c[n+ 1]+dx2*str->
c[n+ 2]+dx3*str->
c[n+ 3]
190 str->
c[n+ 4]+dx*str->
c[n+ 5]+dx2*str->
c[n+ 6]+dx3*str->
c[n+ 7])
192 str->
c[n+ 8]+dx*str->
c[n+ 9]+dx2*str->
c[n+10]+dx3*str->
c[n+11])
194 str->
c[n+12]+dx*str->
c[n+13]+dx2*str->
c[n+14]+dx3*str->
c[n+15]);
250 int n = i_y*str->
n_x*16+i_x*16;
265 str->
c[n+ 0]+dx*str->
c[n+ 1]+dx2*str->
c[n+ 2]+dx3*str->
c[n+ 3]
267 str->
c[n+ 4]+dx*str->
c[n+ 5]+dx2*str->
c[n+ 6]+dx3*str->
c[n+ 7])
269 str->
c[n+ 8]+dx*str->
c[n+ 9]+dx2*str->
c[n+10]+dx3*str->
c[n+11])
271 str->
c[n+12]+dx*str->
c[n+13]+dx2*str->
c[n+14]+dx3*str->
c[n+15]);
276 str->
c[n+ 1]+2*dx*str->
c[n+ 2]+3*dx2*str->
c[n+ 3]
277 +dy*(str->
c[n+ 5]+2*dx*str->
c[n+ 6]+3*dx2*str->
c[n+ 7])
278 +dy2*(str->
c[n+ 9]+2*dx*str->
c[n+10]+3*dx2*str->
c[n+11])
279 +dy3*(str->
c[n+13]+2*dx*str->
c[n+14]+3*dx2*str->
c[n+15]));
284 str->
c[n+ 4]+dx *str->
c[n+ 5]
285 +dx2*str->
c[n+ 6]+dx3*str->
c[n+ 7]
287 str->
c[n+ 8]+dx *str->
c[n+ 9]
288 +dx2*str->
c[n+10]+dx3*str->
c[n+11])
290 str->
c[n+12]+dx *str->
c[n+13]
291 +dx2*str->
c[n+14]+dx3*str->
c[n+15]));
296 2*str->
c[n+ 2]+6*dx*str->
c[n+ 3]
297 +dy*(2*str->
c[n+ 6]+6*dx*str->
c[n+ 7])
298 +dy2*(2*str->
c[n+10]+6*dx*str->
c[n+11])
299 +dy3*(2*str->
c[n+14]+6*dx*str->
c[n+15]));
304 2*( str->
c[n+ 8]+dx *str->
c[n+ 9]
305 +dx2*str->
c[n+10]+dx3*str->
c[n+11])
306 +6*dy*( str->
c[n+12]+dx *str->
c[n+13]
307 +dx2*str->
c[n+14]+dx3*str->
c[n+15]));
312 str->
c[n+ 5]+2*dx*str->
c[n+ 6]+3*dx2*str->
c[n+ 7]
313 +2*dy*(str->
c[n+ 9]+2*dx*str->
c[n+10]+3*dx2*str->
c[n+11])
314 +3*dy2*(str->
c[n+13]+2*dx*str->
c[n+14]+3*dx2*str->
c[n+15]));
Main header file for ASCOT5.
unsigned long int a5err
Simulation error flag.
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.
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.
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.
Spline interpolation library.
real fmod(real x, real y)
Compute the modulus of two real numbers.
Header file for splineexpl.c and splinecomp.c.
void splineexpl(real *f, int n, int bc, real *c)
Calculate explicit cubic spline interpolation coefficients in 1D.
Bicubic interpolation struct.