3#ifndef DUNE_PDELAB_LOCALOPERATOR_POINTDIAGONALWRAPPER_HH
4#define DUNE_PDELAB_LOCALOPERATOR_POINTDIAGONALWRAPPER_HH
13 template <
typename AccumulationView>
14 class PointDiagonalAccumulationViewWrapper
17 PointDiagonalAccumulationViewWrapper(AccumulationView& view,
bool diagonal)
18 : _view(view), _diagonal(diagonal)
21 template <
typename LFSU,
typename I,
typename LFSV,
typename J,
typename Value>
22 void accumulate(
const LFSU& lfsu, I i,
const LFSV& lfsv, J j, Value value)
24 if (_diagonal && i == j){
25 _view.accumulate(lfsu, i, value);
30 AccumulationView& _view;
51 template <
class LocalOperator>
58 static constexpr bool doPatternVolume =
true;
62 static constexpr bool doAlphaVolume = LocalOperator::doAlphaVolume;
63 static constexpr bool doAlphaSkeleton = LocalOperator::doAlphaSkeleton;
64 static constexpr bool doAlphaBoundary = LocalOperator::doAlphaBoundary;
67 static constexpr bool isLinear = LocalOperator::isLinear;
74 static constexpr bool doSkeletonTwoSided =
true;
81 : _localOperator(localOperator)
87 : _localOperator(other._localOperator)
91 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
92 void pattern_volume (
const LFSU& lfsu,
const LFSV& lfsv,
93 LocalPattern& pattern)
const
95 _localOperator.pattern_volume(lfsu, lfsv, pattern);
98 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename R>
99 void alpha_volume (
const EG& eg,
const LFSU& lfsu,
const X& x,
const LFSV& lfsv, R& r)
const
101 impl::PointDiagonalAccumulationViewWrapper<R> view(r,
true);
102 _localOperator.jacobian_volume(eg, lfsu, x, lfsv, view);
105 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
106 void alpha_skeleton (
const IG& ig,
107 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
108 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
109 R& r_s, R& r_n)
const
111 impl::PointDiagonalAccumulationViewWrapper<R> view_ss(r_s,
true);
112 impl::PointDiagonalAccumulationViewWrapper<R> view_other(r_s,
false);
113 _localOperator.jacobian_skeleton(ig,
116 view_ss, view_other, view_other, view_other);
119 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename R>
120 void alpha_boundary (
const IG& ig,
121 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
124 impl::PointDiagonalAccumulationViewWrapper<R> view(r_s,
true);
125 _localOperator.jacobian_boundary(ig, lfsu_s, x_s, lfsv_s, view);
130 const LocalOperator& _localOperator;
138 template <
typename LocalOperator,
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename Y>
139 void assembleLocalPointDiagonal(
const LocalOperator& localOperator,
147 localOperator.alpha_volume(eg, lfsu, x, lfsv, y);
150 auto entitySet = lfsu.gridFunctionSpace().entitySet();
151 std::size_t intersectionIndex = 0;
152 for (
const auto& is : intersections(lfsu.gridFunctionSpace().gridView(), eg.entity()))
155 typename std::remove_reference<
156 typename std::remove_const<
160 > ig(is, intersectionIndex++);
161 auto intersectionData = classifyIntersection(entitySet, is);
162 auto intersectionType = std::get<0>(intersectionData);
165 switch (intersectionType){
166 case Dune::PDELab::IntersectionType::skeleton:
167 localOperator.alpha_skeleton(ig, lfsu, x, lfsv, lfsu, x, lfsv, y, y);
169 case Dune::PDELab::IntersectionType::boundary:
170 localOperator.alpha_boundary(ig, lfsu, x, lfsv, y);
Wrap intersection.
Definition: geometrywrapper.hh:57
Default flags for all local operators.
Definition: flags.hh:19
A local operator that accumulates the point diagonal.
Definition: pointdiagonalwrapper.hh:54
PointDiagonalLocalOperatorWrapper(const LocalOperator &localOperator)
Construct new instance of class.
Definition: pointdiagonalwrapper.hh:80
PointDiagonalLocalOperatorWrapper(const PointDiagonalLocalOperatorWrapper &other)
Copy constructor.
Definition: pointdiagonalwrapper.hh:86
constexpr T accumulate(Range &&range, T value, F &&f)
Accumulate values.
Definition: hybridutilities.hh:279
Dune namespace.
Definition: alignedallocator.hh:13