openPMD_raytrace_API
0.1.0
|
I/O API for the ray trace extension of the openPMD format. More...
#include <openPMD_io.hh>
Public Member Functions | |
openPMD_io (const std::string &filename, const std::string mc_code_name="", const std::string mc_code_version="", const std::string instrument_name="", const std::string name_current_component="") | |
constructor More... | |
Writing mode | |
void | init_write (std::string particle_species, unsigned long long int n_rays, unsigned int iter=1) |
initializes the "series" object from the openPMD API in WRITE MODE More... | |
void | init_rays (std::string particle_species, unsigned long long int n_rays, unsigned int iter) |
declare the ray particle species in the file More... | |
void | trace_write (Ray this_ray) |
save ray properties for further writing to file by save_write() | |
void | save_write (void) |
Flushes the output to file before closing it. More... | |
Reading mode | |
unsigned long long int | init_read (std::string pdgId, unsigned int iter=1, unsigned long long int n_rays=0, unsigned int repeat=1) |
initializes the "series" object from the openPMD API in READ MODE More... | |
Ray | trace_read (void) |
Read rays from file and returns the next in the list. More... | |
void | set_gravity_direction (float x, float y, float z) |
void | get_gravity_direction (float *x, float *y, float *z) |
void | get_horizontal_direction (float *x, float *y, float *z) |
void | set_horizontal_direction (float *x, float *y, float *z) |
I/O API for the ray trace extension of the openPMD format.
This API is a higher level API of the official openPMD API.
This is meant to be used to save/read a coherent set of rays to/from file.
Coherent in this case means that a single type of rays (particles) are going to used.
Definition at line 20 of file openPMD_io.hh.
|
explicit |
constructor
At construction, no file is created. The init_write() or init_read() methods should be called to performed the desired operations.
filename | filename |
mc_code_name | [optional] Name of the simulation code name |
mc_code_version | [optional] Simulation software version |
instrument_name | [optional] Name of the instrument |
name_current_component | [optional] current component name along the beamline |
Definition at line 36 of file openPMD_io.cc.
void raytracing::openPMD_io::init_write | ( | std::string | particle_species, |
unsigned long long int | n_rays, | ||
unsigned int | iter = 1 |
||
) |
initializes the "series" object from the openPMD API in WRITE MODE
It is extremely important to set the n_rays as the maximum number of rays to save in the file. If it is not known in advance, the user should guess it. The file size increases according to this value, so it should be kept the lowest possible.
This method calls init_rays() a first time.
particle_species | PDG ID of the particles |
n_rays | number of rays being simulated (max) |
iter | openPMD iteration |
Definition at line 128 of file openPMD_io.cc.
void raytracing::openPMD_io::init_rays | ( | std::string | particle_species, |
unsigned long long int | n_rays, | ||
unsigned int | iter | ||
) |
declare the ray particle species in the file
This function must be called each time the particle species are changed and for each new iteration.
Definition at line 80 of file openPMD_io.cc.
void raytracing::openPMD_io::save_write | ( | void | ) |
Flushes the output to file before closing it.
Definition at line 182 of file openPMD_io.cc.
unsigned long long int raytracing::openPMD_io::init_read | ( | std::string | pdgId, |
unsigned int | iter = 1 , |
||
unsigned long long int | n_rays = 0 , |
||
unsigned int | repeat = 1 |
||
) |
initializes the "series" object from the openPMD API in READ MODE
pdgId | PDG ID of the particle |
iter | openPMD iteration |
n_rays | max number of rays to read, 0=ALL |
repeat | [optional] Number of times a ray should be repeatedly retrieved |
Definition at line 343 of file openPMD_io.cc.
raytracing::Ray raytracing::openPMD_io::trace_read | ( | void | ) |
Read rays from file and returns the next in the list.
Each time this method is called, the ray counter increments
Definition at line 408 of file openPMD_io.cc.