Go to the documentation of this file.
3 #ifndef DUNE_PDELAB_LOCALOPERATOR_COMBINEDOPERATOR_HH
4 #define DUNE_PDELAB_LOCALOPERATOR_COMBINEDOPERATOR_HH
9 #include <dune/common/tupleutility.hh>
10 #include <dune/common/typetraits.hh>
28 template<
typename ApplyOp,
typename... Args>
32 using ArgPtrs = std::tuple<std::shared_ptr<std::remove_reference_t<Args>>...>;
37 template<
typename... FArgs>
40 static_cast<const ApplyOp&
>(*this).applyLops(args...);
62 template<std::
size_t i>
63 void setSummand(
typename std::tuple_element_t<i,ArgRefs> summand)
64 { std::get<i>(
lops) = &summand; }
67 template<std::
size_t i>
69 {
return *std::get<i>(
lops); }
82 using OneSidedSkeleton = std::integral_constant
83 < bool, ( ( T::doAlphaSkeleton || T::doLambdaSkeleton) && ! T::doSkeletonTwoSided)>;
85 using TwoSidedSkeleton = std::integral_constant
86 < bool, ( ( T::doAlphaSkeleton || T::doLambdaSkeleton) && T::doSkeletonTwoSided)>;
92 std::disjunction_v<std::integral_constant<bool,Args::doPatternVolume>...> };
98 std::disjunction_v<std::integral_constant<bool,Args::doPatternVolumePostSkeleton>...> };
103 std::disjunction_v<std::integral_constant<bool,Args::doPatternSkeleton>...> };
108 std::disjunction_v<std::integral_constant<bool,Args::doPatternBoundary>...> };
115 std::disjunction_v<std::integral_constant<bool,Args::doAlphaVolume>...> };
121 std::disjunction_v<std::integral_constant<bool,Args::doAlphaVolumePostSkeleton>...> };
125 std::disjunction_v<std::integral_constant<bool,Args::doAlphaSkeleton>...> };
129 std::disjunction_v<std::integral_constant<bool,Args::doAlphaBoundary>...> };
133 std::disjunction_v<std::integral_constant<bool,Args::doLambdaVolume>...> };
137 std::disjunction_v<std::integral_constant<bool,Args::doLambdaVolumePostSkeleton>...> };
140 std::disjunction_v<std::integral_constant<bool,Args::doLambdaSkeleton>...> };
143 std::disjunction_v<std::integral_constant<bool,Args::doLambdaBoundary>...> };
147 std::disjunction_v<TwoSidedSkeleton<Args>...> };
148 static_assert(!(std::conjunction_v<OneSidedSkeleton<Args>...> &&
149 std::conjunction_v<TwoSidedSkeleton<Args>...>),
150 "Some summands require a one-sided skelton, others a "
151 "two-sided skeleton. This is not supported.");
154 enum {
isLinear = std::conjunction_v<std::integral_constant<bool,Args::isLinear>...> };
170 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
172 (
const LFSU& lfsu,
const LFSV& lfsv,
173 LocalPattern& pattern)
const
185 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
187 (
const LFSU& lfsu,
const LFSV& lfsv,
188 LocalPattern& pattern)
const
199 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
201 (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
202 const LFSU& lfsu_n,
const LFSV& lfsv_n,
203 LocalPattern& pattern_sn,
204 LocalPattern& pattern_ns)
const
207 lfsu_s, lfsv_s, lfsu_n, lfsv_n,
208 pattern_sn, pattern_ns);
217 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
219 (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
220 LocalPattern& pattern_ss)
const
238 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
242 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
254 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
258 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
269 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
273 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
274 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
275 R& r_s, R& r_n)
const
288 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
292 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
311 template<
typename EG,
typename LFSV,
typename R>
323 template<
typename EG,
typename LFSV,
typename R>
336 template<
typename IG,
typename LFSV,
typename R>
338 const LFSV& lfsv_s,
const LFSV& lfsv_n,
339 R& r_s, R& r_n)
const
349 template<
typename IG,
typename LFSV,
typename R>
368 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
372 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
384 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
388 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
399 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
403 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
404 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
405 Y& y_s, Y& y_n)
const
418 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
422 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
441 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
445 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
456 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
460 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
471 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
475 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
476 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
483 mat_ss, mat_sn, mat_ns, mat_nn);
491 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
495 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
510 typedef typename std::tuple_element<0, std::tuple<Args...>>::type::RealType
RealType;
517 template<
typename LOP>
523 template<
typename LOP>
527 lop.preStep(time, dt, stages);
530 template<
typename LOP>
536 template<
typename LOP>
539 lop.preStage(time, r);
542 template<
typename LOP>
548 template<
typename LOP>
551 dt = std::min(dt,lop.suggestTimestep(dt));
565 return get<0>(
lops)->getTime();
571 applyLops(Apply::preStep, time, dt, stages);
589 return get<0>(
lops)->getStage();
616 #endif // DUNE_PDELAB_LOCALOPERATOR_COMBINEDOPERATOR_HH
static void postStep(const LOP &lop)
Definition: combinedoperator.hh:531
@ doPatternBoundary
Definition: combinedoperator.hh:107
void setSummand(typename std::tuple_element_t< i, ArgRefs > summand)
set the i'th component of the sum
Definition: combinedoperator.hh:63
@ doSkeletonTwoSided
Definition: combinedoperator.hh:146
auto patternVolume
Definition: callswitch.hh:348
CombinedOperator(ArgPtrs &&l)
Definition: combinedoperator.hh:58
void jacobian_skeleton(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const X &x_n, const LFSV &lfsv_n, LocalMatrix &mat_ss, LocalMatrix &mat_sn, LocalMatrix &mat_ns, LocalMatrix &mat_nn) const
apply an internal intersections's jacobians
Definition: combinedoperator.hh:474
void pattern_boundary(const LFSU &lfsu_s, const LFSV &lfsv_s, LocalPattern &pattern_ss) const
get a boundary intersection's contribution to the sparsity pattern
Definition: combinedoperator.hh:219
@ isLinear
Definition: combinedoperator.hh:154
CombinedOperator(Args &&... args)
Definition: combinedoperator.hh:54
auto alphaVolumePostSkeleton
Definition: callswitch.hh:384
void jacobian_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, LocalMatrix &mat) const
get an element's jacobian
Definition: combinedoperator.hh:444
CombinedOperator()
Definition: combinedoperator.hh:50
void jacobian_apply_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, Y &y) const
apply an element's jacobian after the intersections have been handled
Definition: combinedoperator.hh:387
void jacobian_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, LocalMatrix &mat) const
get an element's jacobian after the intersections have been handled
Definition: combinedoperator.hh:459
void alpha_skeleton(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const X &x_n, const LFSV &lfsv_n, R &r_s, R &r_n) const
get an internal intersections's contribution to alpha
Definition: combinedoperator.hh:272
@ doAlphaSkeleton
Definition: combinedoperator.hh:124
@ doLambdaBoundary
Definition: combinedoperator.hh:142
std::tuple< Args &... > ArgRefs
Definition: combinedoperator.hh:33
void lambda_skeleton(const IG &ig, const LFSV &lfsv_s, const LFSV &lfsv_n, R &r_s, R &r_n) const
get an internal intersections's contribution to lambda
Definition: combinedoperator.hh:337
@ doAlphaVolumePostSkeleton
Definition: combinedoperator.hh:120
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
RealType suggestTimestep(RealType dt) const
to be called after stage 1
Definition: combinedoperator.hh:604
CombinedOperator(Args &... args)
Definition: combinedoperator.hh:52
auto jacobianVolume
Definition: callswitch.hh:437
void pattern_skeleton(const LFSU &lfsu_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const LFSV &lfsv_n, LocalPattern &pattern_sn, LocalPattern &pattern_ns) const
get an internal intersection's contribution to the sparsity pattern
Definition: combinedoperator.hh:201
auto jacobianApplyVolumePostSkeleton
Definition: callswitch.hh:474
static void preStage(const LOP &lop, RealType time, int r)
Definition: combinedoperator.hh:537
void preStage(RealType time, int r)
to be called once before each stage
Definition: combinedoperator.hh:581
static void postStage(const LOP &lop)
Definition: combinedoperator.hh:543
void setTime(RealType t)
set time for subsequent evaluation
Definition: combinedoperator.hh:557
@ doLambdaVolumePostSkeleton
Definition: combinedoperator.hh:136
@ doPatternVolume
Definition: combinedoperator.hh:91
static void preStep(const LOP &lop, RealType time, RealType dt, int stages)
Definition: combinedoperator.hh:524
auto patternBoundary
Definition: callswitch.hh:369
auto jacobianApplyBoundary
Definition: callswitch.hh:488
void pattern_volume_post_skeleton(const LFSU &lfsu, const LFSV &lfsv, LocalPattern &pattern) const
get an element's contribution to the sparsity pattern after the intersections have been handled
Definition: combinedoperator.hh:187
@ doAlphaVolume
Definition: combinedoperator.hh:114
@ doPatternVolumePostSkeleton
Definition: combinedoperator.hh:97
auto jacobianApplyVolume
Definition: callswitch.hh:467
@ doLambdaSkeleton
Definition: combinedoperator.hh:139
void alpha_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
get an element's contribution to alpha after the intersections have been handled
Definition: combinedoperator.hh:257
void postStep()
to be called once at the end of each time step
Definition: combinedoperator.hh:575
@ doLambdaVolume
Definition: combinedoperator.hh:132
ArgPtrs lops
Definition: combinedoperator.hh:35
auto patternSkeleton
Definition: callswitch.hh:362
A local operator to take combine different local operators.
Definition: combinedoperator.hh:29
auto jacobianApplySkeleton
Definition: callswitch.hh:481
void postStage()
to be called once at the end of each stage
Definition: combinedoperator.hh:593
auto patternVolumePostSkeleton
Definition: callswitch.hh:355
void alpha_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
get an element's contribution to alpha
Definition: combinedoperator.hh:241
void pattern_volume(const LFSU &lfsu, const LFSV &lfsv, LocalPattern &pattern) const
get an element's contribution to the sparsity pattern
Definition: combinedoperator.hh:172
void lambda_boundary(const IG &ig, const LFSV &lfsv_s, R &r_s) const
get a boundary intersections's contribution to lambda
Definition: combinedoperator.hh:350
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition: localmatrix.hh:183
void lambda_volume(const EG &eg, const LFSV &lfsv, R &r) const
get an element's contribution to lambda
Definition: combinedoperator.hh:312
auto alphaVolume
Definition: callswitch.hh:377
int getStage() const
get current stage
Definition: combinedoperator.hh:587
void lambda_volume_post_skeleton(const EG &eg, const LFSV &lfsv, R &r) const
get an element's contribution to lambda after the intersections have been handled
Definition: combinedoperator.hh:324
auto lambdaSkeleton
Definition: callswitch.hh:421
auto jacobianVolumePostSkeleton
Definition: callswitch.hh:444
auto alphaSkeleton
Definition: callswitch.hh:391
void applyLops(FArgs &... args) const
Definition: combinedoperator.hh:38
auto lambdaVolume
Definition: callswitch.hh:407
void alpha_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, R &r_s) const
get a boundary intersections's contribution to alpha
Definition: combinedoperator.hh:291
auto jacobianBoundary
Definition: callswitch.hh:458
RealType getTime() const
get current time
Definition: combinedoperator.hh:563
std::tuple_element_t< i, ArgRefs > getSummand()
get the i'th component of the sum
Definition: combinedoperator.hh:68
const IG & ig
Definition: constraints.hh:149
void jacobian_apply_skeleton(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, const LFSU &lfsu_n, const X &x_n, const LFSV &lfsv_n, Y &y_s, Y &y_n) const
apply an internal intersections's jacobians
Definition: combinedoperator.hh:402
void jacobian_apply_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, Y &y) const
apply an element's jacobian
Definition: combinedoperator.hh:371
static RealType suggestTimestep(const LOP &lop, RealType &dt)
Definition: combinedoperator.hh:549
void jacobian_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, LocalMatrix &mat_ss) const
get a boundary intersections's jacobian
Definition: combinedoperator.hh:494
std::tuple< std::shared_ptr< std::remove_reference_t< Args > >... > ArgPtrs
Definition: combinedoperator.hh:32
auto lambdaBoundary
Definition: callswitch.hh:428
@ doPatternSkeleton
Definition: combinedoperator.hh:102
void jacobian_apply_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, Y &y_s) const
apply a boundary intersections's jacobian
Definition: combinedoperator.hh:421
@ doAlphaBoundary
Definition: combinedoperator.hh:128
std::tuple_element< 0, std::tuple< Args... > >::type::RealType RealType
Export type used for time values.
Definition: combinedoperator.hh:510
auto jacobianSkeleton
Definition: callswitch.hh:451
auto lambdaVolumePostSkeleton
Definition: callswitch.hh:414
static void setTime(const LOP &lop, RealType t)
Definition: combinedoperator.hh:518
void preStep(RealType time, RealType dt, int stages)
to be called once before each time step
Definition: combinedoperator.hh:569