vectorfield.h

Go to the documentation of this file.
00001 #ifndef __VECTORFIELD_H
00002 #define __VECTORFIELD_H
00003 
00004 #include <boost/numeric/ublas/vector.hpp>
00005 #include <boost/multi_array.hpp>
00006 #include <functional>
00007 
00008 namespace mimas {
00009 
00026 template< class Tensor >
00027 class vectorfield: public std::unary_function
00028    < boost::numeric::ublas::vector< double >,
00029      boost::numeric::ublas::vector< double > >
00030 {
00031  public:
00032   typedef boost::numeric::ublas::vector< double > Vector;
00037   vectorfield( int width, int height, const Tensor &aTensor );
00039   Vector operator()( const Vector &v ) const {
00040     int
00041       height = data.shape()[ 0 ],
00042       width = data.shape()[ 1 ],
00043       x = (int)rint( v( 0 ) + width * 0.5 ),
00044       y = (int)rint( v( 1 ) + height * 0.5 );
00045     assert( x >= 0 && x < width );
00046     assert( y >= 0 && y < height );
00047     return data[ y ][ x ];
00048   };
00049  protected:
00051   boost::multi_array< Vector, 2 > data;
00052 };
00053 
00054 };
00055 
00056 #include "vectorfield.tcc"
00057 
00058 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...