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
graph3d.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2009, 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 GRAPH3D_HPP
44 #define GRAPH3D_HPP 1
45 
46 
47 #include "graph.hpp"
48 #include "mesh.hpp"
49 #include "error.hpp"
50 
51 
54 enum view_e {
55  VIEW_XY = 0,
56  VIEW_XZ,
57  VIEW_YX,
58  VIEW_YZ,
59  VIEW_ZX,
60  VIEW_ZY
61 };
62 
63 
79 class Graph3D : public Graph {
80 
81 protected:
82 
83  const Mesh &_mesh;
85  int _vb[3];
86  int _level;
87  double _level_si;
89 public:
90 
95  Graph3D( const Mesh &mesh )
96  : _mesh(mesh) {
97  _view = VIEW_XY;
98  _vb[0] = 0;
99  _vb[1] = 1;
100  _vb[2] = 2;
101  _level = 0;
103  }
104 
107  virtual ~Graph3D() {}
108 
118  virtual void plot( cairo_t *cairo, const Coordmapper *cm, const double range[4] ) = 0;
119 
124  virtual void plot_sample( cairo_t *cairo, double x, double y, double width, double height ) = 0;
125 
131  virtual void get_bbox( double bbox[4] ) = 0;
132 
137  void set_view( view_e view, int level ) {
138  switch( view ) {
139  case VIEW_XY:
140  _vb[0] = 0;
141  _vb[1] = 1;
142  _vb[2] = 2;
143  break;
144  case VIEW_XZ:
145  _vb[0] = 0;
146  _vb[1] = 2;
147  _vb[2] = 1;
148  break;
149  case VIEW_YX:
150  _vb[0] = 1;
151  _vb[1] = 0;
152  _vb[2] = 2;
153  break;
154  case VIEW_YZ:
155  _vb[0] = 1;
156  _vb[1] = 2;
157  _vb[2] = 0;
158  break;
159  case VIEW_ZX:
160  _vb[0] = 2;
161  _vb[1] = 0;
162  _vb[2] = 1;
163  break;
164  case VIEW_ZY:
165  _vb[0] = 2;
166  _vb[1] = 1;
167  _vb[2] = 0;
168  break;
169  default:
171  break;
172  }
173  _view = view;
174  _level = level;
176  }
177 };
178 
179 
180 #endif
Linear-linear 2D coordinate mapper.
Definition: coordmapper.hpp:119
Error class to use if requested feature is unimplemented.
Definition: error.hpp:229
Abstract base class for geometry slice plots.
Definition: graph3d.hpp:79
virtual void plot_sample(cairo_t *cairo, double x, double y, double width, double height)=0
Plot sample for legend.
virtual void plot(cairo_t *cairo, const Coordmapper *cm, const double range[4])=0
Plot graph with cairo.
int _level
Level of slice in mesh units.
Definition: graph3d.hpp:86
double _level_si
Level in meters.
Definition: graph3d.hpp:87
int _vb[3]
Coordinate index for first, second and third axes.
Definition: graph3d.hpp:85
const Mesh & _mesh
Mesh of simulation.
Definition: graph3d.hpp:83
virtual ~Graph3D()
Virtual destructor.
Definition: graph3d.hpp:107
Graph3D(const Mesh &mesh)
Constructor.
Definition: graph3d.hpp:95
void set_view(view_e view, int level)
Set the view of 3D drawable.
Definition: graph3d.hpp:137
view_e _view
Geometry view direction.
Definition: graph3d.hpp:84
virtual void get_bbox(double bbox[4])=0
Get bounding box of drawable.
Abstract base class for drawable plots.
Definition: graph.hpp:56
Mesh geometry definion.
Definition: mesh.hpp:68
double h(void) const
Returns mesh cell size.
Definition: mesh.hpp:146
Vec3D origo(void) const
Returns origo vector of geometry.
Definition: mesh.hpp:128
Error classes and handling
#define ERROR_LOCATION
Macro for setting error location when throwing errors.
Definition: error.hpp:83
view_e
View types.
Definition: graph3d.hpp:54
Base for plottable graphs.
Rectangular mesh definition.


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