DUNE PDELab (git)

gridviewentityset.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3
4// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
5// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
6
7#ifndef DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWENTITYSET_HH
8#define DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWENTITYSET_HH
9
10#include <memory>
11
12
13namespace Dune {
14
15namespace Functions {
16
17
25template<class GV, int cd>
27{
28public:
29
30 typedef GV GridView;
31 enum {
32 codim = cd
33 };
34
36 typedef typename GridView::template Codim<codim>::Entity Element;
37
39 typedef typename Element::Geometry::LocalCoordinate LocalCoordinate;
40 typedef typename Element::Geometry::GlobalCoordinate GlobalCoordinate;
41
42 typedef Element value_type;
43
45 typedef typename GridView::template Codim<codim>::Iterator const_iterator;
46
49
51 GridViewEntitySet(const GridView& gv) :
52 gv_(gv)
53 {}
54
56 bool contains(const Element& e) const
57 {
58 return gv_.contains(e);
59 }
60
62 size_t size() const
63 {
64 return gv_.size(codim);
65 }
66
69 {
70 return gv_.template begin<codim>();
71 }
72
75 {
76 return gv_.template end<codim>();
77 }
78
80 const GridView& gridView() const
81 {
82 return gv_;
83 }
84
85private:
86 GridView gv_;
87};
88
89
90} // end of namespace Dune::Functions
91} // end of namespace Dune
92
93#endif // DUNE_FUNCTIONS_GRIDFUNCTIONS_GRIDVIEWENTITYSET_HH
An entity set for all entities of given codim in a grid view.
Definition: gridviewentityset.hh:27
GridViewEntitySet(const GridView &gv)
Construct GridViewEntitySet for a GridView.
Definition: gridviewentityset.hh:51
GridView::template Codim< codim >::Entity Element
Type of Elements contained in this EntitySet.
Definition: gridviewentityset.hh:36
const_iterator end() const
Create an end iterator.
Definition: gridviewentityset.hh:74
const GridView & gridView() const
Return the associated GridView.
Definition: gridviewentityset.hh:80
const_iterator begin() const
Create a begin iterator.
Definition: gridviewentityset.hh:68
GridView::template Codim< codim >::Iterator const_iterator
A forward iterator.
Definition: gridviewentityset.hh:45
Element::Geometry::LocalCoordinate LocalCoordinate
Type of local coordinates with respect to the Element.
Definition: gridviewentityset.hh:39
size_t size() const
Return number of Elements visited by an iterator.
Definition: gridviewentityset.hh:62
bool contains(const Element &e) const
Return true if e is contained in the EntitySet.
Definition: gridviewentityset.hh:56
const_iterator iterator
Same as const_iterator.
Definition: gridviewentityset.hh:48
Grid view abstract base class.
Definition: gridview.hh:66
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 (Nov 24, 23:30, 2024)