Go to the documentation of this file.00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #ifndef CONVERGENCE_HPP
00044 #define CONVERGENCE_HPP 1
00045
00046
00047 #include <iostream>
00048 #include <stdint.h>
00049 #include <vector>
00050 #include "scalarfield.hpp"
00051 #include "trajectorydiagnostics.hpp"
00052 #include "particledatabase.hpp"
00053
00054
00057 class Convergence {
00058
00059 int32_t _iter;
00061 std::vector<double> _epot_hist;
00062 double _epot_lim;
00063 double _epot_absf;
00064 double _epot_relf;
00065 ScalarField *_epot_old;
00066 const ScalarField *_epot;
00068 std::vector<double> _scharge_hist;
00069 double _scharge_lim;
00070 double _scharge_absf;
00071 double _scharge_relf;
00072 ScalarField *_scharge_old;
00073 const ScalarField *_scharge;
00075 struct EmitPoint {
00076 double _epsilon;
00077 double _alpha;
00078 double _beta;
00079 double _xave;
00080 double _xpave;
00082 EmitPoint();
00083 EmitPoint( double x );
00084 EmitPoint( const Emittance &emit );
00085
00086 double &operator[]( int i );
00087 };
00088
00089 std::vector<double> _emit_hist[2];
00090 double _emit_lim;
00091 double _emit_absf;
00092 double _emit_relf;
00093 EmitPoint _emit_old[2];
00094 const ParticleDataBase *_emit_pdb;
00095 coordinate_axis_e _emit_axis;
00096 double _emit_val;
00097 const Emittance *_emit[2];
00099 public:
00100
00103 Convergence();
00104
00107 ~Convergence();
00108
00117 bool evaluate_iteration( void );
00118
00121 void print_history( std::ostream &os ) const;
00122
00125 void add_epot( const ScalarField &epot, double absf, double relf, double lim );
00126
00129 void add_scharge( const ScalarField &scharge, double absf, double relf, double lim );
00130
00133 void add_tdiag( const ParticleDataBase &pdb, coordinate_axis_e axis,
00134 double val, double absf, double relf, double lim );
00135
00138 void add_tdiag( const Emittance *emit1, double absf, double relf, double lim ) {
00139 add_tdiag( emit1, NULL, absf, relf, lim );
00140 }
00141
00144 void add_tdiag( const Emittance *emit1, const Emittance *emit2,
00145 double absf, double relf, double lim );
00146
00149 void set_emittance( const Emittance *emit1, const Emittance *emit2 = NULL );
00150
00151 };
00152
00153
00154 #endif
00155