virtualrefinement.hh

Go to the documentation of this file.
00001 #ifndef DUNE_GRID_COMMON_VIRTUALREFINEMENT_HH
00002 #define DUNE_GRID_COMMON_VIRTUALREFINEMENT_HH
00003 
00004 // This file is part of DUNE, a Distributed and Unified Numerics Environment
00005 // This file is copyright (C) 2005 Jorrit Fahlke <jorrit@jorrit.de>
00006 // It is distributed under the terms of the GNU Lesser General Public License version 2.1
00007 // See COPYING at the top of the source tree for the full licence.
00008 
00269 #include <vector>
00270 #include <dune/common/geometrytype.hh>
00271 #include <dune/common/fvector.hh>
00272 #include "refinement.hh"
00273 
00274 namespace Dune {
00275 
00276   // //////////////////////////////////////////
00277   //
00278   // The virtual base class and its iterators
00279   //
00280 
00281   //
00282   // Refinement
00283   //
00284 
00290   template<int dimension, class CoordType>
00291   class VirtualRefinement
00292   {
00293   public:
00294     template<int codimension>
00295     struct Codim;
00297     typedef typename Codim<dimension>::SubEntityIterator VertexIterator;
00299     typedef typename Codim<0>::SubEntityIterator ElementIterator;
00300 
00305     typedef FieldVector<CoordType, dimension> CoordVector;
00310     typedef std::vector<int> IndexVector;
00311 
00312     template<int codimension>
00313     class SubEntityIteratorBack;
00314     typedef SubEntityIteratorBack<dimension> VertexIteratorBack;
00315     typedef SubEntityIteratorBack<0> ElementIteratorBack;
00316 
00318     virtual int nVertices(int level) const = 0;
00320     VertexIterator vBegin(int level) const;
00322     VertexIterator vEnd(int level) const;
00323 
00325     virtual int nElements(int level) const = 0;
00327     ElementIterator eBegin(int level) const;
00329     ElementIterator eEnd(int level) const;
00330 
00332     virtual ~VirtualRefinement()
00333     {}
00334     
00335   protected:
00336     virtual VertexIteratorBack *vBeginBack(int level) const = 0;
00337     virtual VertexIteratorBack *vEndBack(int level) const = 0;
00338     virtual ElementIteratorBack *eBeginBack(int level) const = 0;
00339     virtual ElementIteratorBack *eEndBack(int level) const = 0;
00340   };
00341 
00343   template<int dimension, class CoordType>
00344   template<int codimension>
00345   struct VirtualRefinement<dimension, CoordType>::Codim
00346   {
00347     class SubEntityIterator;
00348   };
00349 
00350   // ////////////////////////
00351   //
00352   // The refinement builder
00353   //
00354 
00355   template<int dimension, class CoordType>
00356   VirtualRefinement<dimension, CoordType> &
00357   buildRefinement(GeometryType geometryType,
00358                   GeometryType coerceTo);
00359 
00360 } // namespace Dune
00361 
00362 #include "virtualrefinement.cc"
00363 
00364 #endif //DUNE_GRID_COMMON_VIRTUALREFINEMENT_HH

Generated on Thu Apr 2 10:40:44 2009 for dune-grid by  doxygen 1.5.6