13#ifndef DUMUX_COMMON_DEPRECATED_HH
14#define DUMUX_COMMON_DEPRECATED_HH
20#include <dune/common/ftraits.hh>
21#include <dune/common/exceptions.hh>
22#include <dune/common/std/type_traits.hh>
37#pragma clang diagnostic push
38#pragma clang diagnostic ignored "-Wdeprecated-declarations"
42#pragma clang diagnostic pop
47template<
class GG,
class GI>
48concept hasRangeOfPeriodicallyMappedDofs =
requires (GG gg, GI gi) {
49 { gg.periodicallyMappedDofs(gi) } -> std::ranges::range;
55[[deprecated(
"The periodicDofMap with values of single periodic dofs will not be supported after release 3.11. Use/define in custom grid geometry a periodicDofMap with a range of dofs as value type, as well as accessor periodicallyMappedDofs returning a std::views::all/single of the storage if possible")]]
56inline const std::ranges::range
auto wrapSinglePeriodicDof(
const Dof& dof)
58 return std::ranges::views::single(dof);
63template<
class T>
requires std::ranges::range<T>
64inline std::ranges::range
auto ensureRangeOfPeriodicDofs(T&& range)
66 if constexpr (std::is_lvalue_reference_v<T> || std::ranges::view<std::remove_cvref_t<T>>)
67 return std::views::all(std::forward<T>(range));
69 return std::remove_cvref_t<T>(std::forward<T>(range));
72template<
typename T>
requires (!std::ranges::range<T>)
73inline const std::ranges::range
auto ensureRangeOfPeriodicDofs(
const T& entry)
74{
return wrapSinglePeriodicDof(entry); }
78template<
class GG,
class GI>
79inline const std::ranges::range
auto rangeOfPeriodicallyMappedDofs(
const GG& gg,
const GI& gi)
81 if constexpr (hasRangeOfPeriodicallyMappedDofs<GG, GI>)
82 return ensureRangeOfPeriodicDofs(gg.periodicallyMappedDofs(gi));
84 return wrapSinglePeriodicDof(gg.periodicallyMappedDof(gi));
A helper to deduce a vector with the same size as numbers of equations.