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 PARTICLEDIAGPLOT_HPP
00044 #define PARTICLEDIAGPLOT_HPP 1
00045
00046
00047 #include "frame.hpp"
00048 #include "geometry.hpp"
00049 #include "particledatabase.hpp"
00050 #include "types.hpp"
00051 #include "histogram.hpp"
00052 #include "trajectorydiagnostics.hpp"
00053
00054 #include "xygraph.hpp"
00055 #include "colormap.hpp"
00056
00057
00058
00059 enum particle_diag_plot_type_e {
00060 PARTICLE_DIAG_PLOT_NONE = 0,
00061 PARTICLE_DIAG_PLOT_SCATTER,
00062 PARTICLE_DIAG_PLOT_HISTO2D,
00063 PARTICLE_DIAG_PLOT_HISTO1D
00064 };
00065
00066
00078 class ParticleDiagPlot {
00079
00080 Frame *_frame;
00081
00082 const Geometry *_geom;
00083 const ParticleDataBase *_pdb;
00084
00085 coordinate_axis_e _axis;
00086 double _level;
00087
00088 particle_diag_plot_type_e _type;
00089 trajectory_diagnostic_e _diagx;
00090 trajectory_diagnostic_e _diagy;
00091 trajectory_diagnostic_e _diagz;
00092
00093 int _pdb_it_no;
00094 bool _update;
00095 TrajectoryDiagnosticData *_tdata;
00096 Histogram *_histo;
00097 Emittance *_emit;
00099 XYGraph *_scatter;
00100
00101 XYGraph *_ellipse;
00102 bool _ellipse_enable;
00103
00104 Colormap *_colormap;
00105 std::vector<double> _zdata;
00106
00107 XYGraph *_profile;
00108
00109 size_t _histogram_n;
00110 size_t _histogram_m;
00111 interpolation_e _interpolation;
00112 double _dot_size;
00113
00114 void build_data( void );
00115 void merge_bbox( double bbox[4], const double bb[4] );
00116
00117 public:
00118
00119 ParticleDiagPlot( Frame *frame, const Geometry *geom, const ParticleDataBase *pdb,
00120 coordinate_axis_e axis, double level,
00121 particle_diag_plot_type_e type,
00122 trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy = DIAG_NONE );
00123
00124 ~ParticleDiagPlot();
00125
00126 void set_emittance_ellipse( bool enable ) {
00127 _ellipse_enable = enable;
00128 }
00129
00130 bool get_emittance_ellipse( void ) {
00131 return( _ellipse_enable );
00132 }
00133
00134 void set_view( coordinate_axis_e axis, double level ) {
00135 _update = true;
00136 _axis = axis;
00137 _level = level;
00138 }
00139
00140 void get_view( coordinate_axis_e &axis, double &level ) {
00141 axis = _axis;
00142 level = _level;
00143 }
00144
00145 void set_type( particle_diag_plot_type_e type ) {
00146 _update = true;
00147 _type = type;
00148 }
00149
00150 particle_diag_plot_type_e get_type( void ) {
00151 return( _type );
00152 }
00153
00154 void set_plot( particle_diag_plot_type_e type,
00155 trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy ) {
00156 _update = true;
00157 _type = type;
00158 _diagx = diagx;
00159 _diagy = diagy;
00160 }
00161
00162 void get_plot( particle_diag_plot_type_e &type,
00163 trajectory_diagnostic_e &diagx, trajectory_diagnostic_e &diagy ) {
00164 type = _type;
00165 diagx = _diagx;
00166 diagy = _diagy;
00167 }
00168
00169 void set_histogram_n( size_t n ) {
00170 _update = true;
00171 _histogram_n = n;
00172 }
00173
00174 size_t get_histogram_n( void ) {
00175 return( _histogram_n );
00176 }
00177
00178 void set_histogram_m( size_t m ) {
00179 _update = true;
00180 _histogram_m = m;
00181 }
00182
00183 size_t get_histogram_m( void ) {
00184 return( _histogram_m );
00185 }
00186
00187 void set_colormap_interpolation( interpolation_e interpolation ) {
00188 _interpolation = interpolation;
00189 if( _colormap )
00190 _colormap->set_interpolation( interpolation );
00191 }
00192
00193 interpolation_e get_colormap_interpolation( void ) {
00194 return( _interpolation );
00195 }
00196
00197 const Colormap *get_colormap( void ) const {
00198 return( _colormap );
00199 }
00200
00201 void set_dot_size( double size ) {
00202 _dot_size = size;
00203 if( _scatter )
00204 _scatter->set_point_style( XYGRAPH_POINT_CIRCLE, true, _dot_size );
00205 }
00206
00207 double get_dot_size( void ) {
00208 return( _dot_size );
00209 }
00210
00215 const Histogram *get_histogram( void ) {
00216 return( _histo );
00217 }
00218
00221 const Emittance &calculate_emittance( void );
00222
00225 void export_data( const std::string &filename );
00226
00229 void build_plot( void );
00230 };
00231
00232
00233 #endif
00234
00235
00236
00237
00238