Navigation

Main Page
Download
Support
Installation
Tutorial
Examples
Reference Manual
   Version 1.0.4
      Class Index
      File List
   Version 1.0.4dev
Publications


Hosted by Get Ion Beam Simulator at SourceForge.net. Fast, secure and Free Open Source software downloads

vectorfield.hpp

Go to the documentation of this file.
00001 
00005 /* Copyright (c) 2005-2010 Taneli Kalvas. All rights reserved.
00006  *
00007  * You can redistribute this software and/or modify it under the terms
00008  * of the GNU General Public License as published by the Free Software
00009  * Foundation; either version 2 of the License, or (at your option)
00010  * any later version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015  * General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this library (file "COPYING" included in the package);
00019  * if not, write to the Free Software Foundation, Inc., 51 Franklin
00020  * Street, Fifth Floor, Boston, MA 02110-1301 USA
00021  * 
00022  * If you have questions about your rights to use or distribute this
00023  * software, please contact Berkeley Lab's Technology Transfer
00024  * Department at TTD@lbl.gov. Other questions, comments and bug
00025  * reports should be sent directly to the author via email at
00026  * taneli.kalvas@jyu.fi.
00027  * 
00028  * NOTICE. This software was developed under partial funding from the
00029  * U.S.  Department of Energy.  As such, the U.S. Government has been
00030  * granted for itself and others acting on its behalf a paid-up,
00031  * nonexclusive, irrevocable, worldwide license in the Software to
00032  * reproduce, prepare derivative works, and perform publicly and
00033  * display publicly.  Beginning five (5) years after the date
00034  * permission to assert copyright is obtained from the U.S. Department
00035  * of Energy, and subject to any subsequent five (5) year renewals,
00036  * the U.S. Government is granted for itself and others acting on its
00037  * behalf a paid-up, nonexclusive, irrevocable, worldwide license in
00038  * the Software to reproduce, prepare derivative works, distribute
00039  * copies to the public, perform publicly and display publicly, and to
00040  * permit others to do so.
00041  */
00042 
00043 #ifndef VECTORFIELD_HPP
00044 #define VECTORFIELD_HPP 1
00045 
00046 
00047 #include "geometry.hpp"
00048 #include "vec3d.hpp"
00049 #include "types.hpp"
00050 
00051 
00070 class VectorField {
00071     geom_mode_e _geom_mode; 
00072     Int3D       _size;      
00073     Vec3D       _origo;     
00074     Vec3D       _max;       
00075     double      _h;         
00076     double      _div_h;     
00077     double     *_F[3];      
00082     field_extrpl_e   _extrpl[6];   
00084     bool parse_line( const std::string &str, double c[6], double xscale, double fscale, 
00085                      size_t cdim, size_t fdim, const std::string &filename, size_t linec );
00086 
00087     void transform( int ind[3] );
00088 
00089 public:
00090 
00091 
00094     VectorField();
00095 
00102     VectorField( const Geometry &g, bool fout[3] );
00103 
00114     VectorField( geom_mode_e geom_mode, bool fout[3], Int3D size, 
00115                  Vec3D origo, double h );
00116 
00142     VectorField( geom_mode_e geom_mode, bool fout[3], double xscale, 
00143                  double fscale, const std::string &filename );
00144 
00147     VectorField( const VectorField &f );
00148 
00151     ~VectorField();
00152 
00155     inline geom_mode_e geom_mode( void ) const { return( _geom_mode ); }
00156 
00159     inline Int3D size( void ) const { return( _size ); }
00160 
00163     inline int32_t size( int i ) const { return( _size[i] ); }
00164    
00167     inline int32_t nodecount( void ) const { return( _size[0]*_size[1]*_size[2] ); }
00168 
00171     inline Vec3D origo( void ) const { return( _origo ); }
00172 
00175     inline double origo( int i ) const { return( _origo[i] ); }
00176 
00179     inline double h( void ) const { return( _h ); }
00180 
00183     inline double div_h( void ) const { return( _div_h ); }
00184 
00203     void set_extrapolation( field_extrpl_e extrpl[6] ) {
00204         memcpy( _extrpl, extrpl, 6*sizeof(field_extrpl_e) );
00205     }
00206 
00209     void translate( Vec3D x );
00210 
00213     void scale( double s );
00214 
00217     void rotate_x( int a );
00218 
00221     void rotate_y( int a );
00222 
00225     void rotate_z( int a );
00226 
00229     void clear();
00230 
00236     void reset( geom_mode_e geom_mode, bool fout[3], Int3D size, 
00237                 Vec3D origo, double h );
00238 
00242     void get_minmax( double &min, double &max ) const;
00243 
00246     void get_defined_components( bool fout[3] ) const;
00247 
00250     VectorField &operator=( const VectorField &f );
00251 
00254     VectorField &operator+=( const VectorField &f );
00255 
00258     VectorField &operator*=( double x );
00259 
00262     VectorField &operator/=( double x );
00263 
00266     const Vec3D operator()( int32_t i ) const;
00267 
00270     const Vec3D operator()( int32_t i, int32_t j ) const;
00271 
00274     const Vec3D operator()( int32_t i, int32_t j, int32_t k ) const;
00275 
00278     void set( int32_t i, const Vec3D &v );
00279     
00282     void set( int32_t i, int32_t j, const Vec3D &v );
00283 
00286     void set( int32_t i, int32_t j, int32_t k, const Vec3D &v );
00287 
00291     Vec3D operator()( Vec3D x ) const;
00292 
00295     void debug_print( void ) const;
00296 };
00297 
00298 
00299 #endif
00300 
00301 
00302 
00303 
00304 
00305 
00306 
00307 
00308 
00309 
00310 
00311 
00312 
00313 
00314 
00315 
00316 
00317 


Reference manual for Ion Beam Simulator 1.0.4
Generated by Doxygen 1.7.1 on Wed Apr 13 2011 23:25:33.