emptypoints.hh

Go to the documentation of this file.
00001 #ifndef DUNE_LAGRANGE_EMPTYPOINTS_HH
00002 #define DUNE_LAGRANGE_EMPTYPOINTS_HH
00003 
00004 #include <vector>
00005 
00006 #include <dune/common/fvector.hh>
00007 #include <dune/localfunctions/common/localkey.hh>
00008 
00009 namespace Dune
00010 {
00011 
00012   template< class F, unsigned int dim >
00013   class LagrangePoint
00014   {
00015     typedef LagrangePoint< F, dim > This;
00016 
00017     template< class, class >
00018     friend class LagrangePointSetImpl;
00019 
00020   public:
00021     static const int dimension = dim;
00022 
00023     typedef F Field;
00024 
00025     typedef FieldVector< Field, dimension > Vector;
00026 
00027     const Vector &point () const
00028     {
00029       return point_;
00030     }
00031 
00032     const LocalKey &localKey () const
00033     {
00034       return localKey_;
00035     }
00036 
00037     Vector point_;
00038     LocalKey localKey_;
00039   };
00040 
00041   // EmptyPointSet
00042   // --------------
00043 
00044   template< class F, unsigned int dim >
00045   class EmptyPointSet
00046   {
00047     typedef EmptyPointSet< F, dim > This;
00048 
00049   public:
00050     typedef F Field;
00051 
00052     static const unsigned int dimension = dim;
00053 
00054     typedef Dune::LagrangePoint< Field, dimension > LagrangePoint;
00055 
00056     typedef typename std::vector< LagrangePoint >::const_iterator iterator;
00057 
00058   protected:
00059     EmptyPointSet ( const unsigned int order )
00060     : order_( order )
00061     {}
00062 
00063   public:
00064     const LagrangePoint &operator[] ( const unsigned int i ) const
00065     {
00066       assert( i < size() );
00067       return points_[ i ];
00068     }
00069 
00070     iterator begin () const
00071     {
00072       return points_.begin();
00073     }
00074 
00075     iterator end () const
00076     {
00077       return points_.end();
00078     }
00079 
00080     const LocalKey &localKey ( const unsigned int i ) const
00081     {
00082       return (*this)[ i ].localKey();
00083     }
00084 
00085     unsigned int order () const
00086     {
00087       return order_;
00088     }
00089 
00090     unsigned int size () const
00091     {
00092       return points_.size();
00093     }
00094 
00095   protected:
00096     unsigned int order_;
00097     std::vector< LagrangePoint > points_;
00098   };
00099 
00100 }
00101 
00102 #endif // DUNE_LAGRANGE_EMPTYPOINTS_HH

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].