00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
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