DUNE PDELab (git)

gridview.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_GRIDVIEW_HH
6#define DUNE_GRID_CONCEPTS_GRIDVIEW_HH
7
8#include <concepts>
9#include <cstddef>
10#include <utility>
11
13#include <dune/grid/common/gridenums.hh>
14#include <dune/grid/concepts/entityiterator.hh>
15#include <dune/grid/concepts/geometry.hh>
16#include <dune/grid/concepts/indexidset.hh>
17#include <dune/grid/concepts/intersection.hh>
18#include <dune/grid/concepts/intersectioniterator.hh>
19#include <dune/grid/concepts/archetypes/datahandle.hh>
20
21namespace Dune::Concept {
22namespace Impl {
23
24 template<class GV, int codim, Dune::PartitionIteratorType partition>
25 concept GridViewPartition =
26 EntityIterator<typename GV::template Codim<codim>::template Partition<partition>::Iterator> &&
27 requires(const GV gv)
28 {
29 { gv.template begin<codim,partition>() } -> std::same_as<typename GV::template Codim<codim>::template Partition<partition>::Iterator>;
30 { gv.template end<codim,partition>() } -> std::same_as<typename GV::template Codim<codim>::template Partition<partition>::Iterator>;
31 };
32
33 template<class GV, int codim>
34 concept GridViewAllPartitions =
35 GridViewPartition<GV,codim,Dune::PartitionIteratorType::InteriorBorder_Partition> &&
36 GridViewPartition<GV,codim,Dune::PartitionIteratorType::Overlap_Partition> &&
37 GridViewPartition<GV,codim,Dune::PartitionIteratorType::OverlapFront_Partition> &&
38 GridViewPartition<GV,codim,Dune::PartitionIteratorType::All_Partition> &&
39 GridViewPartition<GV,codim,Dune::PartitionIteratorType::Ghost_Partition>;
40
41 template<class GV, int codim>
42 concept GridViewCodim =
44 Geometry<typename GV::template Codim<codim>::LocalGeometry> &&
45 EntityIterator<typename GV::template Codim<codim>::Iterator> &&
46 requires(const GV gv)
47 {
48 { gv.template begin<codim>() } -> std::same_as<typename GV::template Codim<codim>::Iterator>;
49 { gv.template end<codim>() } -> std::same_as<typename GV::template Codim<codim>::Iterator>;
50
51 requires (codim != 0) || requires(const typename GV::template Codim<codim>::Entity& entity)
52 {
53 { gv.ibegin(entity) } -> std::same_as<typename GV::IntersectionIterator>;
54 { gv.iend(entity) } -> std::same_as<typename GV::IntersectionIterator>;
55 };
56 } && GridViewAllPartitions<GV,codim>;
57
58 template<class GV, class Grid, int codim>
60 void requireGridViewCodim()
61 requires GridViewCodim<GV,codim> {}
62
63 template<class GV, class Grid, int codim>
65 void requireGridViewCodim() {}
66
67 template <class GV, std::size_t... c>
68 void gridViewAllCodims(std::index_sequence<c...>)
69 requires requires {
70 (requireGridViewCodim<GV,typename GV::Grid,int(c)>(),...);
71 };
72
73} // end namespace Impl
74
80template<class GV>
81concept GridView = std::copyable<GV> &&
85requires(const GV gv, int codim, Dune::GeometryType type)
86{
87 typename GV::Traits;
88 typename GV::ctype;
89 { GV::conforming } -> std::convertible_to<bool>;
90 { GV::dimension } -> std::convertible_to<int>;
91 { GV::dimensionworld } -> std::convertible_to<int>;
92 { gv.grid() } -> std::same_as<const typename GV::Grid&>;
93 { gv.indexSet() } -> std::same_as<const typename GV::IndexSet&>;
94 { gv.size(codim) } -> std::convertible_to<int>;
95 { gv.size(type) } -> std::convertible_to<int>;
96 { gv.comm() } -> std::convertible_to<typename GV::Communication>;
97 { gv.overlapSize(codim) } -> std::convertible_to<int>;
98 { gv.ghostSize(codim) } -> std::convertible_to<int>;
99
100 requires requires(Archetypes::CommDataHandle<std::byte>& handle,
102 {
103 gv.communicate(handle, iface, dir);
104 };
105} &&
106Impl::GridViewCodim<GV,0> &&
108 Impl::gridViewAllCodims<GV>(range(from, to).to_integer_sequence());
109};
110
111} // end namespace Dune::Concept
112
113#endif // DUNE_GRID_CONCEPTS_GRIDVIEW_HH
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
A set of traits classes to store static information about grid implementation.
Model of a grid view.
Definition: gridview.hh:81
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
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition: indices.hh:29
CommunicationDirection
Define a type for communication direction parameter.
Definition: gridenums.hh:170
InterfaceType
Parameter to be used for the communication functions.
Definition: gridenums.hh:86
Namespace for concepts.
Definition: concept.hh:34
specialize with 'true' for all codims that a grid provides an iterator for (default=hasEntity<codim>:...
Definition: capabilities.hh:74
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 12, 23:30, 2024)