Dune Core Modules (2.8.0)

identitygridleveliterator.hh
Go to the documentation of this file.
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_IDENTITYGRIDLEVELITERATOR_HH
4#define DUNE_IDENTITYGRIDLEVELITERATOR_HH
5
6#include <dune/grid/common/gridenums.hh>
7
12namespace Dune {
13
17 template<int codim, PartitionIteratorType pitype, class GridImp>
19 {
20
21 typedef typename GridImp::HostGridType::Traits::template Codim<codim>::template Partition<pitype>::LevelIterator HostGridLevelIterator;
22
23 public:
24
25 enum {codimension = codim};
26
27 typedef typename GridImp::template Codim<codim>::Entity Entity;
28
30 explicit IdentityGridLevelIterator(const GridImp* identityGrid, int level)
31 : identityGrid_(identityGrid),
32 hostLevelIterator_(identityGrid->hostgrid_->levelGridView(level).template begin<codim,pitype>())
33 {}
34
35
41 explicit IdentityGridLevelIterator(const GridImp* identityGrid, int level, [[maybe_unused]] bool endDummy)
42 : identityGrid_(identityGrid),
43 hostLevelIterator_(identityGrid->hostgrid_->levelGridView(level).template end<codim,pitype>())
44 {}
45
46
48 void increment() {
49 ++hostLevelIterator_;
50 }
51
53 Entity dereference() const {
54 return Entity{{identityGrid_,*hostLevelIterator_}};
55 }
56
58 bool equals(const IdentityGridLevelIterator& i) const {
59 return hostLevelIterator_ == i.hostLevelIterator_;
60 }
61
62 private:
63 const GridImp* identityGrid_;
64
65 HostGridLevelIterator hostLevelIterator_;
66 };
67
68
69} // namespace Dune
70
71#endif
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleveliterator.hh:19
void increment()
prefix increment
Definition: identitygridleveliterator.hh:48
IdentityGridLevelIterator(const GridImp *identityGrid, int level)
Constructor.
Definition: identitygridleveliterator.hh:30
IdentityGridLevelIterator(const GridImp *identityGrid, int level, bool endDummy)
Constructor which create the end iterator.
Definition: identitygridleveliterator.hh:41
bool equals(const IdentityGridLevelIterator &i) const
equality
Definition: identitygridleveliterator.hh:58
Entity dereference() const
dereferencing
Definition: identitygridleveliterator.hh:53
Grid< dim, dimworld, ct, GridFamily >::LevelGridView levelGridView(const Grid< dim, dimworld, ct, GridFamily > &grid, int level)
level grid view for the given grid and level.
Definition: grid.hh:791
Dune namespace.
Definition: alignedallocator.hh:11
Static tag representing a codimension.
Definition: dimension.hh:22
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 21, 23:30, 2024)