3 #ifndef DUNE_PDELAB_LOCALOPERATOR_WEIGHTEDSUM_HH
4 #define DUNE_PDELAB_LOCALOPERATOR_WEIGHTEDSUM_HH
8 #include <dune/common/forloop.hh>
9 #include <dune/common/fvector.hh>
10 #include <dune/common/static_assert.hh>
11 #include <dune/common/tuples.hh>
12 #include <dune/common/tupleutility.hh>
13 #include <dune/common/typetraits.hh>
37 template<
typename K,
typename Args>
42 typedef typename ForEachType<AddPtrTypeEvaluator, Args>::Type ArgPtrs;
43 typedef typename ForEachType<AddRefTypeEvaluator, Args>::Type ArgRefs;
46 typedef FieldVector<K, size> Weights;
62 (
const Weights& weights_ = Weights(1))
68 (
const ArgRefs& lops_,
69 const Weights& weights_ = Weights(1))
70 : lops(transformTuple<AddPtrTypeEvaluator>(lops_)), weights(weights_)
74 template<std::
size_t i>
75 void setSummand(
typename tuple_element<i,Args>::type& summand)
76 { get<i>(lops) = &summand; }
79 template<std::
size_t i>
81 {
return *get<i>(lops); }
89 {
return weights[i]; }
100 template<
typename T1,
typename T2>
102 :
public integral_constant<bool, T1::value || T2:: value>
104 template<
template<
int>
class Value>
105 struct AccFlag :
public GenericForLoop<OrOperation, Value, 0, size-1>
109 struct PatternVolumeValue :
public integral_constant
110 < bool, tuple_element<i, Args>::type::doPatternVolume>
113 struct PatternVolumePostSkeletonValue :
public integral_constant
114 < bool, tuple_element<i, Args>::type::doPatternVolumePostSkeleton>
117 struct PatternSkeletonValue :
public integral_constant
118 < bool, tuple_element<i, Args>::type::doPatternSkeleton>
121 struct PatternBoundaryValue :
public integral_constant
122 < bool, tuple_element<i, Args>::type::doPatternBoundary>
126 struct AlphaVolumeValue :
public integral_constant
127 < bool, tuple_element<i, Args>::type::doAlphaVolume>
130 struct AlphaVolumePostSkeletonValue :
public integral_constant
131 < bool, tuple_element<i, Args>::type::doAlphaVolumePostSkeleton>
134 struct AlphaSkeletonValue :
public integral_constant
135 < bool, tuple_element<i, Args>::type::doAlphaSkeleton>
138 struct AlphaBoundaryValue :
public integral_constant
139 < bool, tuple_element<i, Args>::type::doAlphaBoundary>
143 struct LambdaVolumeValue :
public integral_constant
144 < bool, tuple_element<i, Args>::type::doLambdaVolume>
147 struct LambdaVolumePostSkeletonValue :
public integral_constant
148 < bool, tuple_element<i, Args>::type::doLambdaVolumePostSkeleton>
151 struct LambdaSkeletonValue :
public integral_constant
152 < bool, tuple_element<i, Args>::type::doLambdaSkeleton>
155 struct LambdaBoundaryValue :
public integral_constant
156 < bool, tuple_element<i, Args>::type::doLambdaBoundary>
160 struct OneSidedSkeletonRequiredValue :
public integral_constant
161 < bool, ( ( tuple_element<i, Args>::type::doAlphaSkeleton ||
162 tuple_element<i, Args>::type::doLambdaSkeleton) &&
163 ! tuple_element<i, Args>::type::doSkeletonTwoSided)>
166 struct TwoSidedSkeletonRequiredValue :
public integral_constant
167 < bool, ( ( tuple_element<i, Args>::type::doAlphaSkeleton ||
168 tuple_element<i, Args>::type::doLambdaSkeleton) &&
169 tuple_element<i, Args>::type::doSkeletonTwoSided)>
231 "Some summands require a one-sided skelton, others a "
232 "two-sided skeleton. This is not supported.");
246 struct PatternVolumeOperation {
247 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
248 static void apply(
const ArgPtrs& lops,
const Weights& weights,
249 const LFSU& lfsu,
const LFSV& lfsv,
250 LocalPattern& pattern)
252 if(weights[i] != K(0))
254 tuple_element<i,Args>::type::doPatternVolume>
::
260 struct PatternVolumePostSkeletonOperation {
261 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
262 static void apply(
const ArgPtrs& lops,
const Weights& weights,
263 const LFSU& lfsu,
const LFSV& lfsv,
264 LocalPattern& pattern)
266 if(weights[i] != K(0))
267 LocalAssemblerCallSwitch<typename tuple_element<i,Args>::type,
268 tuple_element<i,Args>::type::doPatternVolumePostSkeleton>
::
274 struct PatternSkeletonOperation {
275 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
276 static void apply(
const ArgPtrs& lops,
const Weights& weights,
277 const LFSU& lfsu_s,
const LFSV& lfsv_s,
278 const LFSU& lfsu_n,
const LFSV& lfsv_n,
279 LocalPattern& pattern_sn,
280 LocalPattern& pattern_ns)
282 if(weights[i] != K(0))
283 LocalAssemblerCallSwitch<typename tuple_element<i,Args>::type,
284 tuple_element<i,Args>::type::doPatternSkeleton>
::
286 lfsu_s, lfsv_s, lfsu_n, lfsv_n,
287 pattern_sn, pattern_ns);
292 struct PatternBoundaryOperation {
293 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
294 static void apply(
const ArgPtrs& lops,
const Weights& weights,
295 const LFSU& lfsu_s,
const LFSV& lfsv_s,
296 LocalPattern& pattern_ss)
298 if(weights[i] != K(0))
299 LocalAssemblerCallSwitch<typename tuple_element<i,Args>::type,
300 tuple_element<i,Args>::type::doPatternBoundary>
::
312 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
314 (
const LFSU& lfsu,
const LFSV& lfsv,
315 LocalPattern& pattern)
const
317 ForLoop<PatternVolumeOperation, 0, size-1>::
318 apply(lops, weights, lfsu, lfsv, pattern);
328 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
330 (
const LFSU& lfsu,
const LFSV& lfsv,
331 LocalPattern& pattern)
const
333 ForLoop<PatternVolumePostSkeletonOperation, 0, size-1>::
334 apply(lops, weights, lfsu, lfsv, pattern);
343 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
345 (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
346 const LFSU& lfsu_n,
const LFSV& lfsv_n,
347 LocalPattern& pattern_sn,
348 LocalPattern& pattern_ns)
const
350 ForLoop<PatternSkeletonOperation, 0, size-1>::
351 apply(lops, weights, lfsu_s, lfsv_s, lfsu_n, lfsv_n,
352 pattern_sn, pattern_ns);
361 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
363 (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
364 LocalPattern& pattern_ss)
const
366 ForLoop<PatternBoundaryOperation, 0, size-1>::
367 apply(lops, weights, lfsu_s, lfsv_s, pattern_ss);
382 struct AlphaVolumeOperation {
383 typedef typename tuple_element<i,Args>::type Arg;
384 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
386 static void apply(
const ArgPtrs& lops,
const Weights& weights,
388 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
393 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
395 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
397 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
401 WeightedVectorAccumulationView<C> view(r, weight);
409 struct AlphaVolumePostSkeletonOperation {
410 typedef typename tuple_element<i,Args>::type Arg;
411 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
413 static void apply(
const ArgPtrs& lops,
const Weights& weights,
415 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
416 WeightedVectorAccumulationView<C>& r)
418 apply(lops, weights[i]*r.weight(),
eg, lfsu, x, lfsv, r.container());
420 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
422 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
424 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
428 WeightedVectorAccumulationView<C> view(r, weight);
438 struct AlphaSkeletonOperation {
439 typedef typename tuple_element<i,Args>::type Arg;
440 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
442 static void apply(
const ArgPtrs& lops,
const Weights& weights,
444 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
445 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
446 WeightedVectorAccumulationView<C>& r_s,
447 WeightedVectorAccumulationView<C>& r_n)
449 apply(lops, weights[i]*r_s.weight(), weights[i]*r_n.weight(),
453 r_s.container(), r_n.container());
455 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
457 static void apply(
const ArgPtrs& lops,
458 typename C::weight_type weight_s,
459 typename C::weight_type weight_n,
461 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
462 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
465 if(weight_s != K(0) || weight_n != K(0)) {
466 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
467 WeightedVectorAccumulationView<C> view_n(r_n, weight_n);
478 struct AlphaBoundaryOperation {
479 typedef typename tuple_element<i,Args>::type Arg;
480 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
482 static void apply(
const ArgPtrs& lops,
const Weights& weights,
484 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
485 WeightedVectorAccumulationView<C>& r_s)
487 apply(lops, weights[i]*r_s.weight(),
ig,
491 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
493 static void apply(
const ArgPtrs& lops,
494 typename C::weight_type weight_s,
496 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
499 if(weight_s != K(0)) {
500 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
513 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
517 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
520 ForLoop<AlphaVolumeOperation, 0, size-1>::
521 apply(lops, weights, eg, lfsu, x, lfsv, r);
530 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
534 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
537 ForLoop<AlphaVolumePostSkeletonOperation, 0, size-1>::
538 apply(lops, weights, eg, lfsu, x, lfsv, r);
546 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
550 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
551 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
552 C& r_s, C& r_n)
const
554 ForLoop<AlphaSkeletonOperation, 0, size-1>::
555 apply(lops, weights, ig,
566 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
570 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
573 ForLoop<AlphaBoundaryOperation, 0, size-1>::
574 apply(lops, weights, ig, lfsu_s, x_s, lfsv_s, r_s);
589 struct LambdaVolumeOperation {
590 typedef typename tuple_element<i,Args>::type Arg;
591 template<
typename EG,
typename LFSV,
typename C>
592 static void apply(
const ArgPtrs& lops,
const Weights& weights,
599 template<
typename EG,
typename LFSV,
typename C>
600 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
606 WeightedVectorAccumulationView<C> view(r, weight);
614 struct LambdaVolumePostSkeletonOperation {
615 typedef typename tuple_element<i,Args>::type Arg;
616 template<
typename EG,
typename LFSV,
typename C>
617 static void apply(
const ArgPtrs& lops,
const Weights& weights,
620 WeightedVectorAccumulationView<C>& r)
622 apply(lops, weights[i]*r.weight(),
eg, lfsv, r.container());
624 template<
typename EG,
typename LFSV,
typename C>
625 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
631 WeightedVectorAccumulationView<C> view(r, weight);
639 struct LambdaSkeletonOperation {
640 typedef typename tuple_element<i,Args>::type Arg;
641 template<
typename IG,
typename LFSV,
typename C>
642 static void apply(
const ArgPtrs& lops,
const Weights& weights,
644 const LFSV& lfsv_s,
const LFSV& lfsv_n,
645 WeightedVectorAccumulationView<C>& r_s,
646 WeightedVectorAccumulationView<C>& r_n)
648 apply(lops, weights[i]*r_s.weight(), weights[i]*r_n.weight(),
651 r_s.container(), r_n.container());
653 template<
typename IG,
typename LFSV,
typename C>
654 static void apply(
const ArgPtrs& lops,
655 typename C::weight_type weight_s,
656 typename C::weight_type weight_n,
658 const LFSV& lfsv_s,
const LFSV& lfsv_n,
661 if(weight_s != K(0) || weight_n != K(0)) {
662 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
663 WeightedVectorAccumulationView<C> view_n(r_n, weight_n);
673 struct LambdaBoundaryOperation {
674 typedef typename tuple_element<i,Args>::type Arg;
675 template<
typename IG,
typename LFSV,
typename C>
676 static void apply(
const ArgPtrs& lops,
const Weights& weights,
679 WeightedVectorAccumulationView<C>& r_s)
681 apply(lops, weights[i]*r_s.weight(),
ig, lfsv_s, r_s.container());
683 template<
typename IG,
typename LFSV,
typename C>
684 static void apply(
const ArgPtrs& lops,
685 typename C::weight_type weight_s,
690 if(weight_s != K(0)) {
691 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
704 template<
typename EG,
typename LFSV,
typename C>
707 ForLoop<LambdaVolumeOperation, 0, size-1>::
708 apply(lops, weights, eg, lfsv, r);
717 template<
typename EG,
typename LFSV,
typename C>
722 ForLoop<LambdaVolumePostSkeletonOperation, 0, size-1>::
723 apply(lops, weights, eg, lfsv, r);
731 template<
typename IG,
typename LFSV,
typename C>
733 const LFSV& lfsv_s,
const LFSV& lfsv_n,
734 C& r_s, C& r_n)
const
736 ForLoop<LambdaSkeletonOperation, 0, size-1>::
737 apply(lops, weights, ig, lfsv_s, lfsv_n, r_s, r_n);
745 template<
typename IG,
typename LFSV,
typename C>
748 ForLoop<LambdaBoundaryOperation, 0, size-1>::
749 apply(lops, weights, ig, lfsv_s, r_s);
764 struct JacobianApplyVolumeOperation {
765 typedef typename tuple_element<i,Args>::type Arg;
766 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
768 static void apply(
const ArgPtrs& lops,
const Weights& weights,
770 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
775 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
777 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
779 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
783 WeightedVectorAccumulationView<C> view(r, weight);
791 struct JacobianApplyVolumePostSkeletonOperation {
792 typedef typename tuple_element<i,Args>::type Arg;
793 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
795 static void apply(
const ArgPtrs& lops,
const Weights& weights,
797 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
798 WeightedVectorAccumulationView<C>& r)
800 apply(lops, weights[i]*r.weight(),
eg, lfsu, x, lfsv, r.container());
802 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
804 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
806 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
810 WeightedVectorAccumulationView<C> view(r, weight);
820 struct JacobianApplySkeletonOperation {
821 typedef typename tuple_element<i,Args>::type Arg;
822 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
824 static void apply(
const ArgPtrs& lops,
const Weights& weights,
826 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
827 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
828 WeightedVectorAccumulationView<C>& r_s,
829 WeightedVectorAccumulationView<C>& r_n)
831 apply(lops, weights[i]*r_s.weight(), weights[i]*r_n.weight(),
835 r_s.container(), r_n.container());
837 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
839 static void apply(
const ArgPtrs& lops,
840 typename C::weight_type weight_s,
841 typename C::weight_type weight_n,
843 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
844 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
847 if(weight_s != K(0) || weight_n != K(0)) {
848 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
849 WeightedVectorAccumulationView<C> view_n(r_n, weight_n);
860 struct JacobianApplyBoundaryOperation {
861 typedef typename tuple_element<i,Args>::type Arg;
862 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
864 static void apply(
const ArgPtrs& lops,
const Weights& weights,
866 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
867 WeightedVectorAccumulationView<C>& r_s)
869 apply(lops, weights[i]*r_s.weight(),
ig,
873 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
875 static void apply(
const ArgPtrs& lops,
876 typename C::weight_type weight_s,
878 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
881 if(weight_s != K(0)) {
882 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
897 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
901 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
904 ForLoop<JacobianApplyVolumeOperation, 0, size-1>::
905 apply(lops, weights, eg, lfsu, x, lfsv, r);
914 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
918 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
921 ForLoop<JacobianApplyVolumePostSkeletonOperation, 0, size-1>::
922 apply(lops, weights, eg, lfsu, x, lfsv, r);
930 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
934 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
935 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
936 C& r_s, C& r_n)
const
938 ForLoop<JacobianApplySkeletonOperation, 0, size-1>::
939 apply(lops, weights, ig,
950 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
954 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
957 ForLoop<JacobianApplyBoundaryOperation, 0, size-1>::
958 apply(lops, weights, ig, lfsu_s, x_s, lfsv_s, r_s);
973 struct JacobianVolumeOperation {
974 typedef typename tuple_element<i,Args>::type Arg;
975 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
977 static void apply(
const ArgPtrs& lops,
const Weights& weights,
979 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
984 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
986 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
988 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
992 WeightedMatrixAccumulationView<C> view(m, weight);
1000 struct JacobianVolumePostSkeletonOperation {
1001 typedef typename tuple_element<i,Args>::type Arg;
1002 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1004 static void apply(
const ArgPtrs& lops,
const Weights& weights,
1006 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1007 WeightedMatrixAccumulationView<C>& m)
1009 apply(lops, weights[i]*m.weight(),
eg, lfsu, x, lfsv, m.container());
1011 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1013 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
1015 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1018 if(weight != K(0)) {
1019 WeightedMatrixAccumulationView<C> view(m, weight);
1029 struct JacobianSkeletonOperation {
1030 typedef typename tuple_element<i,Args>::type Arg;
1031 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1033 static void apply(
const ArgPtrs& lops,
const Weights& weights,
1035 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1036 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
1037 WeightedMatrixAccumulationView<C>& m_ss,
1038 WeightedMatrixAccumulationView<C>& m_sn,
1039 WeightedMatrixAccumulationView<C>& m_ns,
1040 WeightedMatrixAccumulationView<C>& m_nn)
1043 weights[i]*m_ss.weight(), weights[i]*m_sn.weight(),
1044 weights[i]*m_ns.weight(), weights[i]*m_nn.weight(),
1046 lfsu_s, x_s, lfsv_s,
1047 lfsu_n, x_n, lfsv_n,
1048 m_ss.container(), m_sn.container(),
1049 m_ns.container(), m_nn.container());
1051 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1053 static void apply(
const ArgPtrs& lops,
1054 typename C::weight_type weight_ss,
1055 typename C::weight_type weight_sn,
1056 typename C::weight_type weight_ns,
1057 typename C::weight_type weight_nn,
1059 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1060 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
1061 C& m_ss, C& m_sn, C& m_ns, C& m_nn)
1063 if(weight_ss != K(0) || weight_sn != K(0) ||
1064 weight_ns != K(0) || weight_nn != K(0))
1066 WeightedMatrixAccumulationView<C> view_ss(m_ss, weight_ss);
1067 WeightedMatrixAccumulationView<C> view_sn(m_sn, weight_sn);
1068 WeightedMatrixAccumulationView<C> view_ns(m_ns, weight_ns);
1069 WeightedMatrixAccumulationView<C> view_nn(m_nn, weight_nn);
1072 lfsu_s, x_s, lfsv_s,
1073 lfsu_n, x_n, lfsv_n,
1074 view_ss, view_sn, view_ns, view_nn);
1080 struct JacobianBoundaryOperation {
1081 typedef typename tuple_element<i,Args>::type Arg;
1082 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1084 static void apply(
const ArgPtrs& lops,
const Weights& weights,
1086 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1087 WeightedMatrixAccumulationView<C>& m_ss)
1089 apply(lops, weights[i]*m_ss.weight(),
ig,
1090 lfsu_s, x_s, lfsv_s,
1093 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1095 static void apply(
const ArgPtrs& lops,
1096 typename C::weight_type weight_ss,
1098 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1101 if(weight_ss != K(0))
1103 WeightedMatrixAccumulationView<C> view_ss(m_ss, weight_ss);
1106 lfsu_s, x_s, lfsv_s, view_ss);
1117 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1121 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1124 ForLoop<JacobianVolumeOperation, 0, size-1>::
1125 apply(lops, weights, eg, lfsu, x, lfsv, m);
1133 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1137 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1140 ForLoop<JacobianVolumePostSkeletonOperation, 0, size-1>::
1141 apply(lops, weights, eg, lfsu, x, lfsv, m);
1149 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1153 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1154 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
1155 C& m_ss, C& m_sn, C& m_ns, C& m_nn)
const
1157 ForLoop<JacobianSkeletonOperation, 0, size-1>::
1158 apply(lops, weights, ig,
1159 lfsu_s, x_s, lfsv_s,
1160 lfsu_n, x_n, lfsv_n,
1161 m_ss, m_sn, m_ns, m_nn);
1169 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1173 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1176 ForLoop<JacobianBoundaryOperation, 0, size-1>::
1177 apply(lops, weights, ig, lfsu_s, x_s, lfsv_s, m_ss);
1189 typedef typename tuple_element<0, Args>::type::RealType
RealType;
1195 template<
int i>
struct SetTimeOperation {
1196 static void apply(ArgPtrs& lops,
RealType t)
1200 template<
int i>
struct PreStepOperation {
1201 static void apply(ArgPtrs& lops,
1203 { get<i>(lops)->
preStep(time, dt, stages); }
1206 template<
int i>
struct PostStepOperation {
1207 static void apply(ArgPtrs& lops)
1211 template<
int i>
struct PreStageOperation {
1212 static void apply(ArgPtrs& lops,
RealType time,
int r)
1213 { get<i>(lops)->
preStage(time, r); }
1216 template<
int i>
struct PostStageOperation {
1217 static void apply(ArgPtrs& lops)
1221 template<
int i>
struct SuggestTimestepOperation {
1222 static void apply(ArgPtrs& lops,
RealType& dt)
1230 ForLoop<SetTimeOperation, 0, size-1>::apply(lops, t);
1236 return get<0>(lops)->
getTime();
1242 ForLoop<PreStepOperation, 0, size-1>::apply(lops, time, dt, stages);
1248 ForLoop<PostStepOperation, 0, size-1>::apply(lops);
1254 ForLoop<PreStageOperation, 0, size-1>::apply(lops, time, r);
1266 ForLoop<PostStageOperation, 0, size-1>::apply(lops);
1277 ForLoop<SuggestTimestepOperation, 0, size-1>::apply(lops, dt);
1288 #endif // DUNE_PDELAB_LOCALOPERATOR_WEIGHTEDSUM_HH
void lambda_volume_post_skeleton(const EG &eg, const LFSV &lfsv, C &r) const
get an element's contribution to lambda after the intersections have been handled ...
Definition: weightedsum.hh:718
RealType suggestTimestep(RealType dt) const
to be called after stage 1
Definition: weightedsum.hh:1275
static void jacobian_boundary(const LA &la, const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, M &mat_ss)
Definition: callswitch.hh:117
RealType getTime() const
get current time
Definition: weightedsum.hh:1234
void alpha_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, C &r) const
get an element's contribution to alpha after the intersections have been handled
Definition: weightedsum.hh:533
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: weightedsum.hh:363
void lambda_boundary(const IG &ig, const LFSV &lfsv_s, C &r_s) const
get a boundary intersections's contribution to lambda
Definition: weightedsum.hh:746
static void lambda_skeleton(const LA &la, const IG &ig, const LFSV &lfsv_s, const LFSV &lfsv_n, R &r_s, R &r_n)
Definition: callswitch.hh:69
K getWeight(std::size_t i)
get the weight for the i'th component of the sum
Definition: weightedsum.hh:88
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, C &r_s, C &r_n) const
get an internal intersections's contribution to alpha
Definition: weightedsum.hh:549
dune_static_assert(!(AccFlag< OneSidedSkeletonRequiredValue >::value &&AccFlag< TwoSidedSkeletonRequiredValue >::value),"Some summands require a one-sided skelton, others a ""two-sided skeleton. This is not supported.")
static void jacobian_skeleton(const LA &la, 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, M &mat_ss, M &mat_sn, M &mat_ns, M &mat_nn)
Definition: callswitch.hh:109
Definition: weightedsum.hh:220
Definition: weightedsum.hh:217
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: weightedsum.hh:330
static void alpha_volume_post_skeleton(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r)
Definition: callswitch.hh:43
static void jacobian_apply_boundary(const LA &la, const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, Y &y_s)
Definition: callswitch.hh:95
Definition: weightedsum.hh:205
Container & container()
Returns the container (of type LocalVector) that this view is based on.
Definition: localvector.hh:127
void alpha_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, C &r_s) const
get a boundary intersections's contribution to alpha
Definition: weightedsum.hh:569
tuple_element< 0, Args >::type::RealType RealType
Export type used for time values.
Definition: weightedsum.hh:1189
Definition: weightedsum.hh:190
VTKWriter & w
Definition: function.hh:1102
A local operator to take the weighted sum of other local operators.
Definition: weightedsum.hh:38
Definition: weightedsum.hh:201
void alpha_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, C &r) const
get an element's contribution to alpha
Definition: weightedsum.hh:516
void pattern_volume(const LFSU &lfsu, const LFSV &lfsv, LocalPattern &pattern) const
get an element's contribution to the sparsity pattern
Definition: weightedsum.hh:314
void preStage(RealType time, int r)
to be called once before each stage
Definition: weightedsum.hh:1252
void postStep()
to be called once at the end of each time step
Definition: weightedsum.hh:1246
void jacobian_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, C &m_ss) const
get a boundary intersections's jacobian
Definition: weightedsum.hh:1172
Definition: callswitch.hh:12
static void jacobian_apply_volume(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, Y &y)
Definition: callswitch.hh:80
Definition: weightedsum.hh:223
static void lambda_boundary(const LA &la, const IG &ig, const LFSV &lfsv, R &r)
Definition: callswitch.hh:75
Definition: weightedsum.hh:175
static void jacobian_volume(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, M &mat)
Definition: callswitch.hh:101
void jacobian_apply_boundary(const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, C &r_s) const
apply a boundary intersections's jacobian
Definition: weightedsum.hh:953
static void alpha_skeleton(const LA &la, 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)
Definition: callswitch.hh:47
int getStage() const
get current stage
Definition: weightedsum.hh:1258
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, C &m_ss, C &m_sn, C &m_ns, C &m_nn) const
apply an internal intersections's jacobians
Definition: weightedsum.hh:1152
void jacobian_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, C &m) const
get an element's jacobian after the intersections have been handled
Definition: weightedsum.hh:1136
Definition: weightedsum.hh:213
static void lambda_volume(const LA &la, const EG &eg, const LFSV &lfsv, R &r)
Definition: callswitch.hh:61
const IG & ig
Definition: common/constraints.hh:146
void lambda_volume(const EG &eg, const LFSV &lfsv, C &r) const
get an element's contribution to lambda
Definition: weightedsum.hh:705
Definition: weightedsum.hh:185
static void alpha_boundary(const LA &la, const IG &ig, const LFSU &lfsu_s, const X &x_s, const LFSV &lfsv_s, R &r_s)
Definition: callswitch.hh:54
void jacobian_apply_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, C &r) const
apply an element's jacobian
Definition: weightedsum.hh:900
An accumulate-only view on a local matrix that automatically takes into account an accumulation weigh...
Definition: common/localmatrix.hh:21
void jacobian_apply_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, C &r) const
apply an element's jacobian after the intersections have been handled
Definition: weightedsum.hh:917
void setTime(RealType t)
set time for subsequent evaluation
Definition: weightedsum.hh:1228
static const unsigned int value
Definition: gridfunctionspace/tags.hh:175
void lambda_skeleton(const IG &ig, const LFSV &lfsv_s, const LFSV &lfsv_n, C &r_s, C &r_n) const
get an internal intersections's contribution to lambda
Definition: weightedsum.hh:732
static void lambda_volume_post_skeleton(const LA &la, const EG &eg, const LFSV &lfsv, R &r)
Definition: callswitch.hh:65
static void jacobian_apply_volume_post_skeleton(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, Y &y)
Definition: callswitch.hh:84
Definition: weightedsum.hh:180
static void alpha_volume(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r)
Definition: callswitch.hh:39
weight_type weight()
Returns the weight associated with this view.
Definition: localvector.hh:61
Definition: weightedsum.hh:227
weight_type weight()
Returns the weight associated with this view.
Definition: common/localmatrix.hh:60
tuple_element< i, Args >::type & getSummand()
get the i'th component of the sum
Definition: weightedsum.hh:80
const EG & eg
Definition: common/constraints.hh:277
void jacobian_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, C &m) const
get an element's jacobian
Definition: weightedsum.hh:1120
void preStep(RealType time, RealType dt, int stages)
to be called once before each time step
Definition: weightedsum.hh:1240
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, C &r_s, C &r_n) const
apply an internal intersections's jacobians
Definition: weightedsum.hh:933
static void jacobian_volume_post_skeleton(const LA &la, const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, M &mat)
Definition: callswitch.hh:105
WeightedSumLocalOperator(const Weights &weights_=Weights(1))
construct a WeightedSumLocalOperator
Definition: weightedsum.hh:62
An accumulate-only view on a local vector that automatically takes into account an accumulation weigh...
Definition: localvector.hh:26
static void jacobian_apply_skeleton(const LA &la, 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)
Definition: callswitch.hh:88
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: weightedsum.hh:345
void postStage()
to be called once at the end of each stage
Definition: weightedsum.hh:1264
void setWeight(K w, std::size_t i)
set the weight for the i'th component of the sum
Definition: weightedsum.hh:84
Container & container()
Returns the container (of type LocalMatrix) that this view is based on.
Definition: common/localmatrix.hh:129
Definition: weightedsum.hh:209
void setSummand(typename tuple_element< i, Args >::type &summand)
set the i'th component of the sum
Definition: weightedsum.hh:75
Definition: weightedsum.hh:195