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/tuples.hh>
11 #include <dune/common/tupleutility.hh>
12 #include <dune/common/typetraits.hh>
36 template<
typename K,
typename Args>
41 typedef typename ForEachType<AddPtrTypeEvaluator, Args>::Type ArgPtrs;
42 typedef typename ForEachType<AddRefTypeEvaluator, Args>::Type ArgRefs;
45 typedef FieldVector<K, size> Weights;
61 (
const Weights& weights_ = Weights(1))
67 (
const ArgRefs& lops_,
68 const Weights& weights_ = Weights(1))
69 : lops(transformTuple<AddPtrTypeEvaluator>(lops_)), weights(weights_)
73 template<std::
size_t i>
74 void setSummand(
typename tuple_element<i,Args>::type& summand)
75 { get<i>(lops) = &summand; }
78 template<std::
size_t i>
80 {
return *get<i>(lops); }
88 {
return weights[i]; }
99 template<
typename T1,
typename T2>
101 :
public std::integral_constant<bool, T1::value || T2:: value>
103 template<
template<
int>
class Value>
104 struct AccFlag :
public GenericForLoop<OrOperation, Value, 0, size-1>
108 struct PatternVolumeValue :
public std::integral_constant
109 < bool, tuple_element<i, Args>::type::doPatternVolume>
112 struct PatternVolumePostSkeletonValue :
public std::integral_constant
113 < bool, tuple_element<i, Args>::type::doPatternVolumePostSkeleton>
116 struct PatternSkeletonValue :
public std::integral_constant
117 < bool, tuple_element<i, Args>::type::doPatternSkeleton>
120 struct PatternBoundaryValue :
public std::integral_constant
121 < bool, tuple_element<i, Args>::type::doPatternBoundary>
125 struct AlphaVolumeValue :
public std::integral_constant
126 < bool, tuple_element<i, Args>::type::doAlphaVolume>
129 struct AlphaVolumePostSkeletonValue :
public std::integral_constant
130 < bool, tuple_element<i, Args>::type::doAlphaVolumePostSkeleton>
133 struct AlphaSkeletonValue :
public std::integral_constant
134 < bool, tuple_element<i, Args>::type::doAlphaSkeleton>
137 struct AlphaBoundaryValue :
public std::integral_constant
138 < bool, tuple_element<i, Args>::type::doAlphaBoundary>
142 struct LambdaVolumeValue :
public std::integral_constant
143 < bool, tuple_element<i, Args>::type::doLambdaVolume>
146 struct LambdaVolumePostSkeletonValue :
public std::integral_constant
147 < bool, tuple_element<i, Args>::type::doLambdaVolumePostSkeleton>
150 struct LambdaSkeletonValue :
public std::integral_constant
151 < bool, tuple_element<i, Args>::type::doLambdaSkeleton>
154 struct LambdaBoundaryValue :
public std::integral_constant
155 < bool, tuple_element<i, Args>::type::doLambdaBoundary>
159 struct OneSidedSkeletonRequiredValue :
public std::integral_constant
160 < bool, ( ( tuple_element<i, Args>::type::doAlphaSkeleton ||
161 tuple_element<i, Args>::type::doLambdaSkeleton) &&
162 ! tuple_element<i, Args>::type::doSkeletonTwoSided)>
165 struct TwoSidedSkeletonRequiredValue :
public std::integral_constant
166 < bool, ( ( tuple_element<i, Args>::type::doAlphaSkeleton ||
167 tuple_element<i, Args>::type::doLambdaSkeleton) &&
168 tuple_element<i, Args>::type::doSkeletonTwoSided)>
230 "Some summands require a one-sided skelton, others a "
231 "two-sided skeleton. This is not supported.");
245 struct PatternVolumeOperation {
246 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
247 static void apply(
const ArgPtrs& lops,
const Weights& weights,
248 const LFSU& lfsu,
const LFSV& lfsv,
249 LocalPattern& pattern)
251 if(weights[i] != K(0))
253 tuple_element<i,Args>::type::doPatternVolume>
::
259 struct PatternVolumePostSkeletonOperation {
260 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
261 static void apply(
const ArgPtrs& lops,
const Weights& weights,
262 const LFSU& lfsu,
const LFSV& lfsv,
263 LocalPattern& pattern)
265 if(weights[i] != K(0))
266 LocalAssemblerCallSwitch<typename tuple_element<i,Args>::type,
267 tuple_element<i,Args>::type::doPatternVolumePostSkeleton>
::
273 struct PatternSkeletonOperation {
274 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
275 static void apply(
const ArgPtrs& lops,
const Weights& weights,
276 const LFSU& lfsu_s,
const LFSV& lfsv_s,
277 const LFSU& lfsu_n,
const LFSV& lfsv_n,
278 LocalPattern& pattern_sn,
279 LocalPattern& pattern_ns)
281 if(weights[i] != K(0))
282 LocalAssemblerCallSwitch<typename tuple_element<i,Args>::type,
283 tuple_element<i,Args>::type::doPatternSkeleton>
::
285 lfsu_s, lfsv_s, lfsu_n, lfsv_n,
286 pattern_sn, pattern_ns);
291 struct PatternBoundaryOperation {
292 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
293 static void apply(
const ArgPtrs& lops,
const Weights& weights,
294 const LFSU& lfsu_s,
const LFSV& lfsv_s,
295 LocalPattern& pattern_ss)
297 if(weights[i] != K(0))
298 LocalAssemblerCallSwitch<typename tuple_element<i,Args>::type,
299 tuple_element<i,Args>::type::doPatternBoundary>
::
311 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
313 (
const LFSU& lfsu,
const LFSV& lfsv,
314 LocalPattern& pattern)
const
316 ForLoop<PatternVolumeOperation, 0, size-1>::
317 apply(lops, weights, lfsu, lfsv, pattern);
327 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
329 (
const LFSU& lfsu,
const LFSV& lfsv,
330 LocalPattern& pattern)
const
332 ForLoop<PatternVolumePostSkeletonOperation, 0, size-1>::
333 apply(lops, weights, lfsu, lfsv, pattern);
342 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
344 (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
345 const LFSU& lfsu_n,
const LFSV& lfsv_n,
346 LocalPattern& pattern_sn,
347 LocalPattern& pattern_ns)
const
349 ForLoop<PatternSkeletonOperation, 0, size-1>::
350 apply(lops, weights, lfsu_s, lfsv_s, lfsu_n, lfsv_n,
351 pattern_sn, pattern_ns);
360 template<
typename LFSU,
typename LFSV,
typename LocalPattern>
362 (
const LFSU& lfsu_s,
const LFSV& lfsv_s,
363 LocalPattern& pattern_ss)
const
365 ForLoop<PatternBoundaryOperation, 0, size-1>::
366 apply(lops, weights, lfsu_s, lfsv_s, pattern_ss);
381 struct AlphaVolumeOperation {
382 typedef typename tuple_element<i,Args>::type Arg;
383 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
385 static void apply(
const ArgPtrs& lops,
const Weights& weights,
387 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
392 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
394 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
396 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
400 WeightedVectorAccumulationView<C> view(r, weight);
408 struct AlphaVolumePostSkeletonOperation {
409 typedef typename tuple_element<i,Args>::type Arg;
410 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
412 static void apply(
const ArgPtrs& lops,
const Weights& weights,
414 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
415 WeightedVectorAccumulationView<C>& r)
417 apply(lops, weights[i]*r.weight(), eg, lfsu, x, lfsv, r.container());
419 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
421 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
423 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
427 WeightedVectorAccumulationView<C> view(r, weight);
437 struct AlphaSkeletonOperation {
438 typedef typename tuple_element<i,Args>::type Arg;
439 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
441 static void apply(
const ArgPtrs& lops,
const Weights& weights,
443 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
444 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
445 WeightedVectorAccumulationView<C>& r_s,
446 WeightedVectorAccumulationView<C>& r_n)
448 apply(lops, weights[i]*r_s.weight(), weights[i]*r_n.weight(),
452 r_s.container(), r_n.container());
454 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
456 static void apply(
const ArgPtrs& lops,
457 typename C::weight_type weight_s,
458 typename C::weight_type weight_n,
460 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
461 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
464 if(weight_s != K(0) || weight_n != K(0)) {
465 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
466 WeightedVectorAccumulationView<C> view_n(r_n, weight_n);
477 struct AlphaBoundaryOperation {
478 typedef typename tuple_element<i,Args>::type Arg;
479 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
481 static void apply(
const ArgPtrs& lops,
const Weights& weights,
483 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
484 WeightedVectorAccumulationView<C>& r_s)
486 apply(lops, weights[i]*r_s.weight(),
ig,
490 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
492 static void apply(
const ArgPtrs& lops,
493 typename C::weight_type weight_s,
495 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
498 if(weight_s != K(0)) {
499 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
512 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
516 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
519 ForLoop<AlphaVolumeOperation, 0, size-1>::
520 apply(lops, weights, eg, lfsu, x, lfsv, r);
529 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
533 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
536 ForLoop<AlphaVolumePostSkeletonOperation, 0, size-1>::
537 apply(lops, weights, eg, lfsu, x, lfsv, r);
545 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
549 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
550 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
551 C& r_s, C& r_n)
const
553 ForLoop<AlphaSkeletonOperation, 0, size-1>::
554 apply(lops, weights,
ig,
565 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
569 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
572 ForLoop<AlphaBoundaryOperation, 0, size-1>::
573 apply(lops, weights,
ig, lfsu_s, x_s, lfsv_s, r_s);
588 struct LambdaVolumeOperation {
589 typedef typename tuple_element<i,Args>::type Arg;
590 template<
typename EG,
typename LFSV,
typename C>
591 static void apply(
const ArgPtrs& lops,
const Weights& weights,
598 template<
typename EG,
typename LFSV,
typename C>
599 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
605 WeightedVectorAccumulationView<C> view(r, weight);
613 struct LambdaVolumePostSkeletonOperation {
614 typedef typename tuple_element<i,Args>::type Arg;
615 template<
typename EG,
typename LFSV,
typename C>
616 static void apply(
const ArgPtrs& lops,
const Weights& weights,
619 WeightedVectorAccumulationView<C>& r)
621 apply(lops, weights[i]*r.weight(), eg, lfsv, r.container());
623 template<
typename EG,
typename LFSV,
typename C>
624 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
630 WeightedVectorAccumulationView<C> view(r, weight);
638 struct LambdaSkeletonOperation {
639 typedef typename tuple_element<i,Args>::type Arg;
640 template<
typename IG,
typename LFSV,
typename C>
641 static void apply(
const ArgPtrs& lops,
const Weights& weights,
643 const LFSV& lfsv_s,
const LFSV& lfsv_n,
644 WeightedVectorAccumulationView<C>& r_s,
645 WeightedVectorAccumulationView<C>& r_n)
647 apply(lops, weights[i]*r_s.weight(), weights[i]*r_n.weight(),
650 r_s.container(), r_n.container());
652 template<
typename IG,
typename LFSV,
typename C>
653 static void apply(
const ArgPtrs& lops,
654 typename C::weight_type weight_s,
655 typename C::weight_type weight_n,
657 const LFSV& lfsv_s,
const LFSV& lfsv_n,
660 if(weight_s != K(0) || weight_n != K(0)) {
661 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
662 WeightedVectorAccumulationView<C> view_n(r_n, weight_n);
672 struct LambdaBoundaryOperation {
673 typedef typename tuple_element<i,Args>::type Arg;
674 template<
typename IG,
typename LFSV,
typename C>
675 static void apply(
const ArgPtrs& lops,
const Weights& weights,
678 WeightedVectorAccumulationView<C>& r_s)
680 apply(lops, weights[i]*r_s.weight(),
ig, lfsv_s, r_s.container());
682 template<
typename IG,
typename LFSV,
typename C>
683 static void apply(
const ArgPtrs& lops,
684 typename C::weight_type weight_s,
689 if(weight_s != K(0)) {
690 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
703 template<
typename EG,
typename LFSV,
typename C>
706 ForLoop<LambdaVolumeOperation, 0, size-1>::
707 apply(lops, weights, eg, lfsv, r);
716 template<
typename EG,
typename LFSV,
typename C>
721 ForLoop<LambdaVolumePostSkeletonOperation, 0, size-1>::
722 apply(lops, weights, eg, lfsv, r);
730 template<
typename IG,
typename LFSV,
typename C>
732 const LFSV& lfsv_s,
const LFSV& lfsv_n,
733 C& r_s, C& r_n)
const
735 ForLoop<LambdaSkeletonOperation, 0, size-1>::
736 apply(lops, weights,
ig, lfsv_s, lfsv_n, r_s, r_n);
744 template<
typename IG,
typename LFSV,
typename C>
747 ForLoop<LambdaBoundaryOperation, 0, size-1>::
748 apply(lops, weights,
ig, lfsv_s, r_s);
763 struct JacobianApplyVolumeOperation {
764 typedef typename tuple_element<i,Args>::type Arg;
765 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
767 static void apply(
const ArgPtrs& lops,
const Weights& weights,
769 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
774 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
776 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
778 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
782 WeightedVectorAccumulationView<C> view(r, weight);
790 struct JacobianApplyVolumePostSkeletonOperation {
791 typedef typename tuple_element<i,Args>::type Arg;
792 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
794 static void apply(
const ArgPtrs& lops,
const Weights& weights,
796 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
797 WeightedVectorAccumulationView<C>& r)
799 apply(lops, weights[i]*r.weight(), eg, lfsu, x, lfsv, r.container());
801 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
803 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
805 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
809 WeightedVectorAccumulationView<C> view(r, weight);
819 struct JacobianApplySkeletonOperation {
820 typedef typename tuple_element<i,Args>::type Arg;
821 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
823 static void apply(
const ArgPtrs& lops,
const Weights& weights,
825 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
826 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
827 WeightedVectorAccumulationView<C>& r_s,
828 WeightedVectorAccumulationView<C>& r_n)
830 apply(lops, weights[i]*r_s.weight(), weights[i]*r_n.weight(),
834 r_s.container(), r_n.container());
836 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
838 static void apply(
const ArgPtrs& lops,
839 typename C::weight_type weight_s,
840 typename C::weight_type weight_n,
842 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
843 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
846 if(weight_s != K(0) || weight_n != K(0)) {
847 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
848 WeightedVectorAccumulationView<C> view_n(r_n, weight_n);
859 struct JacobianApplyBoundaryOperation {
860 typedef typename tuple_element<i,Args>::type Arg;
861 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
863 static void apply(
const ArgPtrs& lops,
const Weights& weights,
865 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
866 WeightedVectorAccumulationView<C>& r_s)
868 apply(lops, weights[i]*r_s.weight(),
ig,
872 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
874 static void apply(
const ArgPtrs& lops,
875 typename C::weight_type weight_s,
877 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
880 if(weight_s != K(0)) {
881 WeightedVectorAccumulationView<C> view_s(r_s, weight_s);
896 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
900 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
903 ForLoop<JacobianApplyVolumeOperation, 0, size-1>::
904 apply(lops, weights, eg, lfsu, x, lfsv, r);
913 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
917 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
920 ForLoop<JacobianApplyVolumePostSkeletonOperation, 0, size-1>::
921 apply(lops, weights, eg, lfsu, x, lfsv, r);
929 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
933 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
934 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
935 C& r_s, C& r_n)
const
937 ForLoop<JacobianApplySkeletonOperation, 0, size-1>::
938 apply(lops, weights,
ig,
949 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
953 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
956 ForLoop<JacobianApplyBoundaryOperation, 0, size-1>::
957 apply(lops, weights,
ig, lfsu_s, x_s, lfsv_s, r_s);
972 struct JacobianVolumeOperation {
973 typedef typename tuple_element<i,Args>::type Arg;
974 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
976 static void apply(
const ArgPtrs& lops,
const Weights& weights,
978 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
983 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
985 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
987 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
991 WeightedMatrixAccumulationView<C> view(m, weight);
999 struct JacobianVolumePostSkeletonOperation {
1000 typedef typename tuple_element<i,Args>::type Arg;
1001 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1003 static void apply(
const ArgPtrs& lops,
const Weights& weights,
1005 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1006 WeightedMatrixAccumulationView<C>& m)
1008 apply(lops, weights[i]*m.weight(), eg, lfsu, x, lfsv, m.container());
1010 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1012 static void apply(
const ArgPtrs& lops,
typename C::weight_type weight,
1014 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1017 if(weight != K(0)) {
1018 WeightedMatrixAccumulationView<C> view(m, weight);
1028 struct JacobianSkeletonOperation {
1029 typedef typename tuple_element<i,Args>::type Arg;
1030 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1032 static void apply(
const ArgPtrs& lops,
const Weights& weights,
1034 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1035 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
1036 WeightedMatrixAccumulationView<C>& m_ss,
1037 WeightedMatrixAccumulationView<C>& m_sn,
1038 WeightedMatrixAccumulationView<C>& m_ns,
1039 WeightedMatrixAccumulationView<C>& m_nn)
1042 weights[i]*m_ss.weight(), weights[i]*m_sn.weight(),
1043 weights[i]*m_ns.weight(), weights[i]*m_nn.weight(),
1045 lfsu_s, x_s, lfsv_s,
1046 lfsu_n, x_n, lfsv_n,
1047 m_ss.container(), m_sn.container(),
1048 m_ns.container(), m_nn.container());
1050 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1052 static void apply(
const ArgPtrs& lops,
1053 typename C::weight_type weight_ss,
1054 typename C::weight_type weight_sn,
1055 typename C::weight_type weight_ns,
1056 typename C::weight_type weight_nn,
1058 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1059 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
1060 C& m_ss, C& m_sn, C& m_ns, C& m_nn)
1062 if(weight_ss != K(0) || weight_sn != K(0) ||
1063 weight_ns != K(0) || weight_nn != K(0))
1065 WeightedMatrixAccumulationView<C> view_ss(m_ss, weight_ss);
1066 WeightedMatrixAccumulationView<C> view_sn(m_sn, weight_sn);
1067 WeightedMatrixAccumulationView<C> view_ns(m_ns, weight_ns);
1068 WeightedMatrixAccumulationView<C> view_nn(m_nn, weight_nn);
1071 lfsu_s, x_s, lfsv_s,
1072 lfsu_n, x_n, lfsv_n,
1073 view_ss, view_sn, view_ns, view_nn);
1079 struct JacobianBoundaryOperation {
1080 typedef typename tuple_element<i,Args>::type Arg;
1081 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1083 static void apply(
const ArgPtrs& lops,
const Weights& weights,
1085 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1086 WeightedMatrixAccumulationView<C>& m_ss)
1088 apply(lops, weights[i]*m_ss.weight(),
ig,
1089 lfsu_s, x_s, lfsv_s,
1092 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1094 static void apply(
const ArgPtrs& lops,
1095 typename C::weight_type weight_ss,
1097 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1100 if(weight_ss != K(0))
1102 WeightedMatrixAccumulationView<C> view_ss(m_ss, weight_ss);
1105 lfsu_s, x_s, lfsv_s, view_ss);
1116 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1120 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1123 ForLoop<JacobianVolumeOperation, 0, size-1>::
1124 apply(lops, weights, eg, lfsu, x, lfsv, m);
1132 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
1136 const LFSU& lfsu,
const X& x,
const LFSV& lfsv,
1139 ForLoop<JacobianVolumePostSkeletonOperation, 0, size-1>::
1140 apply(lops, weights, eg, lfsu, x, lfsv, m);
1148 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1152 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1153 const LFSU& lfsu_n,
const X& x_n,
const LFSV& lfsv_n,
1154 C& m_ss, C& m_sn, C& m_ns, C& m_nn)
const
1156 ForLoop<JacobianSkeletonOperation, 0, size-1>::
1157 apply(lops, weights,
ig,
1158 lfsu_s, x_s, lfsv_s,
1159 lfsu_n, x_n, lfsv_n,
1160 m_ss, m_sn, m_ns, m_nn);
1168 template<
typename IG,
typename LFSU,
typename X,
typename LFSV,
1172 const LFSU& lfsu_s,
const X& x_s,
const LFSV& lfsv_s,
1175 ForLoop<JacobianBoundaryOperation, 0, size-1>::
1176 apply(lops, weights,
ig, lfsu_s, x_s, lfsv_s, m_ss);
1188 typedef typename tuple_element<0, Args>::type::RealType
RealType;
1194 template<
int i>
struct SetTimeOperation {
1195 static void apply(ArgPtrs& lops,
RealType t)
1196 { get<i>(lops)->setTime(t); }
1199 template<
int i>
struct PreStepOperation {
1200 static void apply(ArgPtrs& lops,
1202 { get<i>(lops)->preStep(time, dt, stages); }
1205 template<
int i>
struct PostStepOperation {
1206 static void apply(ArgPtrs& lops)
1207 { get<i>(lops)->postStep(); }
1210 template<
int i>
struct PreStageOperation {
1211 static void apply(ArgPtrs& lops,
RealType time,
int r)
1212 { get<i>(lops)->preStage(time, r); }
1215 template<
int i>
struct PostStageOperation {
1216 static void apply(ArgPtrs& lops)
1217 { get<i>(lops)->postStage(); }
1220 template<
int i>
struct SuggestTimestepOperation {
1221 static void apply(ArgPtrs& lops,
RealType& dt)
1222 { dt = get<i>(lops)->suggestTimestep(dt); }
1229 ForLoop<SetTimeOperation, 0, size-1>::apply(lops, t);
1235 return get<0>(lops)->getTime();
1241 ForLoop<PreStepOperation, 0, size-1>::apply(lops, time, dt, stages);
1247 ForLoop<PostStepOperation, 0, size-1>::apply(lops);
1253 ForLoop<PreStageOperation, 0, size-1>::apply(lops, time, r);
1259 return get<0>(lops)->getStage();
1265 ForLoop<PostStageOperation, 0, size-1>::apply(lops);
1276 ForLoop<SuggestTimestepOperation, 0, size-1>::apply(lops, dt);
1287 #endif // DUNE_PDELAB_LOCALOPERATOR_WEIGHTEDSUM_HH