#include <dynamics.hpp>
Collaboration diagram for ElectroDynamics:
Public Member Functions | |
ElectroDynamics (Statics &statics, bool disableThreads=false) | |
~ElectroDynamics () | |
void | getFields (const vect3d &posv, vect3d &bfield, vect3d &efield, size_t except_electron=(size_t)-1) |
Get bfield and efield at given position. | |
void | getBField (const vect3d &posv, vect3d &bfield) |
Get bfield at given position. | |
void | getEField (const vect3d &posv, vect3d &efield) |
Get efield at given position. | |
bool | inContact (const vect3d &pos, size_t except=(size_t)-1) |
Returns true/false whether given position is in contact with any static or dynamic elements. | |
void | step () |
Step simulation one timeunit ahead. | |
prec_t | get_elapsed_time () |
Elapsed time in seconds of the simulation. | |
size_t | inject_particle (prec_t mass, prec_t charge, const vect3d &pos, const vect3d &heading, prec_t electronVolts) |
Inject a particle into the simulation. | |
size_t | inject_electron (const vect3d &posv, const vect3d &heading, prec_t electronVolts) |
Inject an electron into the simulation. | |
void | print () |
Debug all particles, their positions, speed, etc. | |
const vect3d & | get_pos (size_t i) const |
Get position of the given particle. | |
const vect3d & | get_v (size_t i) const |
Get speed (m/s) of the given particle. | |
void | setDTM (prec_t accuracy, prec_t stepf=1.0) |
Set simulation accuracy and timestep. | |
void | setPrintStream (FILE *fp) |
size_t | size () |
Count of particles in the system. | |
Statics & | get_statics () |
size_t | get_ticks () |
How many steps have passed since beginning. | |
size_t | ticks_for_distance (prec_t speed, prec_t distance) |
How many ticks of simulation would take for given speed (meters per second) to cover the distance. | |
void | setDisableFields (bool df) |
Disable electron-electron fields calculations. | |
Static Public Member Functions | |
static prec_t | eV2ms (prec_t ev, prec_t mass) |
Convert electronVolts into speed (meters per second) for given electronVolts and mass. | |
static prec_t | ms2eV (prec_t ms, prec_t mass) |
Convert speed (meters per second) into electronVolts for given speed and mass. | |
Classes | |
struct | particle |
struct | pp |
Definition at line 31 of file dynamics.hpp.
ElectroDynamics::ElectroDynamics | ( | Statics & | statics, | |
bool | disableThreads = false | |||
) |
ElectroDynamics::~ElectroDynamics | ( | ) |
void ElectroDynamics::getFields | ( | const vect3d & | posv, | |
vect3d & | bfield, | |||
vect3d & | efield, | |||
size_t | except_electron = (size_t)-1 | |||
) |
Get bfield and efield at given position.
except_electron | Particle ID to ignore in the calculations |
Referenced by getBField(), and getEField().
bool ElectroDynamics::inContact | ( | const vect3d & | pos, | |
size_t | except = (size_t)-1 | |||
) |
Returns true/false whether given position is in contact with any static or dynamic elements.
except | Don't count given particle ID. |
void ElectroDynamics::step | ( | ) |
Step simulation one timeunit ahead.
In a simulation one would continuously call this.
prec_t ElectroDynamics::get_elapsed_time | ( | ) |
Elapsed time in seconds of the simulation.
size_t ElectroDynamics::inject_particle | ( | prec_t | mass, | |
prec_t | charge, | |||
const vect3d & | pos, | |||
const vect3d & | heading, | |||
prec_t | electronVolts | |||
) |
Inject a particle into the simulation.
mass | Mass of particle (kg) | |
charge | Charge of particle (coulomb) | |
posv | Position of injection | |
heading | Particle heading | |
electronVolts | Particle speed/energy |
size_t ElectroDynamics::inject_electron | ( | const vect3d & | posv, | |
const vect3d & | heading, | |||
prec_t | electronVolts | |||
) |
Inject an electron into the simulation.
posv | Position of injection | |
heading | Particle heading | |
electronVolts | Particle speed/energy |
void ElectroDynamics::print | ( | ) |
Debug all particles, their positions, speed, etc.
const vect3d& ElectroDynamics::get_pos | ( | size_t | i | ) | const [inline] |
const vect3d& ElectroDynamics::get_v | ( | size_t | i | ) | const [inline] |
Set simulation accuracy and timestep.
accuracy | Substep adaptation level, bigger means adapt more means slower simulation | |
stepf | Step size modifier, bigger means simulation of smaller timesteps - need to call more step()-s to simulate the same time |
void ElectroDynamics::setPrintStream | ( | FILE * | fp | ) | [inline] |
Convert electronVolts into speed (meters per second) for given electronVolts and mass.
Convert speed (meters per second) into electronVolts for given speed and mass.
size_t ElectroDynamics::size | ( | ) | [inline] |
Statics& ElectroDynamics::get_statics | ( | ) | [inline] |
Definition at line 111 of file dynamics.hpp.
size_t ElectroDynamics::get_ticks | ( | ) | [inline] |
How many ticks of simulation would take for given speed (meters per second) to cover the distance.
void ElectroDynamics::setDisableFields | ( | bool | df | ) | [inline] |