dune-grid
2.2.0
|
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 // This file is licensed under version 2 of the GNU General Public License, 00007 // with a special "runtime exception." See COPYING at the top of the source 00008 // tree for the full licence. 00009 00272 #include <vector> 00273 #include <dune/geometry/type.hh> 00274 #include <dune/common/fvector.hh> 00275 #include "refinement.hh" 00276 00277 namespace Dune { 00278 00279 // ////////////////////////////////////////// 00280 // 00281 // The virtual base class and its iterators 00282 // 00283 00284 // 00285 // Refinement 00286 // 00287 00293 template<int dimension, class CoordType> 00294 class VirtualRefinement 00295 { 00296 public: 00297 template<int codimension> 00298 struct Codim; 00300 typedef typename Codim<dimension>::SubEntityIterator VertexIterator; 00302 typedef typename Codim<0>::SubEntityIterator ElementIterator; 00303 00308 typedef FieldVector<CoordType, dimension> CoordVector; 00313 typedef std::vector<int> IndexVector; 00314 00315 template<int codimension> 00316 class SubEntityIteratorBack; 00317 typedef SubEntityIteratorBack<dimension> VertexIteratorBack; 00318 typedef SubEntityIteratorBack<0> ElementIteratorBack; 00319 00321 virtual int nVertices(int level) const = 0; 00323 VertexIterator vBegin(int level) const; 00325 VertexIterator vEnd(int level) const; 00326 00328 virtual int nElements(int level) const = 0; 00330 ElementIterator eBegin(int level) const; 00332 ElementIterator eEnd(int level) const; 00333 00335 virtual ~VirtualRefinement() 00336 {} 00337 00338 protected: 00339 virtual VertexIteratorBack *vBeginBack(int level) const = 0; 00340 virtual VertexIteratorBack *vEndBack(int level) const = 0; 00341 virtual ElementIteratorBack *eBeginBack(int level) const = 0; 00342 virtual ElementIteratorBack *eEndBack(int level) const = 0; 00343 }; 00344 00346 template<int dimension, class CoordType> 00347 template<int codimension> 00348 struct VirtualRefinement<dimension, CoordType>::Codim 00349 { 00350 class SubEntityIterator; 00351 }; 00352 00353 // //////////////////////// 00354 // 00355 // The refinement builder 00356 // 00357 00358 template<int dimension, class CoordType> 00359 VirtualRefinement<dimension, CoordType> & 00360 buildRefinement(GeometryType geometryType, 00361 GeometryType coerceTo); 00362 00363 } // namespace Dune 00364 00365 #include "virtualrefinement.cc" 00366 00367 #endif //DUNE_GRID_COMMON_VIRTUALREFINEMENT_HH