DUNE-FEM (unstable)

grid.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_CONCEPTS_GRID_HH
6#define DUNE_GRID_CONCEPTS_GRID_HH
7
8#include <concepts>
9#include <cstddef>
10#include <type_traits>
11#include <utility>
12
13#include <dune/common/indices.hh>
14#include <dune/geometry/type.hh>
15#include <dune/grid/common/gridenums.hh>
17#include <dune/grid/concepts/entity.hh>
18#include <dune/grid/concepts/entityiterator.hh>
19#include <dune/grid/concepts/geometry.hh>
20#include <dune/grid/concepts/gridview.hh>
21#include <dune/grid/concepts/indexidset.hh>
22#include <dune/grid/concepts/intersection.hh>
23#include <dune/grid/concepts/intersectioniterator.hh>
24#include <dune/grid/concepts/archetypes/datahandle.hh>
25
26
35namespace Dune::Concept {
36namespace Impl {
37
38 template<class G, int codim, Dune::PartitionIteratorType partition>
39 concept GridCodimPartition =
40 EntityIterator<typename G::template Codim<codim>::template Partition<partition>::LevelIterator> &&
41 EntityIterator<typename G::template Codim<codim>::template Partition<partition>::LeafIterator>;
42
43 template<class G, int codim>
44 concept GridCodimAllPartitions =
45 GridCodimPartition<G,codim,Dune::PartitionIteratorType::Interior_Partition> &&
46 GridCodimPartition<G,codim,Dune::PartitionIteratorType::InteriorBorder_Partition> &&
47 GridCodimPartition<G,codim,Dune::PartitionIteratorType::Overlap_Partition> &&
48 GridCodimPartition<G,codim,Dune::PartitionIteratorType::OverlapFront_Partition> &&
49 GridCodimPartition<G,codim,Dune::PartitionIteratorType::All_Partition> &&
50 GridCodimPartition<G,codim,Dune::PartitionIteratorType::Ghost_Partition>;
51
52 template<class G, int codim>
53 concept GridCodim =
55 Geometry<typename G::template Codim<codim>::LocalGeometry> &&
56 Entity<typename G::template Codim<codim>::Entity> &&
58 requires(const G cg, const typename G::template Codim<codim>::EntitySeed& seed)
59 {
60 { cg.entity(seed) } -> std::convertible_to<typename G::template Codim<codim>::Entity>;
61
63 requires(G g, Archetypes::CommDataHandle<std::byte>& handle)
64 {
65 { g.loadBalance(handle) } -> std::convertible_to<bool>;
66 };
67 } && GridCodimAllPartitions<G,codim>;
68
69 template<class G, std::size_t... c>
70 void gridAllCodims(std::index_sequence<c...>)
71 requires (GridCodim<G,int(c)> &&...);
72
73} // end namespace Impl
74
75
97template<class G>
98concept Grid =
109requires(const G cg, int level, int codim, Dune::GeometryType type)
110{
111 // static constants
112 { G::dimension } -> std::convertible_to<int>;
113 { G::dimensionworld } -> std::convertible_to<int>;
114
115 // type and concepts requirements
116 requires std::same_as<G,typename G::LeafGridView::Grid>;
117 requires std::same_as<G,typename G::LevelGridView::Grid>;
118 typename G::ctype;
119 typename G::HierarchicIterator;
120
121 // const methods
122 { cg.maxLevel() } -> std::convertible_to<int>;
123 { cg.size(level, codim) } -> std::convertible_to<int>;
124 { cg.size(codim) } -> std::convertible_to<int>;
125 { cg.size(level, type) } -> std::convertible_to<int>;
126 { cg.size(type) } -> std::convertible_to<int>;
127 { cg.numBoundarySegments() } -> std::convertible_to<std::size_t>;
128 { cg.levelGridView(level) } -> std::same_as<typename G::LevelGridView>;
129 { cg.leafGridView() } -> std::same_as<typename G::LeafGridView>;
130 { cg.globalIdSet() } -> std::same_as<const typename G::GlobalIdSet&>;
131 { cg.localIdSet() } -> std::same_as<const typename G::LocalIdSet&>;
132 { cg.levelIndexSet(level) } -> std::same_as<const typename G::LevelIndexSet&>;
133 { cg.leafIndexSet() } -> std::same_as<const typename G::LeafIndexSet&>;
134 { cg.comm() } -> std::convertible_to<typename G::Communication>;
135
136 // mutable methods
137 requires requires(G g, int refCount, const typename G::template Codim<0>::Entity& entity)
138 {
139 { g.mark(refCount,entity) } -> std::convertible_to<bool>;
140 { g.getMark(entity) } -> std::convertible_to<int>;
141 { g.preAdapt() } -> std::convertible_to<bool>;
142 { g.adapt() } -> std::convertible_to<bool>;
143 { g.loadBalance() } -> std::convertible_to<bool>;
144 g.globalRefine(refCount);
145 g.postAdapt();
146 };
147} &&
148Impl::GridCodim<G,0> &&
150 Impl::gridAllCodims<G>(range(from, to).to_integer_sequence());
151};
152
153} // end namespace Dune::Concept
154
155#endif // DUNE_GRID_CONCEPTS_GRID_HH
EntitySeed()
Construct an empty (i.e. isValid() == false) seed.
Definition: entityseed.hh:40
Unique label for each type of entities that can occur in DUNE grids.
Definition: type.hh:114
Geometry(const Implementation &impl)
copy constructor from implementation
Definition: geometry.hh:384
Model of a grid view.
Definition: gridview.hh:81
Requirements for implementations of the Dune::Grid interface.
Definition: grid.hh:98
Model of an id set.
Definition: indexidset.hh:83
Model of an index set.
Definition: indexidset.hh:44
Model of an intersection iterator.
Definition: intersectioniterator.hh:21
Model of an intersection.
Definition: intersection.hh:23
A set of traits classes to store static information about grid implementation.
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
specialize with 'true' for all codims that a grid can communicate data on (default=false)
Definition: capabilities.hh:97
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 13, 23:29, 2024)