ASCOT5
|
Header file for wall.c. More...
#include "ascot5.h"
#include "offload_acc_omp.h"
#include "wall/wall_2d.h"
#include "wall/wall_3d.h"
Go to the source code of this file.
Data Structures | |
struct | wall_offload_data |
Wall model offload data. More... | |
struct | wall_data |
Wall model simulation data. More... | |
Typedefs | |
typedef enum wall_type | wall_type |
Wall model types. | |
Enumerations | |
enum | wall_type { wall_type_2D , wall_type_3D } |
Wall model types. More... | |
Functions | |
int | wall_init_offload (wall_offload_data *offload_data, real **offload_array, int **int_offload_array) |
Load wall data and prepare parameters. | |
void | wall_free_offload (wall_offload_data *offload_data, real **offload_array, int **int_offload_array) |
Free offload array and reset parameters. | |
int | wall_init (wall_data *w, wall_offload_data *offload_data, real *offload_array, int *int_offload_array) |
Initialize wall data struct on target. | |
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. | |
DECLARE_TARGET_END int | wall_get_n_elements (wall_data *w) |
Return the number of wall elements. | |
Header file for wall.c.
Contains a list declaring all wall_types, and declaration of wall_offload_data and wall_data structs.
Definition in file wall.h.
Wall model types.
Wall model types are used in the magnetic wall interface (wall.c) to direct function calls to correct wall model instances. Each wall model instance must have a corresponding type.
enum wall_type |
Wall model types.
Wall model types are used in the magnetic wall interface (wall.c) to direct function calls to correct wall model instances. Each wall model instance must have a corresponding type.
Enumerator | |
---|---|
wall_type_2D | Axisymmetric wall model consisting of single contour |
wall_type_3D | 3D wall model consisting of triangles |
int wall_init_offload | ( | wall_offload_data * | offload_data, |
real ** | offload_array, | ||
int ** | int_offload_array ) |
Load wall data and prepare parameters.
This function fills the relevant wall offload struct with parameters and allocates and fills the offload array. Sets offload array length in the offload struct.
The offload data has to have a type when this function is called as it should be set when the offload data is constructed from inputs.
This function is host only.
offload_data | pointer to offload data struct |
offload_array | pointer to pointer to offload array |
int_offload_array | pointer to pointer to offload array storing integers |
void wall_free_offload | ( | wall_offload_data * | offload_data, |
real ** | offload_array, | ||
int ** | int_offload_array ) |
Free offload array and reset parameters.
This function deallocates the offload_array.
This function is host only.
offload_data | pointer to offload data struct |
offload_array | pointer to pointer to offload array |
int_offload_array | pointer to pointer to offload array storing integers |
int wall_init | ( | wall_data * | w, |
wall_offload_data * | offload_data, | ||
real * | offload_array, | ||
int * | int_offload_array ) |
Initialize wall data struct on target.
This function copies the wall parameters from the offload struct to the struct on target and sets the wall data pointers to correct offsets in the offload array.
w | pointer to data struct on target |
offload_data | pointer to offload data struct |
offload_array | pointer to offload array |
int_offload_array | pointer to pointer to offload array storing integers |
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.
This function is intended to be used to check whether a marker collides with the wall. If there is a collision, this function returns an identification number specific to that wall tile. If the marker hits multiple wall elements, only the first one is returned.
This is a SIMD function.
r1 | start point R coordinate [m] |
phi1 | start point phi coordinate [rad] |
z1 | start point z coordinate [rad] |
r2 | end point R coordinate [m] |
phi2 | end point phi coordinate [rad] |
z2 | end point z coordinate [rad] |
w | pointer to data struct on target |
w_coll | pointer for storing the parameter in P = P1 + w_coll * (P2-P1), where P is the point where the collision occurred. |