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;
31 int* flag;
32
42 int tree_array_size; /* Number of elements in tree_array */
44
45int wall_3d_init(wall_3d_data* data, int nelements, real* x1x2x3, real* y1y2y3,
46 real* z1z2z3, int* flag);
47void wall_3d_free(wall_3d_data* data);
49GPU_DECLARE_TARGET_SIMD_UNIFORM(w)
50int wall_3d_hit_wall(real r1, real phi1, real z1, real r2, real phi2,
51 real z2, wall_3d_data* w, real* w_coll);
52DECLARE_TARGET_END
53GPU_DECLARE_TARGET_SIMD_UNIFORM(w)
54int wall_3d_hit_wall_full(real r1, real phi1, real z1, real r2, real phi2,
55 real z2, wall_3d_data* w, real* w_coll);
56DECLARE_TARGET_END
57GPU_DECLARE_TARGET_SIMD
58double wall_3d_tri_collision(real q1[3], real q2[3], real t1[3], real t2[3],
59 real t3[3]);
60DECLARE_TARGET_END
61
62DECLARE_TARGET
63void wall_3d_init_tree(wall_3d_data* w, real* offload_array);
64DECLARE_TARGET_END
65DECLARE_TARGET
66int wall_3d_tri_in_cube(real t1[3], real t2[3], real t3[3], real bb1[3],
67 real bb2[3]);
68DECLARE_TARGET_END
69DECLARE_TARGET
70int wall_3d_quad_collision(real q1[3], real q2[3], real t1[3], real t2[3],
71 real t3[3], real t4[3]);
72DECLARE_TARGET_END
73
74#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:41
real zmax
Definition wall_3d.h:25
int * flag
Definition wall_3d.h:31
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:146
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:322
void wall_3d_free(wall_3d_data *data)
Free allocated resources.
Definition wall_3d.c:117
void wall_3d_offload(wall_3d_data *data)
Offload data to the accelerator.
Definition wall_3d.c:127
int wall_3d_init(wall_3d_data *data, int nelements, real *x1x2x3, real *y1y2y3, real *z1z2z3, int *flag)
Initialize 3D wall data and check inputs.
Definition wall_3d.c:45
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:527
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:447
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:402
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:602