Dune Core Modules (2.9.0)

identitygridleafiterator.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_IDENTITYGRIDLEAFITERATOR_HH
6#define DUNE_IDENTITYGRIDLEAFITERATOR_HH
7
8#include <dune/grid/common/gridenums.hh>
9
14namespace Dune {
15
16
20 template<int codim, PartitionIteratorType pitype, class GridImp>
22 {
23 private:
24
25 // LevelIterator to the equivalent entity in the host grid
26 typedef typename GridImp::HostGridType::template Codim<codim>::template Partition<pitype>::LeafIterator HostGridLeafIterator;
27
28 public:
29
30 constexpr static int codimension = codim;
31
32 typedef typename GridImp::template Codim<codim>::Entity Entity;
33
35 explicit IdentityGridLeafIterator(const GridImp* identityGrid) :
36 identityGrid_(identityGrid),
37 hostLeafIterator_(identityGrid->hostgrid_->leafGridView().template begin<codim,pitype>())
38 {}
39
44 explicit IdentityGridLeafIterator(const GridImp* identityGrid, [[maybe_unused]] bool endDummy) :
45 identityGrid_(identityGrid),
46 hostLeafIterator_(identityGrid->hostgrid_->leafGridView().template end<codim,pitype>())
47 {}
48
49
51 void increment() {
52 ++hostLeafIterator_;
53 }
54
56 Entity dereference() const {
57 return Entity{{identityGrid_,*hostLeafIterator_}};
58 }
59
61 bool equals(const IdentityGridLeafIterator& i) const {
62 return hostLeafIterator_ == i.hostLeafIterator_;
63 }
64
65 private:
66 const GridImp* identityGrid_;
67
68 HostGridLeafIterator hostLeafIterator_;
69
70 };
71
72
73} // namespace Dune
74
75#endif
Iterator over all entities of a given codimension and level of a grid.
Definition: identitygridleafiterator.hh:22
Entity dereference() const
dereferencing
Definition: identitygridleafiterator.hh:56
bool equals(const IdentityGridLeafIterator &i) const
equality
Definition: identitygridleafiterator.hh:61
IdentityGridLeafIterator(const GridImp *identityGrid, bool endDummy)
Constructor which create the end iterator.
Definition: identitygridleafiterator.hh:44
IdentityGridLeafIterator(const GridImp *identityGrid)
Definition: identitygridleafiterator.hh:35
void increment()
prefix increment
Definition: identitygridleafiterator.hh:51
Grid< dim, dimworld, ct, GridFamily >::LeafGridView leafGridView(const Grid< dim, dimworld, ct, GridFamily > &grid)
leaf grid view for the given grid
Definition: grid.hh:819
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.111.3 (Dec 21, 23:30, 2024)