Public Member Functions | Protected Member Functions
ParticleDataBase Class Reference

Particle database base class. More...

#include <particledatabase.hpp>

Inheritance diagram for ParticleDataBase:
ParticleDataBase2D ParticleDataBase3D ParticleDataBaseCyl

List of all members.

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 set_bfield_suppression (const CallbackFunctorD_V *functor)
 Set magnetic field suppression location depedent callback functor.
void set_trajectory_handler_callback (const TrajectoryHandlerCallback *thand_cb)
 Set trajectory handler callback.
void set_trajectory_end_callback (const TrajectoryEndCallback *tend_cb)
 Set trajectory end callback.
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.
uint32_t get_save_trajectories (void) const
 Get 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
 Get the number of iteration rounds done.
double get_rhosum (void) const
 Return sum of defined beam space charge density.
void set_rhosum (double rhosum)
 Set sum of defined beam space charge density.
const ParticleStatisticsget_statistics (void) const
 Get particle iterator statistics.
geom_mode_e geom_mode () const
 Return geometry mode.
size_t size (void) const
 Returns particle count.
virtual ParticleBaseparticle (uint32_t i)=0
 Returns a reference to particle i.
virtual const ParticleBaseparticle (uint32_t i) const =0
 Returns a const reference to particle i.
double traj_length (uint32_t i) const
 Returns the length of trajectory i.
size_t traj_size (uint32_t i) const
 Returns number of trajectory points for particle i.
virtual const ParticlePBasetrajectory_point (uint32_t i, uint32_t j) const =0
 Gets the particle i trajectory point j as particle point.
void trajectory_point (double &t, Vec3D &loc, Vec3D &vel, uint32_t i, uint32_t j) const
 Gets the particle i trajectory point j into vel, loc and t.
void trajectories_at_plane (TrajectoryDiagnosticData &tdata, coordinate_axis_e axis, double val, const std::vector< trajectory_diagnostic_e > &diagnostics) const
 Gets trajectory diagnostic diagnostics at plane axis = val in trajectory diagnostic data object tdata.
void build_trajectory_density_field (ScalarField &tdens) const
 Build trajectory density field.
void clear (void)
 Clears the particle database of all particles.
void clear_trajectories (void)
 Clears the particle trajectory database.
void clear_trajectory (size_t a)
 Clears particle a in the particle trajectory database.
void reserve (size_t size)
 Reserve memory for size particles.
void iterate_trajectories (ScalarField &scharge, const VectorField &efield, const VectorField &bfield, const Geometry &g)
 Iterate particles through the geometry.
void step_particles (ScalarField &scharge, const VectorField &efield, const VectorField &bfield, const Geometry &g, double dt)
 Step particles forward by time step dt.
virtual void save (const std::string &filename) const =0
 Saves data to a new file filename.
virtual void save (std::ostream &s) const =0
 Saves data to stream.
virtual void debug_print (std::ostream &os) const =0
 Print debugging information to os.

Protected Member Functions

 ParticleDataBase ()
 Constructor.
 ParticleDataBase (const ParticleDataBase &pdb)
 Copy constructor.
const ParticleDataBaseoperator= (const ParticleDataBase &pdb)
 Assignment.
void set_implementation_pointer (class ParticleDataBaseImp *imp)
 Set particle database implementation pointer.

Detailed Description

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.


Constructor & Destructor Documentation

Constructor.

Copy constructor.

virtual ParticleDataBase::~ParticleDataBase ( ) [virtual]

Virtual destructor.


Member Function Documentation

Build trajectory density field.

The scalar field tdens can differ from geometry.

void ParticleDataBase::clear ( void  )

Clears the particle database of all particles.

Clears the database of particles. Also clears beam space charge sum.

Clears the particle trajectory database.

The particle definitions are conserved, but existing trajectories are cleared.

Clears particle a in the particle trajectory database.

The particle definition is conserved, but existing trajectory are cleared.

virtual void ParticleDataBase::debug_print ( std::ostream &  os) const [pure virtual]

Print debugging information to os.

Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.

Return geometry mode.

Get the number of iteration rounds done.

void ParticleDataBase::get_mirror ( bool  mirror[6]) const

Get particle mirroring on boundaries.

Mirroring is read for (xmin,xmax,ymin,ymax,zmin,zmax) borders. Mirroring is always false for directions that do not exist.

bool ParticleDataBase::get_polyint ( void  ) const

Get current interpolation type.

True is returned if polynomial interpolation is enabled and false if disabled.

