particlediagplot.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2011 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 PARTICLEDIAGPLOT_HPP
44 #define PARTICLEDIAGPLOT_HPP 1
45 
46 
47 #include "frame.hpp"
48 #include "geometry.hpp"
49 #include "particledatabase.hpp"
50 #include "types.hpp"
51 #include "histogram.hpp"
53 
54 #include "xygraph.hpp"
55 #include "colormap.hpp"
56 
57 
58 
64 };
65 
66 
79 
80  Frame *_frame;
81 
82  const Geometry *_geom;
83  const ParticleDataBase *_pdb;
84 
85  bool _free_plane;
86 
87  coordinate_axis_e _axis;
88  double _level;
89 
90  Vec3D _c;
91  Vec3D _o;
92  Vec3D _p;
93 
98 
99  int _pdb_it_no;
100  bool _update;
101  TrajectoryDiagnosticData *_tdata;
102  Histogram *_histo;
103  Emittance *_emit;
105  XYGraph *_scatter;
106 
107  XYGraph *_ellipse;
108  bool _ellipse_enable;
109 
110  Colormap *_colormap;
111  std::vector<double> _zdata;
112 
113  XYGraph *_profile;
114 
115  size_t _histogram_n;
116  size_t _histogram_m;
117  interpolation_e _interpolation;
118  double _dot_size;
119 
120  void build_data( void );
121  void merge_bbox( double bbox[4], const double bb[4] );
122 
123 public:
124 
133  ParticleDiagPlot( Frame *frame, const Geometry *geom, const ParticleDataBase *pdb,
134  coordinate_axis_e axis, double level,
137 
147  ParticleDiagPlot( Frame *frame, const Geometry *geom, const ParticleDataBase *pdb,
148  const Vec3D &c, const Vec3D &o, const Vec3D &p,
151 
155 
158  void set_emittance_ellipse( bool enable ) {
159  _ellipse_enable = enable;
160  }
161 
164  bool get_emittance_ellipse( void ) {
165  return( _ellipse_enable );
166  }
167 
170  void set_view( coordinate_axis_e axis, double level ) {
171  _update = true;
172  _axis = axis;
173  _level = level;
174  }
175 
178  void get_view( coordinate_axis_e &axis, double &level ) {
179  axis = _axis;
180  level = _level;
181  }
182 
186  _update = true;
187  _type = type;
188  }
189 
193  return( _type );
194  }
195 
200  _update = true;
201  _type = type;
202  _diagx = diagx;
203  _diagy = diagy;
204  }
205 
210  type = _type;
211  diagx = _diagx;
212  diagy = _diagy;
213  }
214 
217  void set_histogram_n( size_t n ) {
218  _update = true;
219  _histogram_n = n;
220  }
221 
224  size_t get_histogram_n( void ) {
225  return( _histogram_n );
226  }
227 
230  void set_histogram_m( size_t m ) {
231  _update = true;
232  _histogram_m = m;
233  }
234 
237  size_t get_histogram_m( void ) {
238  return( _histogram_m );
239  }
240 
244  _interpolation = interpolation;
245  if( _colormap )
246  _colormap->set_interpolation( interpolation );
247  }
248 
252  return( _interpolation );
253  }
254 
257  const Colormap *get_colormap( void ) const {
258  return( _colormap );
259  }
260 
263  void set_dot_size( double size ) {
264  _dot_size = size;
265  if( _scatter )
266  _scatter->set_point_style( XYGRAPH_POINT_CIRCLE, true, _dot_size );
267  }
268 
271  double get_dot_size( void ) {
272  return( _dot_size );
273  }
274 
279  const Histogram *get_histogram( void ) {
280  return( _histo );
281  }
282 
285  const Emittance &calculate_emittance( void );
286 
294  void export_data( const std::string &filename );
295 
298  void build_plot( void );
299 };
300 
301 
302 #endif
303 
trajectory_diagnostic_e
Type of diagnostic for trajectories.
Definition: types.hpp:165
void get_view(coordinate_axis_e &axis, double &level)
Get diagnostic plane definition if it an even coorinate plane.
Definition: particlediagplot.hpp:178
Definition: xygraph.hpp:62
Geometry definition
Definition: particlediagplot.hpp:60
void export_data(const std::string &filename)
Export plotted data as ASCII.
const Colormap * get_colormap(void) const
Get a pointer to histogram in the plot.
Definition: particlediagplot.hpp:257
Trajectory diagnostics.
Histogram data handling for 1D and 2D
void set_type(particle_diag_plot_type_e type)
Set plot type.
Definition: particlediagplot.hpp:185
void build_plot(void)
Rebuild plot.
size_t get_histogram_m(void)
Get number of histogram bins in y-direction to use for colormap plot.
Definition: particlediagplot.hpp:237
Frame for plots
particle_diag_plot_type_e
Definition: particlediagplot.hpp:59
~ParticleDiagPlot()
Destructor.
void set_point_style(point_style_e pointstyle, bool filled=true, double scale=1.0)
Set point style.
void set_colormap_interpolation(interpolation_e interpolation)
Set the type of interpolation used in colormap plot.
Definition: particlediagplot.hpp:243
Particle databases
Base types.
void set_histogram_n(size_t n)
Set number of histogram bins in x-direction to use for colormap plot.
Definition: particlediagplot.hpp:217
Geometry defining class.
Definition: geometry.hpp:131
particle_diag_plot_type_e get_type(void)
Get plot type.
Definition: particlediagplot.hpp:192
Particle diagnostic plot.
Definition: particlediagplot.hpp:78
Class for emittance statistics.
Definition: trajectorydiagnostics.hpp:236
interpolation_e
Definition: colormap.hpp:56
size_t get_histogram_n(void)
Get number of histogram bins in x-direction to use for colormap plot.
Definition: particlediagplot.hpp:224
double get_dot_size(void)
Get dot size for scatter plot.
Definition: particlediagplot.hpp:271
Class for trajectory diagnostic data.
Definition: trajectorydiagnostics.hpp:126
Class for colormap type plots.
Definition: colormap.hpp:74
const Histogram * get_histogram(void)
Return a pointer to histogram.
Definition: particlediagplot.hpp:279
void set_emittance_ellipse(bool enable)
Enable/disable emittance fit for emittance plots?
Definition: particlediagplot.hpp:158
XY-graph.
ParticleDiagPlot(Frame *frame, const Geometry *geom, const ParticleDataBase *pdb, coordinate_axis_e axis, double level, particle_diag_plot_type_e type, trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy=DIAG_NONE)
Constructor for particle diagnostic plot.
Definition: particlediagplot.hpp:63
Definition: particlediagplot.hpp:61
bool get_emittance_ellipse(void)
Is emittance fit enabled for emittance plots?
Definition: particlediagplot.hpp:164
interpolation_e get_colormap_interpolation(void)
Get the type of interpolation used in colormap plot.
Definition: particlediagplot.hpp:251
const Emittance & calculate_emittance(void)
Calculate Emittance fit.
Base histogram class.
Definition: histogram.hpp:61
coordinate_axis_e
Coordinate axis identifier.
Definition: types.hpp:139
void set_view(coordinate_axis_e axis, double level)
Set diagnostic plane.
Definition: particlediagplot.hpp:170
Colormap graph for plotting
void set_histogram_m(size_t m)
Set number of histogram bins in y-direction to use for colormap plot.
Definition: particlediagplot.hpp:230
Definition: particlediagplot.hpp:62
Class for XY-type simple graph plots.
Definition: xygraph.hpp:71
General purpose plotter frame for cairographics surfaces.
Definition: frame.hpp:107
void set_dot_size(double size)
Set dot size for scatter plot.
Definition: particlediagplot.hpp:263
void set_interpolation(interpolation_e interpolation)
Set interpolation mode.
Three dimensional vector.
Definition: vec3d.hpp:58
Dummy diagnostic. Does nothing.
Definition: types.hpp:166
void get_plot(particle_diag_plot_type_e &type, trajectory_diagnostic_e &diagx, trajectory_diagnostic_e &diagy)
Get plot type and diagnostic axes of plot.
Definition: particlediagplot.hpp:208
Particle database base class.
Definition: particledatabase.hpp:167
void set_plot(particle_diag_plot_type_e type, trajectory_diagnostic_e diagx, trajectory_diagnostic_e diagy)
Set plot type and diagnostic axes of plot.
Definition: particlediagplot.hpp:198