IBSimu 1.0.4
|
Particle database base class. More...
#include <particledatabase.hpp>
Public Member Functions | |
virtual | ~ParticleDataBase () |
Virtual destructor. | |
void | set_thread_count (uint32_t threadcount) |
Set the number of threads used for calculation. | |
void | set_accuracy (double epsabs, double epsrel) |
Set the accuracy requirement for calculation. | |
void | enable_nsimp_plasma_threshold (const ScalarField *epot, double phi_plasma) |
void | set_polyint (bool polyint) |
Set the interpolation type to polynomial(true) or linear(false). | |
bool | get_polyint (void) const |
Get current interpolation type. | |
void | set_max_steps (uint32_t maxsteps) |
Set maximum number of steps to iterate. | |
void | set_max_time (double maxt) |
Set maximum lifetime of particle in simulation. | |
void | set_save_trajectories (uint32_t div) |
Set trajectory saving. | |
void | set_mirror (const bool mirror[6]) |
Set particle mirroring on boundaries. | |
void | get_mirror (bool mirror[6]) const |
Get particle mirroring on boundaries. | |
int | get_iteration_number (void) const |
double | get_rhosum (void) |
Return sum of defined beam space charge density. | |
virtual size_t | size (void) const =0 |
Returns particle count. | |
virtual ParticleBase & | particle (uint32_t i)=0 |
Returns a reference to particle i. | |
virtual const ParticleBase & | particle (uint32_t i) const =0 |
Returns a const reference to particle i. | |
virtual size_t | traj_size (uint32_t i) const =0 |
Returns number of trajectory points for particle i. | |
virtual void | trajectory_point (double &t, Vec3D &loc, Vec3D &vel, uint32_t i, uint32_t j) const =0 |
Gets the particle i trajectory point j into vel, loc and t. | |
virtual void | trajectories_at_plane (TrajectoryDiagnosticData &tdata, coordinate_axis_e axis, double val, const std::vector< trajectory_diagnostic_e > &diagnostics) const =0 |
Gets trajectory diagnostic diagnostics at plane axis = val in trajectory diagnostic data object tdata. | |
virtual void | clear (void)=0 |
Clears the particle database of all particles. | |
virtual void | clear_trajectories (void)=0 |
Clears the particle trajectory database. | |
virtual void | reserve (size_t size)=0 |
Reserve memory for size particles. | |
virtual void | debug_print (void) const =0 |
Protected Member Functions | |
ParticleDataBase () | |
Constructor. | |
Protected Attributes | |
uint32_t | _threadcount |
Number of threads used for calculation. | |
double | _epsabs |
Absolute error limit for calculation. | |
double | _epsrel |
Relative error limit for calculation. | |
bool | _polyint |
Use polynomial(true)/linear(false) interpolation. | |
uint32_t | _maxsteps |
Maximum number of steps to calculate. | |
double | _maxt |
Maximum particle time in simulation. | |
uint32_t | _trajdiv |
Divisor for saved trajectories, if 3, every third trajectory is saved. | |
bool | _mirror [6] |
Boundary particle mirroring. | |
double | _rhosum |
Sum of space charge density in defined beams (C/m3). | |
uint32_t | _end_time |
Number of time limited particle iterations. | |
uint32_t | _end_step |
Number of step count limited particle iterations. | |
uint32_t | _end_out |
Number of particle iterations ended with particle out of geometry. | |
uint32_t | _end_coll |
Number of particle iterations ended with particle collided to an electrode. | |
uint32_t | _end_baddef |
Number of bad particle definitions. | |
uint32_t | _sum_steps |
Total number of steps taken. | |
int | _iteration |
Iteration number. | |
bool | _nsimp |
const ScalarField * | _epot |
double | _phi_plasma |
Particle database base class.
Particle database base class holds the definitions of particle iteration parameters. Base class also provides a possibility for general pointer to particle database and virtual functions for accessing particles.
ParticleDataBase::ParticleDataBase | ( | ) | [inline, protected] |
Constructor.
virtual ParticleDataBase::~ParticleDataBase | ( | ) | [inline, virtual] |
Virtual destructor.
virtual void ParticleDataBase::clear | ( | void | ) | [pure virtual] |
Clears the particle database of all particles.
Clears the database of particles. Also clears beam space charge sum.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual void ParticleDataBase::clear_trajectories | ( | void | ) | [pure virtual] |
Clears the particle trajectory database.
The particle definitions are conserved, but existing trajectories are cleared.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual void ParticleDataBase::debug_print | ( | void | ) | const [pure virtual] |
void ParticleDataBase::enable_nsimp_plasma_threshold | ( | const ScalarField * | epot, |
double | phi_plasma | ||
) | [inline] |
int ParticleDataBase::get_iteration_number | ( | void | ) | const [inline] |
void ParticleDataBase::get_mirror | ( | bool | mirror[6] | ) | const [inline] |
Get particle mirroring on boundaries.
Mirroring is read for (xmin,xmax,ymin,ymax,zmin,zmax) borders.
bool ParticleDataBase::get_polyint | ( | void | ) | const [inline] |
Get current interpolation type.
True is returned if polynomial interpolation is enabled and false if disabled.
double ParticleDataBase::get_rhosum | ( | void | ) | [inline] |
Return sum of defined beam space charge density.
Returns the summed beam space charge density for all beams defined with "add_beam" functions. Does not work with individually added particle trajectories. rhosum is cleared with particle database clearing function clear().
Can be used to program plasma electron density with EpotProblem::set_pexp_plasma() for example. Please note that it gives to accumulated charge density which might be incorrect for multi-beam extraction simulation defined with several calls to "add_beam" functions.
virtual ParticleBase& ParticleDataBase::particle | ( | uint32_t | i | ) | [pure virtual] |
Returns a reference to particle i.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual const ParticleBase& ParticleDataBase::particle | ( | uint32_t | i | ) | const [pure virtual] |
Returns a const reference to particle i.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual void ParticleDataBase::reserve | ( | size_t | size | ) | [pure virtual] |
Reserve memory for size particles.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
void ParticleDataBase::set_accuracy | ( | double | epsabs, |
double | epsrel | ||
) | [inline] |
Set the accuracy requirement for calculation.
Accuracy requirements default to epsabs = 1.0e-6 and epsrel = 1.0e-6.
void ParticleDataBase::set_max_steps | ( | uint32_t | maxsteps | ) | [inline] |
Set maximum number of steps to iterate.
One thousand (1000) steps is the default
void ParticleDataBase::set_max_time | ( | double | maxt | ) | [inline] |
Set maximum lifetime of particle in simulation.
One millisecond (1e-3 sec) is the default
void ParticleDataBase::set_mirror | ( | const bool | mirror[6] | ) | [inline] |
Set particle mirroring on boundaries.
Mirroring is set for (xmin,xmax,ymin,ymax,zmin,zmax) borders.
void ParticleDataBase::set_polyint | ( | bool | polyint | ) | [inline] |
Set the interpolation type to polynomial(true) or linear(false).
Polynomial interpolation is the default.
void ParticleDataBase::set_save_trajectories | ( | uint32_t | div | ) | [inline] |
Set trajectory saving.
If div is zero, no trajectories are saved. If div is one, every trajectory is saved. If div N>1, every Nth trajectory is saved.
void ParticleDataBase::set_thread_count | ( | uint32_t | threadcount | ) | [inline] |
Set the number of threads used for calculation.
virtual size_t ParticleDataBase::size | ( | void | ) | const [pure virtual] |
Returns particle count.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual size_t ParticleDataBase::traj_size | ( | uint32_t | i | ) | const [pure virtual] |
Returns number of trajectory points for particle i.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual void ParticleDataBase::trajectories_at_plane | ( | TrajectoryDiagnosticData & | tdata, |
coordinate_axis_e | axis, | ||
double | val, | ||
const std::vector< trajectory_diagnostic_e > & | diagnostics | ||
) | const [pure virtual] |
Gets trajectory diagnostic diagnostics at plane axis = val in trajectory diagnostic data object tdata.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
virtual void ParticleDataBase::trajectory_point | ( | double & | t, |
Vec3D & | loc, | ||
Vec3D & | vel, | ||
uint32_t | i, | ||
uint32_t | j | ||
) | const [pure virtual] |
Gets the particle i trajectory point j into vel, loc and t.
Implemented in ParticleDataBasePP< PP >, ParticleDataBasePP< ParticleP2D >, ParticleDataBasePP< ParticleP3D >, and ParticleDataBasePP< ParticlePCyl >.
uint32_t ParticleDataBase::_end_baddef [protected] |
Number of bad particle definitions.
uint32_t ParticleDataBase::_end_coll [protected] |
Number of particle iterations ended with particle collided to an electrode.
uint32_t ParticleDataBase::_end_out [protected] |
Number of particle iterations ended with particle out of geometry.
uint32_t ParticleDataBase::_end_step [protected] |
Number of step count limited particle iterations.
uint32_t ParticleDataBase::_end_time [protected] |
Number of time limited particle iterations.
const ScalarField* ParticleDataBase::_epot [protected] |
double ParticleDataBase::_epsabs [protected] |
Absolute error limit for calculation.
double ParticleDataBase::_epsrel [protected] |
Relative error limit for calculation.
int ParticleDataBase::_iteration [protected] |
Iteration number.
uint32_t ParticleDataBase::_maxsteps [protected] |
Maximum number of steps to calculate.
double ParticleDataBase::_maxt [protected] |
Maximum particle time in simulation.
bool ParticleDataBase::_mirror[6] [protected] |
Boundary particle mirroring.
bool ParticleDataBase::_nsimp [protected] |
double ParticleDataBase::_phi_plasma [protected] |
bool ParticleDataBase::_polyint [protected] |
Use polynomial(true)/linear(false) interpolation.
double ParticleDataBase::_rhosum [protected] |
Sum of space charge density in defined beams (C/m3).
uint32_t ParticleDataBase::_sum_steps [protected] |
Total number of steps taken.
uint32_t ParticleDataBase::_threadcount [protected] |
Number of threads used for calculation.
uint32_t ParticleDataBase::_trajdiv [protected] |
Divisor for saved trajectories, if 3, every third trajectory is saved.