27 real rmin = r[0], rmax = r[0];
28 real zmin = z[0], zmax = z[0];
29 for(
int i=0; i < nelements; i++) {
30 rmin = fmin(rmin, r[i]);
31 rmax = fmax(rmax, r[i]);
32 zmin = fmin(zmin, z[i]);
33 zmax = fmax(zmax, z[i]);
40 " R extend = [%2.2f, %2.2f], z extend = [%2.2f, %2.2f]\n",
41 nelements, rmin, rmax, zmin, zmax);
85 for(
int i = 0; i < w->
n; i++) {
86 real wr1, wr2, wz1, wz2;
99 real ri = wr1 + (wz1*(wr2-wr1)) / (wz1-wz2);
153 for(
int i=0; i<w->
n; i++) {
167 real div = (r1 - r2) * (z3 - z4) - (z1 - z2) * (r3 - r4);
168 real t = ( (r1 - r3) * (z3 - z4) - (z1 - z3) * (r3 - r4) ) / div;
169 real u = ( (r1 - r3) * (z1 - z2) - (z1 - z3) * (r1 - r2) ) / div;
170 if(0 <= t && t <= 1.0 && 0 <= u && u <= 1.0 && t < t0) {
Main header file for ASCOT5.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
void wall_2d_offload(wall_2d_data *data)
Offload data to the accelerator.
int wall_2d_find_intersection(real r1, real z1, real r2, real z2, wall_2d_data *w, real *w_coll)
Find intersection between the wall element and line segment.
int wall_2d_inside(real r, real z, wall_2d_data *w)
Check if coordinates are within 2D polygon wall.
void wall_2d_free(wall_2d_data *data)
Free allocated resources.
int wall_2d_init(wall_2d_data *data, int nelements, real *r, real *z)
Load 2D wall data and prepare parameters.
int wall_2d_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_2d_data *w, real *w_coll)
Check if trajectory from (r1, phi1, z1) to (r2, phi2, z2) intersects the wall.
Header file for wall_2d.c.