OpenMP host code for CPU-based MMC simulations. More...
Go to the source code of this file.
Functions | |
int | mmc_init_from_cmd (mcconfig *cfg, tetmesh *mesh, raytracer *tracer, int argc, char **argv) |
Initialize simulation configuration structure cfg using command line options. More... | |
int | mmc_init_from_json (mcconfig *cfg, tetmesh *mesh, raytracer *tracer, char *jcfg, char *jmesh) |
Initialize simulation configuration structure cfg using a JSON input file. More... | |
int | mmc_reset (mcconfig *cfg, tetmesh *mesh, raytracer *tracer) |
Rest simulation related data structures. More... | |
int | mmc_cleanup (mcconfig *cfg, tetmesh *mesh, raytracer *tracer) |
Clear simulation related data structures. More... | |
int | mmc_prep (mcconfig *cfg, tetmesh *mesh, raytracer *tracer) |
Peprocessing simulation settings and data for simulation. More... | |
int | mmc_run_mp (mcconfig *cfg, tetmesh *mesh, raytracer *tracer) |
Main function to launch CPU based MMC photon simulation. More... | |
OpenMP host code for CPU-based MMC simulations.
Clear simulation related data structures.
[out] | cfg | the simulation configuration structure |
[out] | mesh | the mesh data structure |
[out] | tracer | the ray-tracer data structure |
int mmc_init_from_cmd | ( | mcconfig * | cfg, |
tetmesh * | mesh, | ||
raytracer * | tracer, | ||
int | argc, | ||
char ** | argv | ||
) |
Initialize simulation configuration structure cfg using command line options.
In this unit, we first launch a master thread and initialize the necessary data structures. This include the command line options (cfg), tetrahedral mesh (mesh) and the ray-tracer precomputed data (tracer).
[out] | cfg | the simulation configuration structure |
[in] | mesh | the mesh data structure |
[in] | tracer | the ray-tracer data structure |
[in] | argc | total number of command line option strings |
[in] | argv | command line option string array |
int mmc_init_from_json | ( | mcconfig * | cfg, |
tetmesh * | mesh, | ||
raytracer * | tracer, | ||
char * | jcfg, | ||
char * | jmesh | ||
) |
Initialize simulation configuration structure cfg using a JSON input file.
[out] | cfg | the simulation configuration structure |
[in] | mesh | the mesh data structure |
[in] | tracer | the ray-tracer data structure |
[in] | jcfg | JSON data structure parsed from the input file |
[in] | jmesh | JSON data structure parsed from the mesh data |
Peprocessing simulation settings and data for simulation.
[out] | cfg | the simulation configuration structure |
[out] | mesh | the mesh data structure |
[out] | tracer | the ray-tracer data structure |
Rest simulation related data structures.
[out] | cfg | the simulation configuration structure |
[out] | mesh | the mesh data structure |
[out] | tracer | the ray-tracer data structure |
Main function to launch CPU based MMC photon simulation.
This is the main loop of the Monte Carlo photon simulation. This function run a complete photon simulation session based on one set of user input.
[out] | cfg | the simulation configuration structure |
[out] | mesh | the mesh data structure |
[out] | tracer | the ray-tracer data structure |
The master thread then spawn multiple work-threads depending on your OpenMP settings. By default, the total thread number (master + work) is your total CPU core number. For example, if you have a dual-core CPU, the total thread number is 2; if you have two quad-core CPUs, the total thread number is 8. If you want to set the total thread number manually, you need to set the OMP_NUM_THREADS environment variable. For example, OMP_NUM_THREADS=3
sets the total thread number to 3.