ASCOT5
Loading...
Searching...
No Matches
wall_3d.h
Go to the documentation of this file.
1
5#ifndef WALL_3D_H
6#define WALL_3D_H
7#include "../ascot5.h"
8#include "../offload.h"
9
11#define WALL_EPSILON 1e-9
12
16typedef struct {
17 int n;
27 int depth;
28 int ngrid;
41 int tree_array_size; /* Number of elements in tree_array */
43
44int wall_3d_init(wall_3d_data* data, int nelements, real* x1x2x3, real* y1y2y3,
45 real* z1z2z3);
46void wall_3d_free(wall_3d_data* data);
48GPU_DECLARE_TARGET_SIMD_UNIFORM(w)
49int wall_3d_hit_wall(real r1, real phi1, real z1, real r2, real phi2,
50 real z2, wall_3d_data* w, real* w_coll);
51DECLARE_TARGET_END
52GPU_DECLARE_TARGET_SIMD_UNIFORM(w)
53int wall_3d_hit_wall_full(real r1, real phi1, real z1, real r2, real phi2,
54 real z2, wall_3d_data* w, real* w_coll);
55DECLARE_TARGET_END
56GPU_DECLARE_TARGET_SIMD
57double wall_3d_tri_collision(real q1[3], real q2[3], real t1[3], real t2[3],
58 real t3[3]);
59DECLARE_TARGET_END
60
61DECLARE_TARGET
62void wall_3d_init_tree(wall_3d_data* w, real* offload_array);
63DECLARE_TARGET_END
64DECLARE_TARGET
65int wall_3d_tri_in_cube(real t1[3], real t2[3], real t3[3], real bb1[3],
66 real bb2[3]);
67DECLARE_TARGET_END
68DECLARE_TARGET
69int wall_3d_quad_collision(real q1[3], real q2[3], real t1[3], real t2[3],
70 real t3[3], real t4[3]);
71DECLARE_TARGET_END
72
73#endif
Main header file for ASCOT5.
double real
Definition ascot5.h:85
3D wall data parameters
Definition wall_3d.h:16
real zgrid
Definition wall_3d.h:26
int * tree_array
Array storing information what triangles given octree cell stores.
Definition wall_3d.h:40
real zmax
Definition wall_3d.h:25
real xmax
Definition wall_3d.h:19
real zmin
Definition wall_3d.h:24
real ymin
Definition wall_3d.h:21
real xmin
Definition wall_3d.h:18
real * wall_tris
Definition wall_3d.h:30
real xgrid
Definition wall_3d.h:20
real ygrid
Definition wall_3d.h:23
real ymax
Definition wall_3d.h:22
DECLARE_TARGET_END DECLARE_TARGET void wall_3d_init_tree(wall_3d_data *w, real *offload_array)
Construct wall octree iteratively.
Definition wall_3d.c:143
int wall_3d_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_3d_data *w, real *w_coll)
Check if trajectory from (r1, phi1, z1) to (r2, phi2, z2) intersects the wall using the octree struct...
Definition wall_3d.c:315
void wall_3d_free(wall_3d_data *data)
Free allocated resources.
Definition wall_3d.c:115
void wall_3d_offload(wall_3d_data *data)
Offload data to the accelerator.
Definition wall_3d.c:125
DECLARE_TARGET_END GPU_DECLARE_TARGET_SIMD double wall_3d_tri_collision(real q1[3], real q2[3], real t1[3], real t2[3], real t3[3])
Check if a line segment intersects a triangle.
Definition wall_3d.c:520
DECLARE_TARGET_END DECLARE_TARGET int wall_3d_tri_in_cube(real t1[3], real t2[3], real t3[3], real bb1[3], real bb2[3])
Check if any part of a triangle is inside a box.
Definition wall_3d.c:440
DECLARE_TARGET_END int wall_3d_hit_wall_full(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_3d_data *w, real *w_coll)
Check if trajectory from (r1, phi1, z1) to (r2, phi2, z2) intersects the wall against all triangles.
Definition wall_3d.c:395
DECLARE_TARGET_END DECLARE_TARGET int wall_3d_quad_collision(real q1[3], real q2[3], real t1[3], real t2[3], real t3[3], real t4[3])
Check if a line segment intersects a quad (assumed planar)
Definition wall_3d.c:595
int wall_3d_init(wall_3d_data *data, int nelements, real *x1x2x3, real *y1y2y3, real *z1z2z3)
Initialize 3D wall data and check inputs.
Definition wall_3d.c:46