90 #define MRKPATH "/marker/prt_XXXXXXXXXX/"
94 f, qid, __FILE__, __LINE__) ) {
return 1;}
98 real* phi = malloc(n *
sizeof(
real));
100 real* v_r = malloc(n *
sizeof(
real));
101 real* v_phi = malloc(n *
sizeof(
real));
102 real* v_z = malloc(n *
sizeof(
real));
103 real* mass = malloc(n *
sizeof(
real));
104 int* charge = malloc(n *
sizeof(
int));
105 int* anum = malloc(n *
sizeof(
int));
106 int* znum = malloc(n *
sizeof(
int));
107 real* weight = malloc(n *
sizeof(
real));
108 real* time = malloc(n *
sizeof(
real));
112 f, qid, __FILE__, __LINE__) ) {
return 1;}
114 f, qid, __FILE__, __LINE__) ) {
return 1;}
116 f, qid, __FILE__, __LINE__) ) {
return 1;}
118 f, qid, __FILE__, __LINE__) ) {
return 1;}
120 f, qid, __FILE__, __LINE__) ) {
return 1;}
122 f, qid, __FILE__, __LINE__) ) {
return 1;}
124 f, qid, __FILE__, __LINE__) ) {
return 1;}
126 f, qid, __FILE__, __LINE__) ) {
return 1;}
128 f, qid, __FILE__, __LINE__) ) {
return 1;}
130 f, qid, __FILE__, __LINE__) ) {
return 1;}
132 f, qid, __FILE__, __LINE__) ) {
return 1;}
134 f, qid, __FILE__, __LINE__) ) {
return 1;}
136 f, qid, __FILE__, __LINE__) ) {
return 1;}
141 for(
integer i = 0; i < n; i++) {
142 real gamma = 1.0/sqrt(
143 1 - (v_r[i]*v_r[i] + v_phi[i]*v_phi[i] + v_z[i]*v_z[i]) /
CONST_C2 );
152 p[i].
p.
anum = anum[i];
153 p[i].
p.
znum = znum[i];
155 p[i].
p.
time = time[i];
192 #define MRKPATH "/marker/gc_XXXXXXXXXX/"
196 f, qid, __FILE__, __LINE__) ) {
return 1;}
200 real* phi = malloc(n *
sizeof(
real));
202 real* energy = malloc(n *
sizeof(
real));
203 real* pitch = malloc(n *
sizeof(
real));
204 real* zeta = malloc(n *
sizeof(
real));
205 real* mass = malloc(n *
sizeof(
real));
206 int* charge = malloc(n *
sizeof(
int));
207 int* anum = malloc(n *
sizeof(
int));
208 int* znum = malloc(n *
sizeof(
int));
209 real* weight = malloc(n *
sizeof(
real));
210 real* time = malloc(n *
sizeof(
real));
214 f, qid, __FILE__, __LINE__) ) {
return 1;}
216 f, qid, __FILE__, __LINE__) ) {
return 1;}
218 f, qid, __FILE__, __LINE__) ) {
return 1;}
220 f, qid, __FILE__, __LINE__) ) {
return 1;}
222 f, qid, __FILE__, __LINE__) ) {
return 1;}
224 f, qid, __FILE__, __LINE__) ) {
return 1;}
226 f, qid, __FILE__, __LINE__) ) {
return 1;}
228 f, qid, __FILE__, __LINE__) ) {
return 1;}
230 f, qid, __FILE__, __LINE__) ) {
return 1;}
232 f, qid, __FILE__, __LINE__) ) {
return 1;}
234 f, qid, __FILE__, __LINE__) ) {
return 1;}
236 f, qid, __FILE__, __LINE__) ) {
return 1;}
238 f, qid, __FILE__, __LINE__) ) {
return 1;}
243 for(
integer i = 0; i < n; i++) {
292 #define MRKPATH "/marker/fl_XXXXXXXXXX/"
296 f, qid, __FILE__, __LINE__) ) {
return 1;}
300 real* phi = malloc(n *
sizeof(
real));
302 real* pitch = malloc(n *
sizeof(
real));
303 real* weight = malloc(n *
sizeof(
real));
304 real* time = malloc(n *
sizeof(
real));
308 f, qid, __FILE__, __LINE__) ) {
return 1;}
310 f, qid, __FILE__, __LINE__) ) {
return 1;}
312 f, qid, __FILE__, __LINE__) ) {
return 1;}
314 f, qid, __FILE__, __LINE__) ) {
return 1;}
316 f, qid, __FILE__, __LINE__) ) {
return 1;}
318 f, qid, __FILE__, __LINE__) ) {
return 1;}
320 f, qid, __FILE__, __LINE__) ) {
return 1;}
325 for(
integer i = 0; i < n; i++) {
368 hid_t grp = H5Gcreate2(f, path, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
371 real* phi = malloc(n *
sizeof(
real));
373 real* v_r = malloc(n *
sizeof(
real));
374 real* v_phi = malloc(n *
sizeof(
real));
375 real* v_z = malloc(n *
sizeof(
real));
376 real* mass = malloc(n *
sizeof(
real));
377 int* charge = malloc(n *
sizeof(
real));
378 int* anum = malloc(n *
sizeof(
int));
379 int* znum = malloc(n *
sizeof(
int));
380 real* weight = malloc(n *
sizeof(
real));
381 real* time = malloc(n *
sizeof(
real));
384 for(
int i = 0; i < n; i++) {
387 + (p[i].p.p_r*p[i].
p.
p_r
394 v_r[i] = p[i].
p.
p_r / (p[i].
p.
mass*gamma);
396 v_z[i] = p[i].
p.
p_z / (p[i].
p.
mass*gamma);
398 charge[i] = round(p[i].p.charge /
CONST_E);
399 anum[i] = p[i].
p.
anum;
400 znum[i] = p[i].
p.
znum;
402 time[i] = p[i].
p.
time;
Header file containing physical and mathematical constants.
#define CONST_U
Atomic mass unit in kilograms [kg]
#define CONST_E
Elementary charge [C]
#define CONST_C2
Speed of light squared [m^2/s^2]
hid_t hdf5_create_group(hid_t loc, const char *path)
Create a group (with parent groups if necessary). Returns a handle to the group. Negative on failure.
herr_t hdf5_find_group(hid_t loc, const char *path)
Checks if given group exists within given hdf5 file. Negative value is returned if the group doesn't ...
herr_t hdf5_write_extendible_dataset_long(hid_t group, const char *datasetname, int length, long *data)
Create and write to an extendible dataset for long data.
herr_t hdf5_write_extendible_dataset_int(hid_t group, const char *datasetname, int length, int *data)
Create and write to an extendible dataset int data.
int hdf5_read_double(const char *var, real *ptr, hid_t file, char *qid, const char *errfile, int errline)
Read double-valued data from ASCOT5 HDF5 file.
int hdf5_read_long(const char *var, long *ptr, hid_t file, char *qid, const char *errfile, int errline)
Read long-valued data from ASCOT5 HDF5 file.
char * hdf5_gen_path(const char *original, char *qid, char *path)
Generate a valid path from a given template and qid.
herr_t hdf5_write_extendible_dataset_double(hid_t group, const char *datasetname, int length, double *data)
Create and write to an extendible dataset for double data.
int hdf5_read_int(const char *var, int *ptr, hid_t file, char *qid, const char *errfile, int errline)
Read int-valued data from ASCOT5 HDF5 file.
char * hdf5_generate_qid_path(const char *original, char *qid, char *path)
Generate a valid path from a given template and qid.
Header file for hdf5_helpers.h.
int hdf5_marker_read_field_line(hid_t f, int *nmrk, input_particle **p, char *qid)
Read field line input.
int hdf5_marker_read_guiding_center(hid_t f, int *nmrk, input_particle **p, char *qid)
Read guiding center input.
int hdf5_marker_read(hid_t f, int *n, input_particle **p, char *qid)
Read marker input.
int hdf5_marker_write_particle(hid_t f, int n, input_particle *p, char *qid)
Write particle input.
int hdf5_marker_read_particle(hid_t f, int *nmrk, input_particle **p, char *qid)
Read particle input.
Header file for hdf5_marker.c.
Header file for particle.c.
Macros for printing console output.
#define print_out(v,...)
Print to standard output.
Wrapper for marker structs.