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