Graph Framework
Loading...
Searching...
No Matches
xrays.cpp File Reference

Benchmark Case for the Rays code. More...

#include <iostream>
#include <thread>
#include <random>
#include "../graph_framework/solver.hpp"
#include "../graph_framework/timing.hpp"
#include "../graph_framework/output.hpp"
#include "../graph_framework/absorption.hpp"
#include "../graph_framework/commandline_parser.hpp"

Functions

template<jit::float_scalar T>
std::normal_distribution< T > set_distribution (const T mean, const T sigma)
 Set the normal distribution.
template<jit::float_scalar T>
std::normal_distribution< std::complex< T > > set_distribution (const std::complex< T > mean, const std::complex< T > sigma)
 Set the normal distribution.
template<jit::float_scalar T, bool SAFE_MATH>
void set_variable (const commandline::parser &cl, graph::shared_leaf< T, SAFE_MATH > var, const std::string &name, std::mt19937_64 &engine, const size_t num_rays)
 Initialize value.
template<jit::float_scalar T, bool SAFE_MATH>
void set_xy_variables (const commandline::parser &cl, graph::shared_leaf< T, SAFE_MATH > x, graph::shared_leaf< T, SAFE_MATH > y, std::mt19937_64 &engine, const size_t num_rays)
 Initialize the x and y direction.
