DUNE PDELab (git)

sum.hh
1// -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=8 sw=2 sts=2:
3#ifndef DUNE_PDELAB_LOCALOPERATOR_SUM_HH
4#define DUNE_PDELAB_LOCALOPERATOR_SUM_HH
5
6#include <dune/pdelab/localoperator/combinedoperator.hh>
7
8#include <utility>
9
10
11namespace Dune {
12 namespace PDELab {
13
17
19
24 template<typename... Args>
26 public CombinedOperator<InstationarySumLocalOperator<Args...>, Args...>
27 {
28 template<typename F, typename... FArgs>
29 void applyLops(F && f, FArgs &... args) const
30 {
31 Hybrid::forEach(std::make_index_sequence<sizeof...(Args)>{},
32 [&](auto i){f(*Hybrid::elementAt(this->lops, i), args...);});
33 }
34
35 using Base = CombinedOperator<InstationarySumLocalOperator<Args...>, Args...>;
36 using ArgPtrs = typename Base::ArgPtrs;
37
38 friend Base;
39 public:
40
44 {}
45
49 : Base(lops...)
50 {}
51
55 : Base(std::forward<Args>(lops)...)
56 {}
57
58 protected:
59 InstationarySumLocalOperator(ArgPtrs&& lops)
60 : Base(std::forward<ArgPtrs>(lops))
61 { }
62
63 };
64
66
72 template<typename... Args>
73 class InstationarySumLocalOperator<std::tuple<Args...>> :
74 public InstationarySumLocalOperator<Args...>
75 {
76 using Base = InstationarySumLocalOperator<Args...>;
77 using ArgRefs = typename Base::ArgRefs;
78
79 public:
80
83 [[deprecated("The specialization InstationarySumLocalOperator<Tuple<...>> is"
84 "deprecated and will be removed after PDELab 2.7.")]]
86 {}
87
90 [[deprecated("The specialization InstationarySumLocalOperator<Tuple<...>> is"
91 "deprecated and will be removed after PDELab 2.7.")]]
92 InstationarySumLocalOperator(const ArgRefs& lops)
94 [](auto & l){return stackobject_to_shared_ptr(l);}))
95 { }
96 };
97
98 }
99}
100
101#endif // DUNE_PDELAB_LOCALOPERATOR_SUM_HH
A local operator to take combine different local operators.
Definition: combinedoperator.hh:30
A local operator to take the sum of other local operators.
Definition: sum.hh:27
constexpr void forEach(Range &&range, F &&f)
Range based for loop.
Definition: hybridutilities.hh:256
constexpr decltype(auto) elementAt(Container &&c, Index &&i)
Get element at given position from container.
Definition: hybridutilities.hh:126
InstationarySumLocalOperator()
Default-construct an InstationarySumLocalOperator. Expects the operators to be added later through th...
Definition: sum.hh:85
InstationarySumLocalOperator(const ArgRefs &lops)
construct a InstationarySumLocalOperator from a tuple of local operators
Definition: sum.hh:92
InstationarySumLocalOperator(Args &&... lops)
construct a InstationarySumLocalOperator from a set of local operators (rvalue reference)
Definition: sum.hh:54
InstationarySumLocalOperator(Args &... lops)
construct a InstationarySumLocalOperator from a set of local operators
Definition: sum.hh:48
InstationarySumLocalOperator()
Default-construct an InstationarySumLocalOperator. Expects the operators to be added later through th...
Definition: sum.hh:43
auto genericTransformTuple(Tuple &&t, Functor &&f) -> decltype(genericTransformTupleBackend(t, f))
Definition: tupleutility.hh:186
Dune namespace.
Definition: alignedallocator.hh:13
std::shared_ptr< T > stackobject_to_shared_ptr(T &t)
Create a shared_ptr for a stack-allocated object.
Definition: shared_ptr.hh:72
STL namespace.
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Nov 23, 23:29, 2024)