dune-grid 2.9.0
identitygridhierarchiciterator.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_IDENTITYGRIDHIERITERATOR_HH
6#define DUNE_IDENTITYGRIDHIERITERATOR_HH
7
12namespace Dune {
13
14
15 //**********************************************************************
16 //
24 template<class GridImp>
26 {
27
28 // Type of the corresponding HierarchicIterator in the host grid
29 typedef typename GridImp::HostGridType::template Codim<0>::Entity::HierarchicIterator HostGridHierarchicIterator;
30
31 public:
32
33 constexpr static int codimension = 0;
34
35 typedef typename GridImp::template Codim<0>::Entity Entity;
36
38 explicit IdentityGridHierarchicIterator(const GridImp* identityGrid, const Entity& startEntity, int maxLevel) :
39 identityGrid_(identityGrid),
40 hostHierarchicIterator_(startEntity.impl().hostEntity_.hbegin(maxLevel))
41 {}
42
43
45 explicit IdentityGridHierarchicIterator(const GridImp* identityGrid, const Entity& startEntity, int maxLevel, [[maybe_unused]] bool endDummy) :
46 identityGrid_(identityGrid),
47 hostHierarchicIterator_(startEntity.impl().hostEntity_.hend(maxLevel))
48 {}
49
50
52 void increment()
53 {
54 ++hostHierarchicIterator_;
55 }
56
59 return Entity{{identityGrid_,*hostHierarchicIterator_}};
60 }
61
64 return hostHierarchicIterator_ == i.hostHierarchicIterator_;
65 }
66
67 private:
68 const GridImp* identityGrid_;
69
70 HostGridHierarchicIterator hostHierarchicIterator_;
71
72 };
73
74
75} // end namespace Dune
76
77#endif
Include standard header files.
Definition: agrid.hh:60
Iterator over the descendants of an entity.Mesh entities of codimension 0 ("elements") allow to visit...
Definition: identitygridhierarchiciterator.hh:26
void increment()
Definition: identitygridhierarchiciterator.hh:52
GridImp::template Codim< 0 >::Entity Entity
Definition: identitygridhierarchiciterator.hh:35
bool equals(const IdentityGridHierarchicIterator &i) const
equality
Definition: identitygridhierarchiciterator.hh:63
static constexpr int codimension
Definition: identitygridhierarchiciterator.hh:33
IdentityGridHierarchicIterator(const GridImp *identityGrid, const Entity &startEntity, int maxLevel, bool endDummy)
Definition: identitygridhierarchiciterator.hh:45
Entity dereference() const
dereferencing
Definition: identitygridhierarchiciterator.hh:58
IdentityGridHierarchicIterator(const GridImp *identityGrid, const Entity &startEntity, int maxLevel)
the default Constructor
Definition: identitygridhierarchiciterator.hh:38