dune-grid
2.1.1
|
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 00271 #include <vector> 00272 #include <dune/common/geometrytype.hh> 00273 #include <dune/common/fvector.hh> 00274 #include "refinement.hh" 00275 00276 namespace Dune { 00277 00278 // ////////////////////////////////////////// 00279 // 00280 // The virtual base class and its iterators 00281 // 00282 00283 // 00284 // Refinement 00285 // 00286 00292 template<int dimension, class CoordType> 00293 class VirtualRefinement 00294 { 00295 public: 00296 template<int codimension> 00297 struct Codim; 00299 typedef typename Codim<dimension>::SubEntityIterator VertexIterator; 00301 typedef typename Codim<0>::SubEntityIterator ElementIterator; 00302 00307 typedef FieldVector<CoordType, dimension> CoordVector; 00312 typedef std::vector<int> IndexVector; 00313 00314 template<int codimension> 00315 class SubEntityIteratorBack; 00316 typedef SubEntityIteratorBack<dimension> VertexIteratorBack; 00317 typedef SubEntityIteratorBack<0> ElementIteratorBack; 00318 00320 virtual int nVertices(int level) const = 0; 00322 VertexIterator vBegin(int level) const; 00324 VertexIterator vEnd(int level) const; 00325 00327 virtual int nElements(int level) const = 0; 00329 ElementIterator eBegin(int level) const; 00331 ElementIterator eEnd(int level) const; 00332 00334 virtual ~VirtualRefinement() 00335 {} 00336 00337 protected: 00338 virtual VertexIteratorBack *vBeginBack(int level) const = 0; 00339 virtual VertexIteratorBack *vEndBack(int level) const = 0; 00340 virtual ElementIteratorBack *eBeginBack(int level) const = 0; 00341 virtual ElementIteratorBack *eEndBack(int level) const = 0; 00342 }; 00343 00345 template<int dimension, class CoordType> 00346 template<int codimension> 00347 struct VirtualRefinement<dimension, CoordType>::Codim 00348 { 00349 class SubEntityIterator; 00350 }; 00351 00352 // //////////////////////// 00353 // 00354 // The refinement builder 00355 // 00356 00357 template<int dimension, class CoordType> 00358 VirtualRefinement<dimension, CoordType> & 00359 buildRefinement(GeometryType geometryType, 00360 GeometryType coerceTo); 00361 00362 } // namespace Dune 00363 00364 #include "virtualrefinement.cc" 00365 00366 #endif //DUNE_GRID_COMMON_VIRTUALREFINEMENT_HH