Main Page
Related Pages
Classes
Files
File List
File Members
src
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
"
52
#include "
trajectorydiagnostics.hpp
"
53
54
#include "
xygraph.hpp
"
55
#include "
colormap.hpp
"
56
57
58
59
enum
particle_diag_plot_type_e
{
60
PARTICLE_DIAG_PLOT_NONE
= 0,
61
PARTICLE_DIAG_PLOT_SCATTER
,
62
PARTICLE_DIAG_PLOT_HISTO2D
,
63
PARTICLE_DIAG_PLOT_HISTO1D
64
};
65
66
78
class
ParticleDiagPlot
{
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
94
particle_diag_plot_type_e
_type;
95
trajectory_diagnostic_e
_diagx;
96
trajectory_diagnostic_e
_diagy;
97
trajectory_diagnostic_e
_diagz;
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,
135
particle_diag_plot_type_e
type,
136
trajectory_diagnostic_e
diagx,
trajectory_diagnostic_e
diagy =
DIAG_NONE
);
137
147
ParticleDiagPlot
(
Frame
*frame,
const
Geometry
*geom,
const
ParticleDataBase
*pdb,
148
const
Vec3D
&c,
const
Vec3D
&o,
const
Vec3D
&p,
149
particle_diag_plot_type_e
type,
150
trajectory_diagnostic_e
diagx,
trajectory_diagnostic_e
diagy =
DIAG_NONE
);
151
154
~ParticleDiagPlot
();
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
185
void
set_type
(
particle_diag_plot_type_e
type ) {
186
_update =
true
;
187
_type = type;
188
}
189
192
particle_diag_plot_type_e
get_type
(
void
) {
193
return
( _type );
194
}
195
198
void
set_plot
(
particle_diag_plot_type_e
type,
199
trajectory_diagnostic_e
diagx,
trajectory_diagnostic_e
diagy ) {
200
_update =
true
;
201
_type = type;
202
_diagx = diagx;
203
_diagy = diagy;
204
}
205
208
void
get_plot
(
particle_diag_plot_type_e
&type,
209
trajectory_diagnostic_e
&diagx,
trajectory_diagnostic_e
&diagy ) {
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
243
void
set_colormap_interpolation
(
interpolation_e
interpolation ) {
244
_interpolation = interpolation;
245
if
( _colormap )
246
_colormap->
set_interpolation
( interpolation );
247
}
248
251
interpolation_e
get_colormap_interpolation
(
void
) {
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
Reference manual for Ion Beam Simulator 1.0.5b
Generated on by
Doxygen
1.8.1.2 on Mon Sep 24 2012 12:38:29.