Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.5new_solver
      Class Index
      File List
   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
particlediagplot.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2011,2013-2014 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 "meshcolormap.hpp"
56 
57 
58 
66 };
67 
68 
81 
82  Frame &_frame;
83 
84  const Geometry &_geom;
85  const ParticleDataBase &_pdb;
86 
87  bool _free_plane;
88 
89  coordinate_axis_e _axis;
90  double _level;
91 
92  Vec3D _c;
93  Vec3D _o;
94  Vec3D _p;
95 
100 
101  int _pdb_it_no;
102  bool _update;
103  double _Isum;
104  TrajectoryDiagnosticData *_tdata;
105  Histogram *_histo;
106  Emittance *_emit;
108  XYGraph *_datagraph;
109  XYGraph *_ellipse;
110  bool _ellipse_enable;
111 
112  MeshColormap *_colormap;
113  std::vector<double> _zdata;
114 
115  size_t _histogram_n;
116  size_t _histogram_m;
117  histogram_accumulation_e _histogram_accumulation;
118  bool _histogram_style;
119  interpolation_e _interpolation;
120  double _dot_size;
121 
122  void build_data( void );
123  void merge_bbox( double bbox[4], const double bb[4] );
124 
125 public:
126 
140  ParticleDiagPlot( Frame &frame, const Geometry &geom, const ParticleDataBase &pdb,
141  coordinate_axis_e axis, double level,
144 
154  ParticleDiagPlot( Frame &frame, const Geometry &geom, const ParticleDataBase &pdb,
155  const Vec3D &c, const Vec3D &o, const Vec3D &p,
158 
162 
165  void set_emittance_ellipse( bool enable ) {
166  _ellipse_enable = enable;
167  }
168 
171  bool get_emittance_ellipse( void ) {
172  return( _ellipse_enable );
173  }
174 
177  void set_view( coordinate_axis_e axis, double level ) {
178  _update = true;
179  _axis = axis;
180  _level = level;
181  }
182 
185  void get_view( coordinate_axis_e &axis, double &level ) {
186  axis = _axis;
187  level = _level;
188  }
189 
193  _update = true;
194  _type = type;
195  }
196 
200  return( _type );
201  }
202 
207  _update = true;
208  _type = type;
209  _diagx = diagx;
210  _diagy = diagy;
211  }
212 
217  type = _type;
218  diagx = _diagx;
219  diagy = _diagy;
220  }
221 
224  void set_histogram_n( size_t n ) {
225  _update = true;
226  _histogram_n = n;
227  }
228 
231  size_t get_histogram_n( void ) {
232  return( _histogram_n );
233  }
234 
237  void set_histogram_m( size_t m ) {
238  _update = true;
239  _histogram_m = m;
240  }
241 
244  size_t get_histogram_m( void ) {
245  return( _histogram_m );
246  }
247 
251  _update = true;
252  _histogram_accumulation = accumulation;
253  }
254 
258  return( _histogram_accumulation );
259  }
260 
263  void set_histogram_style( bool style ) {
264  _histogram_style = style;
265  }
266 
269  bool get_histogram_style( void ) {
270  return( _histogram_style );
271  }
272 
276  _interpolation = interpolation;
277  if( _colormap )
278  _colormap->set_interpolation( interpolation );
279  }
280 
284  return( _interpolation );
285  }
286 
289  const MeshColormap *get_colormap( void ) const {
290  return( _colormap );
291  }
292 
295  void set_dot_size( double size ) {
296  _dot_size = size;
297  if( _datagraph )
298  _datagraph->set_point_style( XYGRAPH_POINT_CIRCLE, true, _dot_size );
299  }
300 
303  double get_dot_size( void ) {
304  return( _dot_size );
305  }
306 
311  const Histogram *get_histogram( void ) {
312  return( _histo );
313  }
314 
319  double get_isum( void ) {
320  return( _Isum );
321  }
322 
325  const Emittance &calculate_emittance( void );
326 
334  void export_data( const std::string &filename );
335 
338  void build_plot( void );
339 };
340 
341 
342 #endif
343 
trajectory_diagnostic_e
Type of diagnostic for trajectories.
Definition: types.hpp:196
double get_isum(void)
Return total current in diagnostic.
Definition: particlediagplot.hpp:319
void get_view(coordinate_axis_e &axis, double &level)
Get diagnostic plane definition if it an even coorinate plane.
Definition: particlediagplot.hpp:185
const Emittance & calculate_emittance(void)
Calculate Emittance fit.
Definition: particlediagplot.cpp:303
Draw a circle.
Definition: xygraph.hpp:66
Geometry definition
Dummy diagnostic type. Does nothing.
Definition: particlediagplot.hpp:62
void export_data(const std::string &filename)
Export plotted data as ASCII.
Definition: particlediagplot.cpp:314
Trajectory diagnostics.
Histogram data handling for 1D and 2D
void set_type(particle_diag_plot_type_e type)
Set plot type.
Definition: particlediagplot.hpp:192
const MeshColormap * get_colormap(void) const
Get a pointer to histogram in the plot.
Definition: particlediagplot.hpp:289
void build_plot(void)
Rebuild plot.
Definition: particlediagplot.cpp:395
size_t get_histogram_m(void)
Get number of histogram bins in y-direction to use for colormap plot.
Definition: particlediagplot.hpp:244
void set_histogram_accumulation(histogram_accumulation_e accumulation)
Set histogram accumulation type.
Definition: particlediagplot.hpp:250
Frame for plots
particle_diag_plot_type_e
Particle diagnostic plot type.
Definition: particlediagplot.hpp:61
~ParticleDiagPlot()
Destructor.
Definition: particlediagplot.cpp:80
void set_point_style(point_style_e pointstyle, bool filled=true, double scale=1.0)
Set point style.
Definition: xygraph.cpp:253
void set_colormap_interpolation(interpolation_e interpolation)
Set the type of interpolation used in colormap plot.
Definition: particlediagplot.hpp:275
Particle databases
Base types.
void set_interpolation(interpolation_e interpolation)
Set interpolation mode.
Definition: meshcolormap.cpp:158
void set_histogram_n(size_t n)
Set number of histogram bins in x-direction to use for colormap plot.
Definition: particlediagplot.hpp:224
Mesh based colormap graph for plotting.
Geometry defining class.
Definition: geometry.hpp:179
particle_diag_plot_type_e get_type(void)
Get plot type.
Definition: particlediagplot.hpp:199
Particle diagnostic plot.
Definition: particlediagplot.hpp:80
Class for emittance statistics.
Definition: trajectorydiagnostics.hpp:241
size_t get_histogram_n(void)
Get number of histogram bins in x-direction to use for colormap plot.
Definition: particlediagplot.hpp:231
double get_dot_size(void)
Get dot size for scatter plot.
Definition: particlediagplot.hpp:303
bool get_histogram_style(void)
Get 1d histogram style.
Definition: particlediagplot.hpp:269
Class for trajectory diagnostic data.
Definition: trajectorydiagnostics.hpp:127
const Histogram * get_histogram(void)
Return a pointer to histogram.
Definition: particlediagplot.hpp:311
void set_emittance_ellipse(bool enable)
Enable/disable emittance fit for emittance plots?
Definition: particlediagplot.hpp:165
XY-graph.
1D histogram.
Definition: particlediagplot.hpp:65
Scatter plot.
Definition: particlediagplot.hpp:63
bool get_emittance_ellipse(void)
Is emittance fit enabled for emittance plots?
Definition: particlediagplot.hpp:171
interpolation_e get_colormap_interpolation(void)
Get the type of interpolation used in colormap plot.
Definition: particlediagplot.hpp:283
Class for colormap type plots on a regular rectangular mesh.
Definition: meshcolormap.hpp:90
histogram_accumulation_e get_histogram_accumulation(void)
Get histogram accumulation type.
Definition: particlediagplot.hpp:257
histogram_accumulation_e
Histogram accumulation type.
Definition: histogram.hpp:53
Base histogram class.
Definition: histogram.hpp:61
interpolation_e
Interpolation type enum.
Definition: meshcolormap.hpp:62
coordinate_axis_e
Coordinate axis identifier.
Definition: types.hpp:170
void set_view(coordinate_axis_e axis, double level)
Set diagnostic plane.
Definition: particlediagplot.hpp:177
void set_histogram_style(bool style)
Set 1d histogram style.
Definition: particlediagplot.hpp:263
void set_histogram_m(size_t m)
Set number of histogram bins in y-direction to use for colormap plot.
Definition: particlediagplot.hpp:237
2D histogram.
Definition: particlediagplot.hpp:64
Class for XY-type simple graph plots.
Definition: xygraph.hpp:75
General purpose plotter frame for cairographics surfaces.
Definition: frame.hpp:107
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.cpp:50
void set_dot_size(double size)
Set dot size for scatter plot.
Definition: particlediagplot.hpp:295
Three dimensional vector.
Definition: vec3d.hpp:58
Dummy diagnostic. Does nothing.
Definition: types.hpp:197
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:215
Particle database base class.
Definition: particledatabase.hpp:191
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:205


Reference manual for Ion Beam Simulator 1.0.5new_solver
Generated by Doxygen 1.8.5 on Tue May 19 2015 09:15:42.