ASCOT5
Loading...
Searching...
No Matches
wall.c
Go to the documentation of this file.
1
16#include <stdio.h>
17#include <math.h>
18#include "ascot5.h"
19#include "print.h"
20#include "wall.h"
21#include "wall/wall_2d.h"
22#include "wall/wall_3d.h"
23
29void wall_free(wall_data* data) {
30 switch(data->type) {
31 case wall_type_2D:
32 wall_2d_free(&data->w2d);
33 break;
34
35 case wall_type_3D:
36 wall_3d_free(&data->w3d);
37 break;
38 }
39}
40
47 switch(data->type) {
48 case wall_type_2D:
49 wall_2d_offload(&data->w2d);
50 break;
51
52 case wall_type_3D:
53 wall_3d_offload(&data->w3d);
54 break;
55 }
56}
57
80int wall_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2,
81 wall_data* w, real* w_coll) {
82 int ret = 0;
83 switch(w->type) {
84 case wall_type_2D:
85 ret = wall_2d_hit_wall(r1, phi1, z1, r2, phi2, z2, &(w->w2d),
86 w_coll);
87 break;
88
89 case wall_type_3D:
90 ret = wall_3d_hit_wall(r1, phi1, z1, r2, phi2, z2, &(w->w3d),
91 w_coll);
92 break;
93 }
94 return ret;
95}
96
105 int ret = 0;
106 switch(w->type) {
107 case wall_type_2D:
108 ret = w->w2d.n;
109 break;
110
111 case wall_type_3D:
112 ret = w->w3d.n;
113 break;
114 }
115 return ret;
116}
Main header file for ASCOT5.
double real
Definition ascot5.h:85
Header file for math.c.
Macros for printing console output.
Wall model simulation data.
Definition wall.h:31
wall_type type
Definition wall.h:32
wall_3d_data w3d
Definition wall.h:34
wall_2d_data w2d
Definition wall.h:33
void wall_offload(wall_data *data)
Offload data to the accelerator.
Definition wall.c:46
int wall_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_data *w, real *w_coll)
Check if a given directed line segment intersects the wall.
Definition wall.c:80
int wall_get_n_elements(wall_data *w)
Return the number of wall elements.
Definition wall.c:104
void wall_free(wall_data *data)
Free allocated resources.
Definition wall.c:29
Header file for wall.c.
@ wall_type_2D
Definition wall.h:21
@ wall_type_3D
Definition wall.h:22
void wall_2d_offload(wall_2d_data *data)
Offload data to the accelerator.
Definition wall_2d.c:60
void wall_2d_free(wall_2d_data *data)
Free allocated resources.
Definition wall_2d.c:50
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.
Definition wall_2d.c:124
Header file for wall_2d.c.
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
int wall_3d_hit_wall(real r1, real phi1, real z1, real r2, real phi2, real z2, wall_3d_data *wdata, 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
Header file for wall_3d.c.