Dune Core Modules (unstable)

identitygridleveliterator.hh
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright © 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 
8 #include <dune/grid/common/gridenums.hh>
9 
14 namespace 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 
55  Entity dereference() const {
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
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
IdentityGridLevelIterator(const GridImp *identityGrid, int level)
Constructor.
Definition: identitygridleveliterator.hh:32
bool equals(const IdentityGridLevelIterator &i) const
equality
Definition: identitygridleveliterator.hh:60
Entity dereference() const
dereferencing
Definition: identitygridleveliterator.hh:55
IdentityGridLevelIterator(const GridImp *identityGrid, int level, [[maybe_unused]] bool endDummy)
Constructor which create the end iterator.
Definition: identitygridleveliterator.hh:43
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:788
Dune namespace.
Definition: alignedallocator.hh:13
Static tag representing a codimension.
Definition: dimension.hh:24
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 27, 22:29, 2024)