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 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 bool _free_plane;
00086
00087 coordinate_axis_e _axis;
00088 double _level;
00089
00090 Vec3D _c;
00091 Vec3D _o;
00092 Vec3D _p;
00093
00094 particle_diag_plot_type_e _type;
00095 trajectory_diagnostic_e _diagx;
00096 trajectory_diagnostic_e _diagy;
00097 trajectory_diagnostic_e _diagz;
00098
00099 int _pdb_it_no;
00100 bool _update;
00101 TrajectoryDiagnosticData *_tdata;
00102 Histogram *_histo;
00103 Emittance *_emit;
00105 XYGraph *_scatter;
00106
00107 XYGraph *_ellipse;
00108 bool _ellipse_enable;
00109
00110 Colormap *_colormap;
00111 std::vector<double> _zdata;
00112
00113 XYGraph *_profile;
00114
00115 size_t _histogram_n;
00116 size_t _histogram_m;
00117 interpolation_e _interpolation;
00118 double _dot_size;
00119
00120 void build_data( void );
00121 void merge_bbox( double bbox[4], const double bb[4] );
00122
00123 public:
00124
00133 ParticleDiagPlot( Frame *frame, const Geometry *geom, const ParticleDataBase *pdb,
00134 coordinate_axis_e axis, double level,
00135 particle_diag_plot_type_e type,
00136 trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy = DIAG_NONE );
00137
00147 ParticleDiagPlot( Frame *frame, const Geometry *geom, const ParticleDataBase *pdb,
00148 const Vec3D &c, const Vec3D &o, const Vec3D &p,
00149 particle_diag_plot_type_e type,
00150 trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy = DIAG_NONE );
00151
00154 ~ParticleDiagPlot();
00155
00158 void set_emittance_ellipse( bool enable ) {
00159 _ellipse_enable = enable;
00160 }
00161
00164 bool get_emittance_ellipse( void ) {
00165 return( _ellipse_enable );
00166 }
00167
00170 void set_view( coordinate_axis_e axis, double level ) {
00171 _update = true;
00172 _axis = axis;
00173 _level = level;
00174 }
00175
00178 void get_view( coordinate_axis_e &axis, double &level ) {
00179 axis = _axis;
00180 level = _level;
00181 }
00182
00185 void set_type( particle_diag_plot_type_e type ) {
00186 _update = true;
00187 _type = type;
00188 }
00189
00192 particle_diag_plot_type_e get_type( void ) {
00193 return( _type );
00194 }
00195
00198 void set_plot( particle_diag_plot_type_e type,
00199 trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy ) {
00200 _update = true;
00201 _type = type;
00202 _diagx = diagx;
00203 _diagy = diagy;
00204 }
00205
00208 void get_plot( particle_diag_plot_type_e &type,
00209 trajectory_diagnostic_e &diagx, trajectory_diagnostic_e &diagy ) {
00210 type = _type;
00211 diagx = _diagx;
00212 diagy = _diagy;
00213 }
00214
00217 void set_histogram_n( size_t n ) {
00218 _update = true;
00219 _histogram_n = n;
00220 }
00221
00224 size_t get_histogram_n( void ) {
00225 return( _histogram_n );
00226 }
00227
00230 void set_histogram_m( size_t m ) {
00231 _update = true;
00232 _histogram_m = m;
00233 }
00234
00237 size_t get_histogram_m( void ) {
00238 return( _histogram_m );
00239 }
00240
00243 void set_colormap_interpolation( interpolation_e interpolation ) {
00244 _interpolation = interpolation;
00245 if( _colormap )
00246 _colormap->set_interpolation( interpolation );
00247 }
00248
00251 interpolation_e get_colormap_interpolation( void ) {
00252 return( _interpolation );
00253 }
00254
00257 const Colormap *get_colormap( void ) const {
00258 return( _colormap );
00259 }
00260
00263 void set_dot_size( double size ) {
00264 _dot_size = size;
00265 if( _scatter )
00266 _scatter->set_point_style( XYGRAPH_POINT_CIRCLE, true, _dot_size );
00267 }
00268
00271 double get_dot_size( void ) {
00272 return( _dot_size );
00273 }
00274
00279 const Histogram *get_histogram( void ) {
00280 return( _histo );
00281 }
00282
00285 const Emittance &calculate_emittance( void );
00286
00294 void export_data( const std::string &filename );
00295
00298 void build_plot( void );
00299 };
00300
00301
00302 #endif
00303