Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   Version 1.0.5dev
   Version 1.0.5b
   Version 1.0.4dev
   Version 1.0.4
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads
particledatabase.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2015 Taneli Kalvas. All rights reserved.
6  *
7  * You can redistribute this software and/or modify it under the terms
8  * of the GNU General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this library (file "COPYING" included in the package);
19  * if not, write to the Free Software Foundation, Inc., 51 Franklin
20  * Street, Fifth Floor, Boston, MA 02110-1301 USA
21  *
22  * If you have questions about your rights to use or distribute this
23  * software, please contact Berkeley Lab's Technology Transfer
24  * Department at TTD@lbl.gov. Other questions, comments and bug
25  * reports should be sent directly to the author via email at
26  * taneli.kalvas@jyu.fi.
27  *
28  * NOTICE. This software was developed under partial funding from the
29  * U.S. Department of Energy. As such, the U.S. Government has been
30  * granted for itself and others acting on its behalf a paid-up,
31  * nonexclusive, irrevocable, worldwide license in the Software to
32  * reproduce, prepare derivative works, and perform publicly and
33  * display publicly. Beginning five (5) years after the date
34  * permission to assert copyright is obtained from the U.S. Department
35  * of Energy, and subject to any subsequent five (5) year renewals,
36  * the U.S. Government is granted for itself and others acting on its
37  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
38  * the Software to reproduce, prepare derivative works, distribute
39  * copies to the public, perform publicly and display publicly, and to
40  * permit others to do so.
41  */
42 
43 #ifndef PARTICLEDATABASE_HPP
44 #define PARTICLEDATABASE_HPP 1
45 
46 
47 #include "scalarfield.hpp"
48 #include "vectorfield.hpp"
49 #include "particles.hpp"
51 #include "particlestatistics.hpp"
52 #include "constants.hpp"
53 #include "types.hpp"
54 
55 
59 public:
60 
64 
65  virtual void operator()( ParticleBase *particle, ParticlePBase *xcur, ParticlePBase *xend ) = 0;
66 };
67 
68 
72 public:
73 
77 
80  virtual void operator()( ParticleBase *particle, class ParticleDataBase *pdb ) = 0;
81 };
82 
83 
87 public:
88 
92 
104  virtual void operator()( ParticleBase *particle, ParticlePBase *x, uint32_t tri,
105  double s, double t ) = 0;
106 };
107 
108 
119 
120  double _phi;
121  const MeshScalarField &_epot;
123 public:
124 
127  PPlasmaBfieldSuppression( const MeshScalarField &epot, double phi )
128  : _phi(phi), _epot(epot) {}
129 
133 
136  virtual double operator()( const Vec3D &x ) const {
137  if( _epot( x ) > _phi )
138  return( 0.0 );
139  return( 1.0 );
140  }
141 };
142 
143 
154 
155  double _phi;
156  const MeshScalarField &_epot;
158 public:
159 
162  NPlasmaBfieldSuppression( const MeshScalarField &epot, double phi )
163  : _phi(phi), _epot(epot) {}
164 
168 
171  virtual double operator()( const Vec3D &x ) const {
172  if( _epot( x ) < _phi )
173  return( 0.0 );
174  return( 1.0 );
175  }
176 };
177 
178 
179 /* ******************************************************************************************* *
180  * ParticleDataBase classes *
181  * ******************************************************************************************* */
182 
183 
192 
193  class ParticleDataBaseImp *_imp;
194 
195 protected:
196 
197 /* ************************************** *
198  * Constructors *
199  * ************************************** */
200 
204 
207  ParticleDataBase( const ParticleDataBase &pdb );
208 
211  const ParticleDataBase &operator=( const ParticleDataBase &pdb );
212 
218 
219 public:
220 
221 /* ************************************** *
222  * Destructor *
223  * ************************************** */
224 
227  virtual ~ParticleDataBase();
228 
229 /* ****************************************** *
230  * Particle iteration settings and statictics *
231  * ****************************************** */
232 
238  void set_thread_count( uint32_t threadcount ) {}
239 
245  void set_accuracy( double epsabs, double epsrel );
246 
256  void set_bfield_suppression( const CallbackFunctorD_V *functor );
257 
261 
265 
269 
272  void set_relativistic( bool enable );
273 
278  void set_surface_collision( bool surface_collision );
279 
285  void set_polyint( bool polyint );
286 
295  bool get_polyint( void ) const;
296 
302 
306 
312 
316 
321  void set_max_steps( uint32_t maxsteps );
322 
327  void set_max_time( double maxt );
328 
335  void set_save_all_points( bool save_points );
336 
345  void set_save_trajectories( uint32_t div );
346 
353  uint32_t get_save_trajectories( void ) const;
354 
363  void set_mirror( const bool mirror[6] );
364 
371  void get_mirror( bool mirror[6] ) const;
372 
375  int get_iteration_number( void ) const;
376 
390  double get_rhosum( void ) const;
391 
394  void set_rhosum( double rhosum );
395 
398  const ParticleStatistics &get_statistics( void ) const;
399 
400 /* ************************************** *
401  * Information and queries *
402  * ************************************** */
403 
406  geom_mode_e geom_mode() const;
407 
410  size_t size( void ) const;
411 
414  virtual ParticleBase &particle( uint32_t i ) = 0;
415 
418  virtual const ParticleBase &particle( uint32_t i ) const = 0;
419 
422  double traj_length( uint32_t i ) const;
423 
426  size_t traj_size( uint32_t i ) const;
427 
430  virtual const ParticlePBase &trajectory_point( uint32_t i, uint32_t j ) const = 0;
431 
434  void trajectory_point( double &t, Vec3D &loc, Vec3D &vel, uint32_t i, uint32_t j ) const;
435 
440  coordinate_axis_e axis,
441  double val,
442  const std::vector<trajectory_diagnostic_e> &diagnostics ) const;
443 
456  void build_trajectory_density_field( MeshScalarField &tdens ) const;
457 
458 /* ************************************** *
459  * Particle and trajectory clearing *
460  * ************************************** */
461 
467  void clear( void );
468 
474  void clear_trajectories( void );
475 
481  void clear_trajectory( size_t a );
482 
488  void reset_trajectories( void );
489 
495  void reset_trajectory( size_t a );
496 
497 /* ************************************** *
498  * Particle definition *
499  * ************************************** */
500 
503  void reserve( size_t size );
504 
505 /* ************************************** *
506  * Particle iterators *
507  * ************************************** */
508 
522  void iterate_trajectories( MeshScalarField &scharge, const VectorField &efield,
523  const VectorField &bfield );
524 
531  void step_particles( MeshScalarField &scharge, const VectorField &efield,
532  const VectorField &bfield, double dt );
533 
534 /* ************************************** *
535  * Debugging, plotting and saving *
536  * ************************************** */
537 
540  virtual void save( const std::string &filename ) const = 0;
541 
544  virtual void save( std::ostream &os ) const = 0;
545 
548  virtual void debug_print( std::ostream &os ) const = 0;
549 };
550 
551 
564 
565  class ParticleDataBase2DImp *_imp;
566 
567 public:
568 
569 /* ************************************** *
570  * Constructors and destructor *
571  * ************************************** */
572 
575  ParticleDataBase2D( const Geometry &geom );
576 
580 
583  ParticleDataBase2D( std::istream &s, const Geometry &geom );
584 
588 
591  const ParticleDataBase2D &operator=( const ParticleDataBase2D &pdb );
592 
593 /* ************************************** *
594  * Information and queries *
595  * ************************************** */
596 
599  virtual Particle2D &particle( uint32_t i );
600 
603  virtual const Particle2D &particle( uint32_t i ) const;
604 
607  virtual const ParticleP2D &trajectory_point( uint32_t i, uint32_t j ) const;
608 
610 
614  void trajectories_at_plane( std::vector<Particle2D> &tdata,
615  coordinate_axis_e axis,
616  double val ) const;
617 
619 
620 /* ************************************** *
621  * Particle definition *
622  * ************************************** */
623 
635  void add_particle( double IQ, double q, double m, const ParticleP2D &x );
636 
641  void add_particle( const Particle2D &p );
642 
643 /* ************************************** *
644  * Particle beam definition *
645  * ************************************** */
646 
666  void add_2d_beam_with_energy( uint32_t N, double J, double q, double m,
667  double E, double Tp, double Tt,
668  double x1, double y1, double x2, double y2 );
669 
685  void add_2d_beam_with_velocity( uint32_t N, double J, double q, double m,
686  double v, double dvp, double dvt,
687  double x1, double y1, double x2, double y2 );
688 
705  void add_2d_KV_beam_with_emittance( uint32_t N, double I, double q, double m,
706  double a, double b, double e,
707  double Ex, double x0, double y0 );
708 
725  void add_2d_gaussian_beam_with_emittance( uint32_t N, double I, double q, double m,
726  double a, double b, double e,
727  double Ex, double x0, double y0 );
728 
729 /* ************************************** *
730  * Debugging, plotting and saving *
731  * ************************************** */
732 
735  virtual void save( const std::string &filename ) const;
736 
739  virtual void save( std::ostream &s ) const;
740 
743  virtual void debug_print( std::ostream &os ) const;
744 };
745 
746 
747 
748 
761 
762  class ParticleDataBaseCylImp *_imp;
763 
764 public:
765 
766 /* ************************************** *
767  * Constructors and destructor *
768  * ************************************** */
769 
772  ParticleDataBaseCyl( const Geometry &geom );
773 
777 
780  ParticleDataBaseCyl( std::istream &s, const Geometry &geom );
781 
785 
789 
790 /* ************************************** *
791  * Information and queries *
792  * ************************************** */
793 
796  virtual ParticleCyl &particle( uint32_t i );
797 
800  virtual const ParticleCyl &particle( uint32_t i ) const;
801 
804  virtual const ParticlePCyl &trajectory_point( uint32_t i, uint32_t j ) const;
805 
807 
811  void trajectories_at_plane( std::vector<ParticleCyl> &tdata,
812  coordinate_axis_e axis,
813  double val ) const;
814 
816 
839  void export_path_manager_data( const std::string &filename,
840  double ref_E, double ref_q, double ref_m,
841  double val, uint32_t Np ) const;
842 
843 /* ************************************** *
844  * Particle definition *
845  * ************************************** */
846 
858  void add_particle( double IQ, double q, double m, const ParticlePCyl &x );
859 
864  void add_particle( const ParticleCyl &p );
865 
866  /* ************************************** *
867  * Particle beam definition *
868  * ************************************** */
869 
889  void add_2d_beam_with_energy( uint32_t N, double J, double q, double m,
890  double E, double Tp, double Tt,
891  double x1, double y1, double x2, double y2 );
892 
912  void add_2d_beam_with_total_energy( uint32_t N, double J, double q, double m,
913  double Etot, const ScalarField &epot,
914  double Tp, double Tt,
915  double x1, double y1, double x2, double y2 );
916 
932  void add_2d_beam_with_velocity( uint32_t N, double J, double q, double m,
933  double v, double dvp, double dvt,
934  double x1, double y1, double x2, double y2 );
935 
938  void add_2d_full_gaussian_beam( uint32_t N, double I, double q, double m,
939  double Ex, double Tp, double Tt,
940  double x0, double dr );
941 
960  void add_2d_gaussian_beam_with_emittance( uint32_t N, double I, double q, double m,
961  double a, double b, double e,
962  double Ex, double x0 );
963 
964 /* ************************************** *
965  * Debugging, plotting and saving *
966  * ************************************** */
967 
970  virtual void save( const std::string &filename ) const;
971 
974  virtual void save( std::ostream &s ) const;
975 
978  virtual void debug_print( std::ostream &os ) const;
979 };
980 
981 
982 
995 
996  class ParticleDataBase3DImp *_imp;
997 
998 public:
999 
1000 /* ************************************** *
1001  * Constructors and destructor *
1002  * ************************************** */
1003 
1006  ParticleDataBase3D( const Geometry &geom );
1007 
1010  ParticleDataBase3D( const ParticleDataBase3D &pdb );
1011 
1014  ParticleDataBase3D( std::istream &s, const Geometry &geom );
1015 
1019 
1022  const ParticleDataBase3D &operator=( const ParticleDataBase3D &pdb );
1023 
1024 /* ************************************** *
1025  * Information and queries *
1026  * ************************************** */
1027 
1030  virtual Particle3D &particle( uint32_t i );
1031 
1034  virtual const Particle3D &particle( uint32_t i ) const;
1035 
1038  virtual const ParticleP3D &trajectory_point( uint32_t i, uint32_t j ) const;
1039 
1041 
1045  void trajectories_at_plane( std::vector<Particle3D> &tdata,
1046  coordinate_axis_e axis,
1047  double val ) const;
1048 
1050 
1051 /* ************************************** *
1052  * Particle definition *
1053  * ************************************** */
1054 
1066  void add_particle( double IQ, double q, double m, const ParticleP3D &x );
1067 
1072  void add_particle( const Particle3D &p );
1073 
1074 /* ************************************** *
1075  * Particle beam definition *
1076  * ************************************** */
1077 
1078 
1101  void add_cylindrical_beam_with_total_energy( uint32_t N, double J, double q, double m,
1102  double Etot, const ScalarField &epot,
1103  double Tp, double Tt, Vec3D c,
1104  Vec3D dir1, Vec3D dir2, double r );
1105 
1129  void add_cylindrical_beam_with_energy( uint32_t N, double J, double q, double m,
1130  double E, double Tp, double Tt, Vec3D c,
1131  Vec3D dir1, Vec3D dir2, double r );
1132 
1155  void add_cylindrical_beam_with_velocity( uint32_t N, double J, double q, double m,
1156  double v, double dvp, double dvt, Vec3D c,
1157  Vec3D dir1, Vec3D dir2, double r );
1158 
1167  void add_rectangular_beam_with_energy( uint32_t N, double J, double q, double m,
1168  double E, double Tp, double Tt, Vec3D c,
1169  Vec3D dir1, Vec3D dir2, double size1, double size2 );
1170 
1179  void add_rectangular_beam_with_velocity( uint32_t N, double J, double q, double m,
1180  double v, double dvp, double dvt, Vec3D c,
1181  Vec3D dir1, Vec3D dir2, double size1, double size2 );
1182 
1183 
1203  void add_3d_KV_beam_with_emittance( uint32_t N, double I, double q, double m,
1204  double E0,
1205  double a1, double b1, double e1,
1206  double a2, double b2, double e2,
1207  Vec3D c, Vec3D dir1, Vec3D dir2 );
1208 
1227  void add_3d_waterbag_beam_with_emittance( uint32_t N, double I, double q, double m,
1228  double E0,
1229  double a1, double b1, double e1,
1230  double a2, double b2, double e2,
1231  Vec3D c, Vec3D dir1, Vec3D dir2 );
1232 
1251  void add_3d_gaussian_beam_with_emittance( uint32_t N, double I, double q, double m,
1252  double E0,
1253  double a1, double b1, double e1,
1254  double a2, double b2, double e2,
1255  Vec3D c, Vec3D dir1, Vec3D dir2 );
1256 
1257 
1258 /* ************************************** *
1259  * Information and queries *
1260  * ************************************** */
1261 
1262 
1281  const Vec3D &c, const Vec3D &o, const Vec3D &p,
1282  const std::vector<trajectory_diagnostic_e> &diagnostics ) const;
1283 
1284 
1308  void export_path_manager_data( const std::string &filename,
1309  double ref_E, double ref_q, double ref_m,
1310  const Vec3D &c, const Vec3D &o, const Vec3D &p ) const;
1311 
1312 /* ************************************** *
1313  * Debugging, plotting and saving *
1314  * ************************************** */
1315 
1318  virtual void save( const std::string &filename ) const;
1319 
1322  virtual void save( std::ostream &s ) const;
1323 
1326  virtual void debug_print( std::ostream &os ) const;
1327 };
1328 
1329 #endif
1330 
Definition: callback.hpp:61
Geometry defining class.
Definition: geometry.hpp:180
Scalar field class.
Definition: meshscalarfield.hpp:70
Magnetic field plasma suppression for negative ion extraction.
Definition: particledatabase.hpp:153
virtual double operator()(const Vec3D &x) const
Suppression function.
Definition: particledatabase.hpp:171
~NPlasmaBfieldSuppression()
Destructor.
Definition: particledatabase.hpp:167
NPlasmaBfieldSuppression(const MeshScalarField &epot, double phi)
Constructor setting electric potential field and potential limit.
Definition: particledatabase.hpp:162
Magnetic field plasma suppression for positive ion extraction.
Definition: particledatabase.hpp:118
virtual double operator()(const Vec3D &x) const
Suppression function.
Definition: particledatabase.hpp:136
~PPlasmaBfieldSuppression()
Destructor.
Definition: particledatabase.hpp:132
PPlasmaBfieldSuppression(const MeshScalarField &epot, double phi)
Constructor setting electric potential field and potential limit.
Definition: particledatabase.hpp:127
Particle base class
Definition: particles.hpp:653
ParticleDataBase2D implementation.
Definition: particledatabaseimp.hpp:816
Particle database class for two dimensions.
Definition: particledatabase.hpp:563
ParticleDataBase2D(const Geometry &geom)
Constructor.
Definition: particledatabase.cpp:323
void add_2d_KV_beam_with_emittance(uint32_t N, double I, double q, double m, double a, double b, double e, double Ex, double x0, double y0)
Add a 2d beam with defined KV emittance.
Definition: particledatabase.cpp:422
void add_2d_beam_with_velocity(uint32_t N, double J, double q, double m, double v, double dvp, double dvt, double x1, double y1, double x2, double y2)
Add a 2d beam with velocities.
Definition: particledatabase.cpp:406
const ParticleDataBase2D & operator=(const ParticleDataBase2D &pdb)
Assignment.
Definition: particledatabase.cpp:358
virtual const ParticlePBase & trajectory_point(uint32_t i, uint32_t j) const=0
Gets the particle i trajectory point j as particle point.
void add_2d_beam_with_energy(uint32_t N, double J, double q, double m, double E, double Tp, double Tt, double x1, double y1, double x2, double y2)
Add a 2d beam with energies.
Definition: particledatabase.cpp:414
~ParticleDataBase2D()
Destructor.
Definition: particledatabase.cpp:352
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...
Definition: particledatabase.cpp:252
virtual void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: particledatabase.cpp:457
void add_particle(double IQ, double q, double m, const ParticleP2D &x)
Add one particle.
Definition: particledatabase.cpp:394
void add_2d_gaussian_beam_with_emittance(uint32_t N, double I, double q, double m, double a, double b, double e, double Ex, double x0, double y0)
Add a 2d beam with defined gaussian emittance.
Definition: particledatabase.cpp:430
virtual void save(const std::string &filename) const
Saves data to a new file filename.
Definition: particledatabase.cpp:438
virtual Particle2D & particle(uint32_t i)
Returns a reference to particle i.
Definition: particledatabase.cpp:368
ParticleDataBase3D implementation.
Definition: particledatabaseimp.hpp:918
Particle database class for three dimensions.
Definition: particledatabase.hpp:994
void add_rectangular_beam_with_velocity(uint32_t N, double J, double q, double m, double v, double dvp, double dvt, Vec3D c, Vec3D dir1, Vec3D dir2, double size1, double size2)
Add a rectangular beam with velocities.
Definition: particledatabase.cpp:737
ParticleDataBase3D(const Geometry &geom)
Constructor.
Definition: particledatabase.cpp:630
void add_3d_waterbag_beam_with_emittance(uint32_t N, double I, double q, double m, double E0, double a1, double b1, double e1, double a2, double b2, double e2, Vec3D c, Vec3D dir1, Vec3D dir2)
Add a 3d beam with defined waterbag emittance.
Definition: particledatabase.cpp:763
void add_3d_gaussian_beam_with_emittance(uint32_t N, double I, double q, double m, double E0, double a1, double b1, double e1, double a2, double b2, double e2, Vec3D c, Vec3D dir1, Vec3D dir2)
Add a 3d beam with defined gaussian emittance.
Definition: particledatabase.cpp:773
void export_path_manager_data(const std::string &filename, double ref_E, double ref_q, double ref_m, const Vec3D &c, const Vec3D &o, const Vec3D &p) const
Export particle data as Path Manager data.
Definition: particledatabase.cpp:791
virtual const ParticlePBase & trajectory_point(uint32_t i, uint32_t j) const=0
Gets the particle i trajectory point j as particle point.
virtual void save(const std::string &filename) const
Saves data to a new file filename.
Definition: particledatabase.cpp:799
void add_cylindrical_beam_with_velocity(uint32_t N, double J, double q, double m, double v, double dvp, double dvt, Vec3D c, Vec3D dir1, Vec3D dir2, double r)
Add a cylindrical beam with velocities.
Definition: particledatabase.cpp:713
void add_cylindrical_beam_with_energy(uint32_t N, double J, double q, double m, double E, double Tp, double Tt, Vec3D c, Vec3D dir1, Vec3D dir2, double r)
Add a cylindrical beam with energies.
Definition: particledatabase.cpp:729
const ParticleDataBase3D & operator=(const ParticleDataBase3D &pdb)
Assignment.
Definition: particledatabase.cpp:665
void add_particle(double IQ, double q, double m, const ParticleP3D &x)
Add one particle.
Definition: particledatabase.cpp:701
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...
Definition: particledatabase.cpp:252
virtual Particle3D & particle(uint32_t i)
Returns a reference to particle i.
Definition: particledatabase.cpp:675
~ParticleDataBase3D()
Destructor.
Definition: particledatabase.cpp:659
virtual void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: particledatabase.cpp:818
void trajectories_at_free_plane(TrajectoryDiagnosticData &tdata, const Vec3D &c, const Vec3D &o, const Vec3D &p, const std::vector< trajectory_diagnostic_e > &diagnostics) const
Get trajectory diagnostic on a plane.
Definition: particledatabase.cpp:783
void add_cylindrical_beam_with_total_energy(uint32_t N, double J, double q, double m, double Etot, const ScalarField &epot, double Tp, double Tt, Vec3D c, Vec3D dir1, Vec3D dir2, double r)
Add a cylindrical beam with energies.
Definition: particledatabase.cpp:721
void add_3d_KV_beam_with_emittance(uint32_t N, double I, double q, double m, double E0, double a1, double b1, double e1, double a2, double b2, double e2, Vec3D c, Vec3D dir1, Vec3D dir2)
Add a 3d beam with defined KV emittance.
Definition: particledatabase.cpp:753
void add_rectangular_beam_with_energy(uint32_t N, double J, double q, double m, double E, double Tp, double Tt, Vec3D c, Vec3D dir1, Vec3D dir2, double size1, double size2)
Add a rectangular beam with energies.
Definition: particledatabase.cpp:745
ParticleDataBaseCyl implementation.
Definition: particledatabaseimp.hpp:862
Particle database class for cylindrical systems.
Definition: particledatabase.hpp:760
void export_path_manager_data(const std::string &filename, double ref_E, double ref_q, double ref_m, double val, uint32_t Np) const
Export particle data as Path Manager data.
Definition: particledatabase.cpp:539
ParticleDataBaseCyl(const Geometry &geom)
Constructor.
Definition: particledatabase.cpp:468
virtual void save(const std::string &filename) const
Saves data to a new file filename.
Definition: particledatabase.cpp:600
void add_2d_beam_with_total_energy(uint32_t N, double J, double q, double m, double Etot, const ScalarField &epot, double Tp, double Tt, double x1, double y1, double x2, double y2)
Add a 2d beam with total energy.
Definition: particledatabase.cpp:567
virtual const ParticlePBase & trajectory_point(uint32_t i, uint32_t j) const=0
Gets the particle i trajectory point j as particle point.
virtual void debug_print(std::ostream &os) const
Print debugging information to os.
Definition: particledatabase.cpp:619
void add_2d_gaussian_beam_with_emittance(uint32_t N, double I, double q, double m, double a, double b, double e, double Ex, double x0)
Add a 2d beam with defined gaussian emittance.
Definition: particledatabase.cpp:592
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...
Definition: particledatabase.cpp:252
~ParticleDataBaseCyl()
Destructor.
Definition: particledatabase.cpp:497
void add_2d_beam_with_energy(uint32_t N, double J, double q, double m, double E, double Tp, double Tt, double x1, double y1, double x2, double y2)
Add a 2d beam with energies.
Definition: particledatabase.cpp:576
void add_particle(double IQ, double q, double m, const ParticlePCyl &x)
Add one particle.
Definition: particledatabase.cpp:547
virtual ParticleCyl & particle(uint32_t i)
Returns a reference to particle i.
Definition: particledatabase.cpp:513
void add_2d_beam_with_velocity(uint32_t N, double J, double q, double m, double v, double dvp, double dvt, double x1, double y1, double x2, double y2)
Add a 2d beam with velocities.
Definition: particledatabase.cpp:559
void add_2d_full_gaussian_beam(uint32_t N, double I, double q, double m, double Ex, double Tp, double Tt, double x0, double dr)
Add a 2d beam with gaussian profile and velocity distribution.
Definition: particledatabase.cpp:584
const ParticleDataBaseCyl & operator=(const ParticleDataBaseCyl &pdb)
Assignment.
Definition: particledatabase.cpp:503
Definition: particledatabaseimp.hpp:57
Particle database base class.
Definition: particledatabase.hpp:191
geom_mode_e geom_mode() const
Return geometry mode.
Definition: particledatabase.cpp:222
void reset_trajectories(void)
Clears the particle trajectory database and set particles to initial coordinates.
Definition: particledatabase.cpp:279
scharge_deposition_e get_scharge_deposition(void) const
Get space charge deposition type.
Definition: particledatabase.cpp:150
double traj_length(uint32_t i) const
Returns the length of trajectory i.
Definition: particledatabase.cpp:234
void set_trajectory_surface_collision_callback(TrajectorySurfaceCollisionCallback *tsur_cb)
Set trajectory surface collision callback.
Definition: particledatabase.cpp:102
void set_trajectory_interpolation(trajectory_interpolation_e intrp)
Set trajectory interpolation type.
Definition: particledatabase.cpp:132
double get_rhosum(void) const
Return sum of defined beam space charge density.
Definition: particledatabase.cpp:204
virtual const ParticlePBase & trajectory_point(uint32_t i, uint32_t j) const =0
Gets the particle i trajectory point j as particle point.
size_t size(void) const
Returns particle count.
Definition: particledatabase.cpp:228
ParticleDataBase()
Constructor.
Definition: particledatabase.cpp:49
void set_save_trajectories(uint32_t div)
Set trajectory saving.
Definition: particledatabase.cpp:174
virtual void save(std::ostream &os) const =0
Saves data to stream.
void set_max_steps(uint32_t maxsteps)
Set maximum number of steps to iterate.
Definition: particledatabase.cpp:156
virtual void debug_print(std::ostream &os) const =0
Print debugging information to os.
int get_iteration_number(void) const
Get the number of iteration rounds done.
Definition: particledatabase.cpp:198
void set_trajectory_end_callback(TrajectoryEndCallback *tend_cb)
Set trajectory end callback.
Definition: particledatabase.cpp:96
uint32_t get_save_trajectories(void) const
Get trajectory saving.
Definition: particledatabase.cpp:180
void set_implementation_pointer(class ParticleDataBaseImp *imp)
Set particle database implementation pointer.
Definition: particledatabase.cpp:72
void set_scharge_deposition(scharge_deposition_e type)
Set space charge deposition type.
Definition: particledatabase.cpp:144
void set_relativistic(bool enable)
Set relativistic particle iteration.
Definition: particledatabase.cpp:108
void set_max_time(double maxt)
Set maximum lifetime of particle in simulation.
Definition: particledatabase.cpp:162
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...
Definition: particledatabase.cpp:252
void set_rhosum(double rhosum)
Set sum of defined beam space charge density.
Definition: particledatabase.cpp:210
void get_mirror(bool mirror[6]) const
Get particle mirroring on boundaries.
Definition: particledatabase.cpp:192
size_t traj_size(uint32_t i) const
Returns number of trajectory points for particle i.
Definition: particledatabase.cpp:240
void step_particles(MeshScalarField &scharge, const VectorField &efield, const VectorField &bfield, double dt)
Step particles forward by time step dt.
Definition: particledatabase.cpp:310
virtual ParticleBase & particle(uint32_t i)=0
Returns a reference to particle i.
bool get_polyint(void) const
Get current interpolation type.
Definition: particledatabase.cpp:126
void set_save_all_points(bool save_points)
Set trajectory saving.
Definition: particledatabase.cpp:168
void set_thread_count(uint32_t threadcount)
Set the number of threads used for calculation.
Definition: particledatabase.hpp:238
void set_polyint(bool polyint)
Set the interpolation type to polynomial(true) or linear(false).
Definition: particledatabase.cpp:120
void set_mirror(const bool mirror[6])
Set particle mirroring on boundaries.
Definition: particledatabase.cpp:186
virtual ~ParticleDataBase()
Virtual destructor.
Definition: particledatabase.cpp:61
virtual const ParticleBase & particle(uint32_t i) const =0
Returns a const reference to particle i.
void build_trajectory_density_field(MeshScalarField &tdens) const
Build trajectory density field.
Definition: particledatabase.cpp:297
void set_accuracy(double epsabs, double epsrel)
Set the accuracy requirement for calculation.
Definition: particledatabase.cpp:78
void reserve(size_t size)
Reserve memory for size particles.
Definition: particledatabase.cpp:291
void reset_trajectory(size_t a)
Clears the particle trajectory and set the particle to initial coordinates.
Definition: particledatabase.cpp:285
void clear_trajectory(size_t a)
Clears particle a in the particle trajectory database.
Definition: particledatabase.cpp:273
void iterate_trajectories(MeshScalarField &scharge, const VectorField &efield, const VectorField &bfield)
Iterate particles through the geometry.
Definition: particledatabase.cpp:303
const ParticleStatistics & get_statistics(void) const
Get particle iterator statistics.
Definition: particledatabase.cpp:216
trajectory_interpolation_e get_trajectory_interpolation(void) const
Get trajectory interpolation type.
Definition: particledatabase.cpp:138
const ParticleDataBase & operator=(const ParticleDataBase &pdb)
Assignment.
Definition: particledatabase.cpp:66
void set_trajectory_handler_callback(TrajectoryHandlerCallback *thand_cb)
Set trajectory handler callback.
Definition: particledatabase.cpp:90
void clear(void)
Clears the particle database of all particles.
Definition: particledatabase.cpp:261
virtual void save(const std::string &filename) const =0
Saves data to a new file filename.
void set_bfield_suppression(const CallbackFunctorD_V *functor)
Set magnetic field suppression location depedent callback functor.
Definition: particledatabase.cpp:84
void set_surface_collision(bool surface_collision)
Set surface collision model to be used.
Definition: particledatabase.cpp:114
void clear_trajectories(void)
Clears the particle trajectory database.
Definition: particledatabase.cpp:267
Particle point class for 2D.
Definition: particles.hpp:103
Particle point class for 3D.
Definition: particles.hpp:459
Particle point base class
Definition: particles.hpp:92
Particle point class for cylindrical coordinates.
Definition: particles.hpp:275
Particle iteration statistics.
Definition: particlestatistics.hpp:57
Particle class in some geometry.
Definition: particles.hpp:740
Scalar field.
Definition: scalarfield.hpp:55
Class for trajectory diagnostic data.
Definition: trajectorydiagnostics.hpp:129
Trajectory end callback.
Definition: particledatabase.hpp:71
virtual ~TrajectoryEndCallback()
Virtual destructor.
Definition: particledatabase.hpp:76
virtual void operator()(ParticleBase *particle, class ParticleDataBase *pdb)=0
Operator called when particle calculation ends.
Trajectory handler callback.
Definition: particledatabase.hpp:58
virtual ~TrajectoryHandlerCallback()
Virtual destructor.
Definition: particledatabase.hpp:63
Trajectory surface collision callback.
Definition: particledatabase.hpp:86
virtual void operator()(ParticleBase *particle, ParticlePBase *x, uint32_t tri, double s, double t)=0
Operator called when particle collides with surface.
virtual ~TrajectorySurfaceCollisionCallback()
Virtual destructor.
Definition: particledatabase.hpp:91
Three dimensional vector.
Definition: vec3d.hpp:58
Vector field.
Definition: vectorfield.hpp:56
Physical constants.
Particle and particle point objects
Particle statistics
Scalar fields.
Trajectory diagnostics.
Base types.
trajectory_interpolation_e
Trajectory interpolation type.
Definition: types.hpp:153
coordinate_axis_e
Coordinate axis identifier.
Definition: types.hpp:170
geom_mode_e
Geometry mode enum.
Definition: types.hpp:59
scharge_deposition_e
Space charge depostition type.
Definition: types.hpp:161
Vector field base.


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.