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
meshvectorfield.hpp
Go to the documentation of this file.
1 
5 /* Copyright (c) 2005-2011,2014,2015 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 MESHVECTORFIELD_HPP
44 #define MESHVECTORFIELD_HPP 1
45 
46 
47 #include "transformation.hpp"
48 #include "vectorfield.hpp"
49 #include "mesh.hpp"
50 #include "types.hpp"
51 
52 
84 class MeshVectorField : public VectorField, public Mesh {
85 
86  field_extrpl_e _extrpl[6];
87  double *_F[3];
93  Transformation _T;
94  Transformation _Tinv;
96  void check_definition();
97 
98  void convert_3d_to_3d( const MeshVectorField &fin );
99  void convert_cyl_to_3d( const MeshVectorField &fin );
100 
101 public:
102 
103 
111  MeshVectorField();
112 
119  MeshVectorField( const Mesh &m, const bool fout[3] );
120 
131  MeshVectorField( geom_mode_e geom_mode, const bool fout[3], Int3D size,
132  Vec3D origo, double h );
133 
159  MeshVectorField( geom_mode_e geom_mode, const bool fout[3], double xscale,
160  double fscale, const std::string &filename );
161 
185  MeshVectorField( geom_mode_e geom_mode, const bool fout[3], Int3D size,
186  Vec3D origo, double h, const MeshVectorField &fin );
187 
190  MeshVectorField( const MeshVectorField &f );
191 
194  MeshVectorField( std::istream &is );
195 
198  virtual ~MeshVectorField();
199 
236  void set_extrapolation( const field_extrpl_e extrpl[6] );
237 
240  void reset_transformation( void );
241 
244  void set_transformation( const Transformation &T );
245 
248  void translate( const Vec3D &dx );
249 
252  void scale( const Vec3D &sx );
253 
256  void rotate_x( double a );
257 
260  void rotate_y( double a );
261 
264  void rotate_z( double a );
265 
268  void clear();
269 
276  void reset( geom_mode_e geom_mode, const bool fout[3], Int3D size,
277  Vec3D origo, double h );
278 
282  void get_minmax( double &min, double &max ) const;
283 
289  void get_minmax( Vec3D &min, Vec3D &max ) const;
290 
293  void get_defined_components( bool fout[3] ) const;
294 
298 
305 
308  MeshVectorField &operator*=( double x );
309 
312  MeshVectorField &operator/=( double x );
313 
316  const Vec3D operator()( int32_t i ) const;
317 
320  const Vec3D operator()( int32_t i, int32_t j ) const;
321 
324  const Vec3D operator()( int32_t i, int32_t j, int32_t k ) const;
325 
328  void set( int32_t i, const Vec3D &v );
329 
332  void set( int32_t i, int32_t j, const Vec3D &v );
333 
336  void set( int32_t i, int32_t j, int32_t k, const Vec3D &v );
337 
341  virtual const Vec3D operator()( const Vec3D &x ) const;
342 
345  void save( const std::string &filename ) const;
346 
349  void save( std::ostream &os ) const;
350 
353  void debug_print( std::ostream &os ) const;
354 };
355 
356 
357 #endif
358 
3D Integer vector class.
Definition: vec3d.hpp:320
Mesh based vector field.
Definition: meshvectorfield.hpp:84
void debug_print(std::ostream &os) const
Print debugging information to stream os.
Definition: meshvectorfield.cpp:1138
void translate(const Vec3D &dx)
Translate field.
Definition: meshvectorfield.cpp:403
void rotate_z(double a)
Rotate field in coordinate system around y-axis for a radians.
Definition: meshvectorfield.cpp:431
void set_extrapolation(const field_extrpl_e extrpl[6])
Set the behaviour of field interpolation outside mesh points (extrapolation).
Definition: meshvectorfield.cpp:377
void clear()
Clears the field.
Definition: meshvectorfield.cpp:605
void rotate_x(double a)
Rotate field in coordinate system around y-axis for a radians.
Definition: meshvectorfield.cpp:417
void set(int32_t i, const Vec3D &v)
Operator for setting element (i) of the field mesh.
Definition: meshvectorfield.cpp:796
MeshVectorField & operator/=(double x)
Inverse scaling operator.
Definition: meshvectorfield.cpp:740
void scale(const Vec3D &sx)
Scale field.
Definition: meshvectorfield.cpp:410
MeshVectorField & operator*=(double x)
Scaling operator for field values.
Definition: meshvectorfield.cpp:727
void reset_transformation(void)
Set transformation to unity.
Definition: meshvectorfield.cpp:389
virtual ~MeshVectorField()
Destructor.
Definition: meshvectorfield.cpp:368
MeshVectorField & operator+=(const MeshVectorField &f)
Accumulation operator.
Definition: meshvectorfield.cpp:706
MeshVectorField()
Default constructor.
Definition: meshvectorfield.cpp:55
void set_transformation(const Transformation &T)
Set transformation as a copy of T.
Definition: meshvectorfield.cpp:396
MeshVectorField & operator=(const MeshVectorField &f)
Copy operator.
Definition: meshvectorfield.cpp:688
void get_defined_components(bool fout[3]) const
Get which field components are defined.
Definition: meshvectorfield.cpp:677
const Vec3D operator()(int32_t i) const
Operator for getting elements of the field mesh.
Definition: meshvectorfield.cpp:754
void rotate_y(double a)
Rotate field in coordinate system around y-axis for a radians.
Definition: meshvectorfield.cpp:424
void save(const std::string &filename) const
Saves data to a new file filename.
Definition: meshvectorfield.cpp:1105
void get_minmax(double &min, double &max) const
Search minimum and maximum vector length values of vector field.
Definition: meshvectorfield.cpp:635
void reset(geom_mode_e geom_mode, const bool fout[3], Int3D size, Vec3D origo, double h)
Resets the field geometry.
Definition: meshvectorfield.cpp:614
Mesh geometry definion.
Definition: mesh.hpp:68
double h(void) const
Returns mesh cell size.
Definition: mesh.hpp:146
Int3D size(void) const
Returns size array of geometry.
Definition: mesh.hpp:116
Vec3D max(void) const
Returns vector pointing to the last mesh point opposite of origo.
Definition: mesh.hpp:137
Vec3D origo(void) const
Returns origo vector of geometry.
Definition: mesh.hpp:128
geom_mode_e geom_mode(void) const
Returns geometry mode.
Definition: mesh.hpp:108
Transformation for homogenous three dimensional space.
Definition: transformation.hpp:70
Three dimensional vector.
Definition: vec3d.hpp:58
Vector field.
Definition: vectorfield.hpp:56
Rectangular mesh definition.
Full transformation for three dimensional homogenous space.
Base types.
geom_mode_e
Geometry mode enum.
Definition: types.hpp:59
field_extrpl_e
Field extrapolation mode.
Definition: types.hpp:79
Vector field base.


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