dune-grid 2.9.0
identitygridleveliterator.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (C) DUNE Project contributors, see file LICENSE.md in module root
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
3// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
4// vi: set et ts=4 sw=2 sts=2:
5#ifndef DUNE_IDENTITYGRIDLEVELITERATOR_HH
6#define DUNE_IDENTITYGRIDLEVELITERATOR_HH
7
9
14namespace Dune {
15
19 template<int codim, PartitionIteratorType pitype, class GridImp>
21 {
22
23 typedef typename GridImp::HostGridType::Traits::template Codim<codim>::template Partition<pitype>::LevelIterator HostGridLevelIterator;
24
25 public:
26
27 constexpr static int codimension = codim;
28
29 typedef typename GridImp::template Codim<codim>::Entity Entity;
30
32 explicit IdentityGridLevelIterator(const GridImp* identityGrid, int level)
33 : identityGrid_(identityGrid),
34 hostLevelIterator_(identityGrid->hostgrid_->levelGridView(level).template begin<codim,pitype>())
35 {}
36
37
43 explicit IdentityGridLevelIterator(const GridImp* identityGrid, int level, [[maybe_unused]] bool endDummy)
44 : identityGrid_(identityGrid),
45 hostLevelIterator_(identityGrid->hostgrid_->levelGridView(level).template end<codim,pitype>())
46 {}
47
48
50 void increment() {
51 ++hostLevelIterator_;
52 }
53
56 return Entity{{identityGrid_,*hostLevelIterator_}};
57 }
58
60 bool equals(const IdentityGridLevelIterator& i) const {
61 return hostLevelIterator_ == i.hostLevelIterator_;
62 }
63
64 private:
65 const GridImp* identityGrid_;
66
67 HostGridLevelIterator hostLevelIterator_;
68 };
69
70
71} // namespace Dune
72
73#endif
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: common/grid.hh:802
Include standard header files.
Definition: agrid.hh:60
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleveliterator.hh:21
void increment()
prefix increment
Definition: identitygridleveliterator.hh:50
GridImp::template Codim< codim >::Entity Entity
Definition: identitygridleveliterator.hh:29
IdentityGridLevelIterator(const GridImp *identityGrid, int level)
Constructor.
Definition: identitygridleveliterator.hh:32
IdentityGridLevelIterator(const GridImp *identityGrid, int level, bool endDummy)
Constructor which create the end iterator.
Definition: identitygridleveliterator.hh:43
static constexpr int codimension
Definition: identitygridleveliterator.hh:27
bool equals(const IdentityGridLevelIterator &i) const
equality
Definition: identitygridleveliterator.hh:60
Entity dereference() const
dereferencing
Definition: identitygridleveliterator.hh:55