Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.6dev
      Class Index
      File List
   Version 1.0.6
   Version 1.0.5new_solver
   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
fielddiagplot.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2011,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 FIELDDIAGPLOT_HPP
44 #define FIELDDIAGPLOT_HPP 1
45 
46 
47 #include "types.hpp"
48 #include "frame.hpp"
49 #include "xygraph.hpp"
50 #include "vec3d.hpp"
51 #include "geometry.hpp"
52 #include "scalarfield.hpp"
53 #include "vectorfield.hpp"
54 
55 
56 #define FIELDD_DIAG_NONE FIELD_NONE
57 #define FIELDD_DIAG_EPOT FIELD_EPOT
58 #define FIELDD_DIAG_SCHARGE FIELD_SCHARGE
59 #define FIELDD_DIAG_TRAJDENS FIELD_TRAJDENS
60 #define FIELDD_DIAG_EFIELD FIELD_EFIELD
61 #define FIELDD_DIAG_EFIELD_X FIELD_EFIELD_X
62 #define FIELDD_DIAG_EFIELD_Y FIELD_EFIELD_Y
63 #define FIELDD_DIAG_EFIELD_Z FIELD_EFIELD_Z
64 #define FIELDD_DIAG_BFIELD FIELD_BFIELD
65 #define FIELDD_DIAG_BFIELD_X FIELD_BFIELD_X
66 #define FIELDD_DIAG_BFIELD_Y FIELD_BFIELD_Y
67 #define FIELDD_DIAG_BFIELD_Z FIELD_BFIELD_Z
68 
69 
80 };
81 
82 
88 
89  Frame *_frame;
90 
91  const Geometry *_geom;
92  const ScalarField *_epot;
93  const ScalarField *_scharge;
94  const ScalarField *_trajdens;
95  const VectorField *_efield;
96  const VectorField *_bfield;
97 
98  size_t _N;
99  Vec3D _x1;
100  Vec3D _x2;
101 
102  field_diag_type_e _diag[2];
103  field_loc_type_e _loc[2];
104 
105  XYGraph *_graph[2];
106  LegendEntry *_legend[2];
107 
108  void build_data( std::vector<double> coord[4],
109  std::vector<double> fielddata[2] ) const;
110  std::string diagnostic_label( field_diag_type_e diag ) const;
111 
112 public:
113 
116  FieldDiagPlot( Frame &frame, const Geometry &geom );
117 
120  ~FieldDiagPlot();
121 
124  void set_epot( const ScalarField *epot ) {
125  _epot = epot;
126  }
127 
130  void set_efield( const VectorField *efield ) {
131  _efield = efield;
132  }
133 
136  void set_scharge( const ScalarField *scharge ) {
137  _scharge = scharge;
138  }
139 
142  void set_trajdens( const ScalarField *trajdens ) {
143  _trajdens = trajdens;
144  }
145 
148  void set_bfield( const VectorField *bfield ) {
149  _bfield = bfield;
150  }
151 
158  void set_coordinates( size_t N, const Vec3D &x1, const Vec3D &x2 ) {
159  _N = N;
160  _x1 = x1;
161  _x2 = x2;
162  }
163 
166  const Vec3D &start( void ) {
167  return( _x1 );
168  }
169 
172  const Vec3D &end( void ) {
173  return( _x2 );
174  }
175 
178  const size_t &N( void ) {
179  return( _N );
180  }
181 
189  void set_diagnostic( const field_diag_type_e diag[2], const field_loc_type_e loc[2] ) {
190  _diag[0] = diag[0];
191  _diag[1] = diag[1];
192  _loc[0] = loc[0];
193  _loc[1] = loc[1];
194  }
195 
199  return( _diag[i] );
200  }
201 
205  return( _loc[i] );
206  }
207 
210  void export_data( const std::string &filename ) const;
211 
214  void build_plot( void );
215 };
216 
217 
218 
219 #endif
220 
221 
222 
223 
224 
225 
Field diagnostics plot.
Definition: fielddiagplot.hpp:87
const field_diag_type_e & get_diagnostic_type(int i)
Get diagnostic type for y-axis i.
Definition: fielddiagplot.hpp:198
void set_diagnostic(const field_diag_type_e diag[2], const field_loc_type_e loc[2])
Set field and location plot types.
Definition: fielddiagplot.hpp:189
const field_loc_type_e & get_location_type(int i)
Get location type for x-axis i.
Definition: fielddiagplot.hpp:204
void set_efield(const VectorField *efield)
Add pointer to electric field.
Definition: fielddiagplot.hpp:130
const Vec3D & end(void)
Get end coordinates of diagnostic line.
Definition: fielddiagplot.hpp:172
void set_epot(const ScalarField *epot)
Add pointer to electric potential.
Definition: fielddiagplot.hpp:124
const Vec3D & start(void)
Get start coordinates of diagnostic line.
Definition: fielddiagplot.hpp:166
void export_data(const std::string &filename) const
Export plotted data as ASCII.
Definition: fielddiagplot.cpp:417
void set_trajdens(const ScalarField *trajdens)
Add pointer to trajectory density map.
Definition: fielddiagplot.hpp:142
void set_bfield(const VectorField *bfield)
Add pointer to magnetic field.
Definition: fielddiagplot.hpp:148
const size_t & N(void)
Get number of steps on diagnostic line.
Definition: fielddiagplot.hpp:178
void set_scharge(const ScalarField *scharge)
Add pointer to space charge density map.
Definition: fielddiagplot.hpp:136
void set_coordinates(size_t N, const Vec3D &x1, const Vec3D &x2)
Set coordinates for field diagnostics.
Definition: fielddiagplot.hpp:158
~FieldDiagPlot()
Destructor for field diagnostics plot.
Definition: fielddiagplot.cpp:65
void build_plot(void)
Rebuild plot.
Definition: fielddiagplot.cpp:281
FieldDiagPlot(Frame &frame, const Geometry &geom)
Constructor for field diagnostics plot.
Definition: fielddiagplot.cpp:48
General purpose plotter frame for cairographics surfaces.
Definition: frame.hpp:107
Geometry defining class.
Definition: geometry.hpp:180
Class for legend entry.
Definition: legend.hpp:94
Scalar field.
Definition: scalarfield.hpp:55
Three dimensional vector.
Definition: vec3d.hpp:58
Vector field.
Definition: vectorfield.hpp:56
Class for XY-type simple graph plots.
Definition: xygraph.hpp:75
field_loc_type_e
Location type for field diagnostics.
Definition: fielddiagplot.hpp:74
@ FIELDD_LOC_DIST
Location as distance.
Definition: fielddiagplot.hpp:79
@ FIELDD_LOC_X
Location x-coordinate.
Definition: fielddiagplot.hpp:76
@ FIELDD_LOC_Y
Location y-coordinate.
Definition: fielddiagplot.hpp:77
@ FIELDD_LOC_Z
Location z-coordinate.
Definition: fielddiagplot.hpp:78
@ FIELDD_LOC_NONE
Dummy location.
Definition: fielddiagplot.hpp:75
Frame for plots
Geometry definition
Scalar fields.
Base types.
field_type_e
Field type.
Definition: types.hpp:94
Three dimensional vectors.
Vector field base.
XY-graph.


Reference manual for Ion Beam Simulator 1.0.6dev
Generated by Doxygen 1.9.1 on Thu Sep 11 2025 09:37:24.