double ParticleDataBase::get_rhosum ( void  ) const

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.

uint32_t ParticleDataBase::get_save_trajectories ( void  ) const

Get 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.

Get particle iterator statistics.

void ParticleDataBase::iterate_trajectories ( ScalarField scharge,
const VectorField efield,
const VectorField bfield,
const Geometry g 
)

Iterate particles through the geometry.

The particles defined in particle database pdb are iterated through electric field efield and magnetic field bfield in geometry g. Space charge density field scharge is set from the particle trajectories.

const ParticleDataBase& ParticleDataBase::operator= ( const ParticleDataBase pdb) [protected]

Assignment.

virtual ParticleBase& ParticleDataBase::particle ( uint32_t  i) [pure virtual]

Returns a reference to particle i.

Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.

virtual const ParticleBase& ParticleDataBase::particle ( uint32_t  i) const [pure virtual]

Returns a const reference to particle i.

Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.

void ParticleDataBase::reserve ( size_t  size)

Reserve memory for size particles.

virtual void ParticleDataBase::save ( const std::string &  filename) const [pure virtual]

Saves data to a new file filename.

Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.

virtual void ParticleDataBase::save ( std::ostream &  s) const [pure virtual]

Saves data to stream.

Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.

void ParticleDataBase::set_accuracy ( double  epsabs,
double  epsrel 
)

Set the accuracy requirement for calculation.

Accuracy requirements default to epsabs = 1.0e-6 and epsrel = 1.0e-6.

Set magnetic field suppression location depedent callback functor.

Can be used to suppress the magnetic field effect on particles inside the plasma by making an object with a pointer to electric potential. Comparing to local potential value the magnetic field suppression can be localized to a volume with selected potential range.

void ParticleDataBase::set_implementation_pointer ( class ParticleDataBaseImp *  imp) [protected]

Set particle database implementation pointer.

Used by child constructors.

void ParticleDataBase::set_max_steps ( uint32_t  maxsteps)

Set maximum number of steps to iterate.

One thousand (1000) steps is the default

void ParticleDataBase::set_max_time ( double  maxt)

Set maximum lifetime of particle in simulation.

One millisecond (1e-3 sec) is the default

void ParticleDataBase::set_mirror ( const bool  mirror[6])

Set particle mirroring on boundaries.

Mirroring is set for (xmin,xmax,ymin,ymax,zmin,zmax) borders. Mirroring is always false for directions that do not exist.

By default, mirroring is disabled for all boundaries.

void ParticleDataBase::set_polyint ( bool  polyint)

Set the interpolation type to polynomial(true) or linear(false).

Polynomial interpolation is the default.

void ParticleDataBase::set_rhosum ( double  rhosum)

Set sum of defined beam space charge density.

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.

By default, all trajectories are saved.

void ParticleDataBase::set_thread_count ( uint32_t  threadcount) [inline]

Set the number of threads used for calculation.

Deprecated:
This function is deprecated (it does nothing) and is replaced by global IBSimu::set_thread_count().

Set trajectory end callback.

Set trajectory handler callback.

size_t ParticleDataBase::size ( void  ) const

Returns particle count.

void ParticleDataBase::step_particles ( ScalarField scharge,
const VectorField efield,
const VectorField bfield,
const Geometry g,
double  dt 
)

Step particles forward by time step dt.

The particles defined in particle database pdb are stepped forward one time step in electric field efield and geometry g.

double ParticleDataBase::traj_length ( uint32_t  i) const

Returns the length of trajectory i.

size_t ParticleDataBase::traj_size ( uint32_t  i) const

Returns number of trajectory points for particle i.

void ParticleDataBase::trajectories_at_plane ( TrajectoryDiagnosticData tdata,
coordinate_axis_e  axis,
double  val,
const std::vector< trajectory_diagnostic_e > &  diagnostics 
) const

Gets trajectory diagnostic diagnostics at plane axis = val in trajectory diagnostic data object tdata.

virtual const ParticlePBase& ParticleDataBase::trajectory_point ( uint32_t  i,
uint32_t  j 
) const [pure virtual]

Gets the particle i trajectory point j as particle point.

Implemented in ParticleDataBase3D, ParticleDataBaseCyl, and ParticleDataBase2D.

void ParticleDataBase::trajectory_point ( double &  t,
Vec3D loc,
Vec3D vel,
uint32_t  i,
uint32_t  j 
) const

Gets the particle i trajectory point j into vel, loc and t.


The documentation for this class was generated from the following file: