3#ifndef DUNE_PDELAB_LOCALOPERATOR_BLOCKOFFDIAGONALWRAPPER_HH
4#define DUNE_PDELAB_LOCALOPERATOR_BLOCKOFFDIAGONALWRAPPER_HH
6#include <dune/pdelab/common/intersectiontype.hh>
7#include <dune/pdelab/localoperator/blockdiagonalwrapper.hh>
14 template <
typename View>
18 using Container =
typename View::Container;
19 using ElementType =
typename View::value_type;
20 using SizeType =
typename View::size_type;
34 ZeroViewWrapper(
const View& view,
bool zero)
35 : _view(view), _zero(zero), _zeroCoefficient(0.0)
38 template <
typename LFS>
39 const ElementType& operator()(
const LFS& lfs, SizeType i)
const
42 return _zeroCoefficient;
44 return _view.container()(lfs, i);
50 ElementType _zeroCoefficient;
54 template <
typename Container,
typename LocalFunctionSpaceCache>
55 class ZeroViewWrapper<AliasedVectorView<Container, LocalFunctionSpaceCache>>
58 using View = ConstAliasedVectorView<Container, LocalFunctionSpaceCache>;
59 using ElementType =
typename View::ElementType;
60 using SizeType =
typename View::size_type;
62 ZeroViewWrapper(
const View& view,
bool zero)
63 : _view(view), _zero(zero), _zeroCoefficient(0.0)
66 template <
typename LFS>
67 const ElementType& operator()(
const LFS& lfs, SizeType i)
const
70 return _zeroCoefficient;
75 const ElementType* data()
const
82 DUNE_THROW(
Dune::Exception,
"So far the ZeroViewWrapper does not support fast DG local operators using the data() method to access coefficients. .");
88 ElementType _zeroCoefficient;
109 template <
typename LocalOperator>
116 static constexpr bool doPatternSkeleton =
true;
119 static constexpr bool doAlphaSkeleton = LocalOperator::doAlphaSkeleton;
122 static constexpr bool isLinear = LocalOperator::isLinear;
129 static constexpr bool doSkeletonTwoSided =
true;
136 : _localOperator(localOperator)
141 : _localOperator(other._localOperator)
145 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
146 void pattern_skeleton (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
const LFSU& lfsu_n,
const LFSV& lfsv_n,
147 LocalPattern& pattern_sn,
148 LocalPattern& pattern_ns)
const
150 _localOperator.pattern_skeleton (lfsu_s, lfsv_s, lfsu_n, lfsv_n, pattern_sn, pattern_ns);
153 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
typename MAT>
154 void jacobian_skeleton (
const IG& ig,
155 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
156 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
157 MAT& mat_ss, MAT& mat_sn,
158 MAT& mat_ns, MAT& mat_nn)
const
164 impl::BlockDiagonalAccumulationViewWrapper<MAT> view_ns(mat_ns,
true);
165 impl::BlockDiagonalAccumulationViewWrapper<MAT> view_other(mat_ns,
false);
166 _localOperator.jacobian_skeleton(ig, lfsu_s, x_s, lfsv_s, lfsu_n, x_n, lfsv_n, view_other, view_other, view_ns, view_other);
169 template<
typename IG,
typename LFSU,
typename Z,
typename LFSV,
typename Y>
170 void jacobian_apply_skeleton(
const IG& ig,
171 const LFSU& lfsu_s,
const Z& z_s,
const LFSV& lfsv_s,
172 const LFSU& lfsu_n,
const Z& z_n,
const LFSV& lfsv_n,
173 Y& y_s, Y& y_n)
const
191 impl::ZeroViewWrapper<Z> z_zero(z_s,
true);
192 impl::ZeroViewWrapper<Z> z_neigh(z_n,
false);
195 impl::BlockDiagonalAccumulationViewWrapper<Y> view_s_on(y_s,
true);
196 impl::BlockDiagonalAccumulationViewWrapper<Y> view_n_off(y_n,
false);
199 Dune::PDELab::impl::jacobianApplySkeleton(_localOperator, ig, lfsu_s, z_zero, lfsv_s, lfsu_n, z_neigh, lfsv_n, view_s_on, view_n_off);
202 template<
typename IG,
typename LFSU,
typename X,
typename Z,
typename LFSV,
typename Y>
203 void jacobian_apply_skeleton(
const IG& ig,
204 const LFSU& lfsu_s,
const X& x_s,
const Z& z_s,
const LFSV& lfsv_s,
205 const LFSU& lfsu_n,
const X& x_n,
const Z& z_n,
const LFSV& lfsv_n,
206 Y& y_s, Y& y_n)
const
224 impl::ZeroViewWrapper<Z> z_zero(z_s,
true);
225 impl::ZeroViewWrapper<Z> z_neigh(z_n,
false);
228 impl::BlockDiagonalAccumulationViewWrapper<Y> view_s_on(y_s,
true);
229 impl::BlockDiagonalAccumulationViewWrapper<Y> view_n_off(y_n,
false);
232 Dune::PDELab::impl::jacobianApplySkeleton(_localOperator, ig, lfsu_s, x_s, z_zero, lfsv_s, lfsu_n, x_n, z_neigh, lfsv_n, view_s_on, view_n_off);
237 const LocalOperator& _localOperator;
Base class for Dune-Exceptions.
Definition: exceptions.hh:96
A local operator that accumulates the off block diagonal.
Definition: blockoffdiagonalwrapper.hh:112
BlockOffDiagonalLocalOperatorWrapper(const LocalOperator &localOperator)
Construct new instance of class.
Definition: blockoffdiagonalwrapper.hh:135
BlockOffDiagonalLocalOperatorWrapper(const BlockOffDiagonalLocalOperatorWrapper &other)
Copy constructor.
Definition: blockoffdiagonalwrapper.hh:140
Default flags for all local operators.
Definition: flags.hh:19
#define DUNE_THROW(E, m)
Definition: exceptions.hh:218
Dune namespace.
Definition: alignedallocator.hh:13