geomplot.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 GEOMPLOT_HPP
44 #define GEOMPLOT_HPP 1
45 
46 
47 #include "types.hpp"
48 #include "frame.hpp"
49 #include "geometry.hpp"
50 #include "scalarfield.hpp"
51 #include "vectorfield.hpp"
52 #include "particledatabase.hpp"
53 
54 #include "solidgraph.hpp"
55 #include "eqpotgraph.hpp"
56 #include "particlegraph.hpp"
57 #include "meshgraph.hpp"
58 #include "fieldgraph.hpp"
59 
60 
61 
62 
69 class GeomPlot {
70 
71  Frame *_frame;
72 
73  const Geometry *_geom;
74  const ScalarField *_epot;
75  const ScalarField *_scharge;
76  const ScalarField *_tdens;
77  const VectorField *_bfield;
78  const VectorField *_efield;
79  const ParticleDataBase *_pdb;
80 
81  SolidGraph *_solidgraph;
82  FieldGraph *_fieldgraph;
83  EqPotGraph *_eqpotgraph;
84  ParticleGraph *_particlegraph;
85  MeshGraph *_meshgraph;
86 
87  view_e _view;
88  int _level;
89  int _vb[3];
90 
91  size_t _eqlines_auto;
92  std::vector<double> _eqlines_manual;
93  size_t _particle_div;
94  bool _scharge_field;
95  bool _qm_discretation;
96  bool _mesh;
97 
98  field_type_e _fieldplot_sel;
99  int _fieldplot_steps;
100  zscale_e _fieldplot_zscale;
101 
102  bool _cache;
103 
104  void reset_graphs( void );
105 
106 public:
107 
115  GeomPlot( Frame *frame, const Geometry *geom );
116 
119  ~GeomPlot();
120 
125  void disable_cache( void );
126 
129  void set_epot( const ScalarField *epot );
130 
133  void set_eqlines_manual( const std::vector<double> &pot );
134 
137  std::vector<double> get_eqlines_manual( void ) const {
138  return( _eqlines_manual );
139  }
140 
148  void set_eqlines_auto( size_t N );
149 
152  size_t get_eqlines_auto( void ) const {
153  return( _eqlines_auto );
154  }
155 
158  void set_bfield( const VectorField *bfield ) {
159  _bfield = bfield;
160  }
161 
164  const VectorField *get_bfield( void ) const {
165  return( _bfield );
166  }
167 
170  void set_efield( const VectorField *efield ) {
171  _efield = efield;
172  }
173 
176  const VectorField *get_efield( void ) const {
177  return( _efield );
178  }
179 
182  void set_trajdens( const ScalarField *tdens );
183 
186  const ScalarField *get_trajdens( void ) const {
187  return( _tdens );
188  }
189 
192  void set_scharge( const ScalarField *scharge );
193 
196  const ScalarField *get_scharge( void ) const {
197  return( _scharge );
198  }
199 
202  void set_fieldgraph_plot( field_type_e fieldplot );
203 
207  return( _fieldplot_sel );
208  }
209 
216  void set_fieldgraph_stepped_palette( int steps );
217 
220  void set_fieldgraph_zscale( zscale_e zscale );
221 
225  return( _fieldplot_zscale );
226  }
227 
231  set_particledatabase( pdb );
232  }
233 
236  void set_particledatabase( const ParticleDataBase *pdb );
237 
244  void set_particle_div( size_t particle_div );
245 
248  size_t get_particle_div( void ) const {
249  return( _particle_div );
250  }
251 
258  void set_qm_discretation( bool enable );
259 
262  bool get_qm_discretation( void ) const {
263  return( _qm_discretation );
264  }
265 
271  void set_mesh( bool enable );
272 
275  bool get_mesh( void ) const {
276  return( _mesh );
277  }
278 
286  void set_view( view_e view, int level = -1 );
287 
294  void set_view_si( view_e view, double level );
295 
298  view_e get_view( void ) const {
299  return( _view );
300  }
301 
304  int get_level( void ) const {
305  return( _level );
306  }
307 
310  double get_level_si( void ) const {
311  return( _geom->origo(_vb[2])+_level*_geom->h() );
312  }
313 
316  int vb( int i ) const {
317  return( _vb[i] );
318  }
319 
322  void get_vb( int vb[3] ) const {
323  vb[0] = _vb[0];
324  vb[1] = _vb[1];
325  vb[2] = _vb[2];
326  }
327 
328 };
329 
330 
331 #endif
332 
void set_fieldgraph_stepped_palette(int steps)
Set stepped palette.
void set_particle_div(size_t particle_div)
Set particle divisor.
Graph for plotting solids.
Geometry definition
void set_particledatabase(const ParticleDataBase *pdb)
Set particle database used for particle plotting.
void set_bfield(const VectorField *bfield)
Set magnetic field.
Definition: geomplot.hpp:158
void set_view(view_e view, int level=-1)
Set view.
Scalar fields.
Abstract base class for vector field.
Definition: vectorfield.hpp:53
A 2D cut view of the geometry solids.
Definition: solidgraph.hpp:59
Frame for plots
view_e
View types.
Definition: graph3d.hpp:53
GeomPlot(Frame *frame, const Geometry *geom)
Constructor for new geometry plot.
int vb(int i) const
Get component i of view base vector.
Definition: geomplot.hpp:316
void get_vb(int vb[3]) const
Get the view base vector.
Definition: geomplot.hpp:322
size_t get_particle_div(void) const
Get particle divisor.
Definition: geomplot.hpp:248
view_e get_view(void) const
Get view.
Definition: geomplot.hpp:298
Vec3D origo(void) const
Returns origo vector of geometry.
Definition: mesh.hpp:128
Graph for particle plots
Particle databases
Base types.
Equipotential line plot.
Definition: eqpotgraph.hpp:58
void disable_cache(void)
Disable plotting caches from use.
double get_level_si(void) const
Get level of view in SI units.
Definition: geomplot.hpp:310
void set_scharge(const ScalarField *scharge)
Set space charge density field.
const VectorField * get_efield(void) const
Get electric field.
Definition: geomplot.hpp:176
Class for drawing fields with colormap.
Definition: fieldgraph.hpp:60
bool get_mesh(void) const
Get mesh plotting.
Definition: geomplot.hpp:275
Geometry defining class.
Definition: geometry.hpp:131
bool get_qm_discretation(void) const
Get q/m particle discretation.
Definition: geomplot.hpp:262
const VectorField * get_bfield(void) const
Get magnetic field.
Definition: geomplot.hpp:164
~GeomPlot()
Destructor for geometry plotter.
int get_level(void) const
Get level of view in mesh squares.
Definition: geomplot.hpp:304
double h(void) const
Returns mesh cell size.
Definition: mesh.hpp:146
void set_fieldgraph_zscale(zscale_e zscale)
Set field graph zscale setting.
void set_fieldgraph_plot(field_type_e fieldplot)
Set field graph plotting type.
void set_efield(const VectorField *efield)
Set electric field.
Definition: geomplot.hpp:170
Class for drawing particle trajectories.
Definition: particlegraph.hpp:68
void set_view_si(view_e view, double level)
Set view in SI units.
Graph of rectangular mesh for geometry plots
zscale_e get_fieldgraph_zscale(void) const
Get field graph zscale setting.
Definition: geomplot.hpp:224
field_type_e
Field type.
Definition: types.hpp:88
const ScalarField * get_scharge(void) const
Get space charge density field.
Definition: geomplot.hpp:196
void set_mesh(bool enable)
Set mesh plotting.
void set_eqlines_manual(const std::vector< double > &pot)
Set a vector of manual equipotential lines.
Graph for plotting fields
zscale_e
Definition: colormap.hpp:63
std::vector< double > get_eqlines_manual(void) const
Get a vector of manual equipotential lines.
Definition: geomplot.hpp:137
General purpose plotter frame for cairographics surfaces.
Definition: frame.hpp:107
void set_trajdens(const ScalarField *tdens)
Set trajectory density field.
size_t get_eqlines_auto(void) const
Get the number of automatic equipotential lines.
Definition: geomplot.hpp:152
const ScalarField * get_trajdens(void) const
Get trajectory density field.
Definition: geomplot.hpp:186
Class for drawing mesh.
Definition: meshgraph.hpp:55
void set_qm_discretation(bool enable)
Set q/m particle discretation.
void set_epot(const ScalarField *epot)
Set the electric potential field.
field_type_e get_fieldgraph_plot(void) const
Get field graph plotting type.
Definition: geomplot.hpp:206
Graph for plotting equipotential lines
void set_particle_database(const ParticleDataBase *pdb)
Set particle database used for particle plotting.
Definition: geomplot.hpp:230
void set_eqlines_auto(size_t N)
Set the number of automatic equipotential lines.
Geometry plotter class.
Definition: geomplot.hpp:69
Scalar field class.
Definition: scalarfield.hpp:70
Particle database base class.
Definition: particledatabase.hpp:167
Vector field base.