DUNE-FEM (unstable)

entity.hh
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_GRID_CONCEPT_ENTITY_HH
6#define DUNE_GRID_CONCEPT_ENTITY_HH
7
8#include <concepts>
9#include <utility>
10
12#include <dune/geometry/type.hh>
13#include <dune/grid/common/gridenums.hh>
14#include <dune/grid/concepts/geometry.hh>
15#include <dune/grid/concepts/archetypes/entity.hh>
16
17namespace Dune::Concept {
18
24template<class S>
25concept EntitySeed = std::semiregular<S> && requires(const S seed)
26{
27 { S::codimension } -> std::convertible_to<int>;
28 { seed.isValid() } -> std::convertible_to<bool>;
29};
30
32
33
39template<class E>
40concept EntityGeneral = std::regular<E> &&
43requires(const E e, unsigned int codim)
44{
45 requires E::mydimension == (E::dimension - E::codimension);
46 { e.level() } -> std::convertible_to<int>;
47 { e.partitionType() } -> std::same_as<Dune::PartitionType>;
48 { e.geometry() } -> std::same_as<typename E::Geometry>;
49 { e.type() } -> std::same_as<Dune::GeometryType>;
50 { e.subEntities(codim) } -> std::convertible_to<unsigned int>;
51 { e.seed() } -> std::same_as<typename E::EntitySeed>;
52};
53
55
56
57namespace Impl {
58
59 template<class E, int codim>
60 concept EntityCodimExtended = requires(const E e, int subEntity)
61 {
62 { e.template subEntity<codim>(subEntity) } -> EntityGeneral;
63 };
64
65 template<typename E, std::size_t... c>
66 void entityAllCodimsExtended(std::integer_sequence<std::size_t,c...>)
67 requires (EntityCodimExtended<E,int(c)> &&...);
68
69} // end namespace Impl
70
76template<class E>
79requires(const E e, int maxLevel)
80{
81 requires (E::codimension == 0);
82 { e.father() } -> std::same_as<E>;
83 { e.hasFather() } -> std::convertible_to<bool>;
84 { e.isLeaf() } -> std::convertible_to<bool>;
85 { e.isRegular() } -> std::convertible_to<bool>;
86 { e.geometryInFather() } -> std::same_as<typename E::LocalGeometry>;
87 { e.hbegin(maxLevel) } -> std::same_as<typename E::HierarchicIterator>;
88 { e.hend(maxLevel) } -> std::same_as<typename E::HierarchicIterator>;
89 { e.isNew() } -> std::convertible_to<bool>;
90 { e.mightVanish() } -> std::convertible_to<bool>;
91 { e.hasBoundaryIntersections() } -> std::convertible_to<bool>;
92
93 requires std::same_as<E, typename E::template Codim<0>::Entity>;
94} &&
95Impl::EntityCodimExtended<E,0> &&
97 Impl::entityAllCodimsExtended<E>(range(from, to).to_integer_sequence());
98};
99
106template<class E>
107concept Entity = EntityGeneral<E> && ((E::codimension != 0) || EntityExtended<E>);
108
109} // end namespace Dune::Concept
110
111
112#endif // DUNE_GRID_CONCEPT_ENTITY_HH
Model of a grid entity with extended requirements for codimension 0.
Definition: entity.hh:77
Model of a grid entity for any codimension.
Definition: entity.hh:40
Model of an entity seed.
Definition: entity.hh:25
Model of a grid entity.
Definition: entity.hh:107
Model of a geometry object.
Definition: geometry.hh:29
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition: indices.hh:29
Namespace for concepts.
Definition: concept.hh:34
Utilities for reduction like operations on ranges.
A unique label for each type of element that can occur in a grid.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)