template<solver::method SOLVER_METHOD>
void run_solver (const commandline::parser &cl, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > omega, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > kx, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > ky, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > kz, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > x, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > y, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > z, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > t, graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > dt, equilibrium::shared< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > &eq, const size_t num_steps, const size_t sub_steps, std::mt19937_64 &engine, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
 Run Solver.
template<dispersion::function DISPERSION_FUNCTION>
void run_dispersion (const commandline::parser &cl, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > omega, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z, graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t, const typename DISPERSION_FUNCTION::base dt, equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > &eq, const size_t num_steps, const size_t sub_steps, std::mt19937_64 &engine, const std::string &filename="", const size_t num_rays=0, const size_t index=0)
 Run Dispersion.
template<jit::float_scalar T, bool SAFE_MATH = false>
equilibrium::shared< T, SAFE_MATH > make_equilibrium (const commandline::parser &cl)
 Make an equilibrium.
std::mt19937_64 make_engine (const commandline::parser &cl, const size_t index)
 Generate the engine.
template<jit::float_scalar T, bool SAFE_MATH = false>
void trace_ray (const commandline::parser &cl, const size_t num_times, const size_t sub_steps, const size_t num_rays)
 Trace the rays.
template<absorption::model ABSORPTION_MODEL>
void run_absorption (const commandline::parser &cl, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > kamp, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > omega, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > kx, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > ky, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > kz, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > x, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > y, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > z, graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > t, equilibrium::shared< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > &eq, const size_t num_steps, const std::string &filename="", const size_t index=0)
 Run absorption model.
template<jit::float_scalar T, bool SAFE_MATH = false>
void calculate_power (const commandline::parser &cl, const size_t num_times, const size_t sub_steps, const size_t num_rays)
 Calculate absorption.
template<jit::float_scalar T, bool SAFE_MATH = false>
void bin_power (const commandline::parser &cl, const size_t num_times, const size_t sub_steps, const size_t num_rays)
 Bin power.
commandline::parser parse_commandline (int argc, const char *argv[])
 Setup and parse commandline options.
int main (int argc, const char *argv[])
 Main program of the driver.

Detailed Description

Benchmark Case for the Rays code.

Driver program for the rays library.

Function Documentation

◆ bin_power()

template<jit::float_scalar T, bool SAFE_MATH = false>
void bin_power ( const commandline::parser & cl,
const size_t num_times,
const size_t sub_steps,
const size_t num_rays )

Bin power.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.
Parameters
[in]clParsed commandline.
[in]num_timesTotal number of time steps.
[in]sub_stepsNumber of sub-steps to push the rays.
[in]num_raysNumber of rays to trace.

◆ calculate_power()

template<jit::float_scalar T, bool SAFE_MATH = false>
void calculate_power ( const commandline::parser & cl,
const size_t num_times,
const size_t sub_steps,
const size_t num_rays )

Calculate absorption.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.
Parameters
[in]clParsed commandline.
[in]num_timesTotal number of time steps.
[in]sub_stepsNumber of sub-steps to push the rays.
[in]num_raysNumber of rays to trace.

◆ main()

int main ( int argc,
const char * argv[] )

Main program of the driver.

Parameters
[in]argcNumber of commandline arguments.
[in]argvArray of commandline arguments.

◆ make_engine()

std::mt19937_64 make_engine ( const commandline::parser & cl,
const size_t index )

Generate the engine.

Parameters
[in]clParsed commandline.
[in]indexThread index.

◆ make_equilibrium()

template<jit::float_scalar T, bool SAFE_MATH = false>
equilibrium::shared< T, SAFE_MATH > make_equilibrium ( const commandline::parser & cl)

Make an equilibrium.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.
Parameters
[in]clParsed commandline.

◆ parse_commandline()

commandline::parser parse_commandline ( int argc,
const char * argv[] )

Setup and parse commandline options.

Parameters
[in]argcNumber of commandline arguments.
[in]argvArray of commandline arguments.

◆ run_absorption()

template<absorption::model ABSORPTION_MODEL>
void run_absorption ( const commandline::parser & cl,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > kamp,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > omega,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > kx,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > ky,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > kz,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > x,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > y,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > z,
graph::shared_leaf< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > t,
equilibrium::shared< typename ABSORPTION_MODEL::base, ABSORPTION_MODEL::safe_math > & eq,
const size_t num_steps,
const std::string & filename = "",
const size_t index = 0 )

Run absorption model.

Template Parameters
ABSORPTION_MODELAbsorption model to use.
Parameters
[in]clParsed commandline.
[in]kampWave number amplitude.
[in]omegaWave frequency.
[in]kxWave number in x direction.
[in]kyWave number in y direction.
[in]kzWave number in z direction.
[in]xInitial position in x direction.
[in]yInitial position in y direction.
[in]zInitial position in z direction.
[in]tInitial position in t direction.
[in]eqEquilibrium object.
[in]num_stepsNumber of time steps.
[in]filenameResult filename, empty names will be blank.
[in]indexConcurrent index.

◆ run_dispersion()

template<dispersion::function DISPERSION_FUNCTION>
void run_dispersion ( const commandline::parser & cl,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > omega,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kx,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > ky,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > kz,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > x,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > y,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > z,
graph::shared_leaf< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > t,
const typename DISPERSION_FUNCTION::base dt,
equilibrium::shared< typename DISPERSION_FUNCTION::base, DISPERSION_FUNCTION::safe_math > & eq,
const size_t num_steps,
const size_t sub_steps,
std::mt19937_64 & engine,
const std::string & filename = "",
const size_t num_rays = 0,
const size_t index = 0 )

Run Dispersion.

Template Parameters
DISPERSION_FUNCTIONThe dispersion method.
Parameters
[in]clParsed commandline.
[in]omegaWave frequency.
[in]kxWave number in x direction.
[in]kyWave number in y direction.
[in]kzWave number in z direction.
[in]xInitial position in x direction.
[in]yInitial position in y direction.
[in]zInitial position in z direction.
[in]tInitial position in t direction.
[in]dtInitial dt.
[in]eqEquilibrium object.
[in]num_stepsEquilibrium object.
[in]sub_stepsEquilibrium object.
[in,out]engineRandom engine.
[in]filenameResult filename, empty names will be blank.
[in]num_raysNumber of rays to write.
[in]indexConcurrent index.

◆ run_solver()

template<solver::method SOLVER_METHOD>
void run_solver ( const commandline::parser & cl,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > omega,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > kx,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > ky,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > kz,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > x,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > y,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > z,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > t,
graph::shared_leaf< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > dt,
equilibrium::shared< typename SOLVER_METHOD::base, SOLVER_METHOD::safe_math > & eq,
const size_t num_steps,
const size_t sub_steps,
std::mt19937_64 & engine,
const std::string & filename = "",
const size_t num_rays = 0,
const size_t index = 0 )

Run Solver.

Template Parameters
SOLVER_METHODThe solver method.
Parameters
[in]clParsed commandline.
[in]omegaWave frequency.
[in]kxWave number in x direction.
[in]kyWave number in y direction.
[in]kzWave number in z direction.
[in]xInitial position in x direction.
[in]yInitial position in y direction.
[in]zInitial position in z direction.
[in]tInitial position in t direction.
[in]dtInitial dt.
[in]eqEquilibrium object.
[in]num_stepsEquilibrium object.
[in]sub_stepsEquilibrium object.
[in,out]engineRandom engine.
[in]filenameResult filename, empty names will be blank.
[in]num_raysNumber of rays to write.
[in]indexConcurrent index.

◆ set_distribution() [1/2]

template<jit::float_scalar T>
std::normal_distribution< std::complex< T > > set_distribution ( const std::complex< T > mean,
const std::complex< T > sigma )

Set the normal distribution.

Template Parameters
TBase type of the calculation.
Parameters
[in]meanMean value.
[in]sigmaSigma value.

◆ set_distribution() [2/2]

template<jit::float_scalar T>
std::normal_distribution< T > set_distribution ( const T mean,
const T sigma )

Set the normal distribution.

Template Parameters
TBase type of the calculation.
Parameters
[in]meanMean value.
[in]sigmaSigma value.

◆ set_variable()

template<jit::float_scalar T, bool SAFE_MATH>
void set_variable ( const commandline::parser & cl,
graph::shared_leaf< T, SAFE_MATH > var,
const std::string & name,
std::mt19937_64 & engine,
const size_t num_rays )

Initialize value.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.
Parameters
[in]clParsed commandline.
[in,out]varVariable to set.
[in]nameVariable name.
[in,out]engineRandom engine.
[in]num_raysNumbers of rays.

◆ set_xy_variables()

template<jit::float_scalar T, bool SAFE_MATH>
void set_xy_variables ( const commandline::parser & cl,
graph::shared_leaf< T, SAFE_MATH > x,
graph::shared_leaf< T, SAFE_MATH > y,
std::mt19937_64 & engine,
const size_t num_rays )

Initialize the x and y direction.

Parameters
[in]clParsed commandline.
[in,out]xX variable to set.
[in,out]yY variable to set.
[in,out]engineRandom engine.
[in]num_raysNumbers of rays.

◆ trace_ray()

template<jit::float_scalar T, bool SAFE_MATH = false>
void trace_ray ( const commandline::parser & cl,
const size_t num_times,
const size_t sub_steps,
const size_t num_rays )

Trace the rays.

Template Parameters
TBase type of the calculation.
SAFE_MATHUse Safe Math operations.
Parameters
[in]clParsed commandline.
[in]num_timesTotal number of time steps.
[in]sub_stepsNumber of sub-steps to push the rays.
[in]num_raysNumber of rays to trace.