dune-pdelab  2.4.1
sum.hh
Go to the documentation of this file.
1 // -*- tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=8 sw=2 sts=2:
3 #ifndef DUNE_PDELAB_LOCALOPERATOR_SUM_HH
4 #define DUNE_PDELAB_LOCALOPERATOR_SUM_HH
5 
6 #include <cstddef>
7 
8 #include <dune/common/forloop.hh>
9 #include <dune/common/tuples.hh>
10 #include <dune/common/tupleutility.hh>
11 #include <dune/common/typetraits.hh>
12 
14 
15 namespace Dune {
16  namespace PDELab {
20 
22 
28  template<typename Args>
30  {
31  static const std::size_t size = tuple_size<Args>::value;
32 
33  typedef typename ForEachType<AddPtrTypeEvaluator, Args>::Type ArgPtrs;
34  typedef typename ForEachType<AddRefTypeEvaluator, Args>::Type ArgRefs;
35 
36  ArgPtrs lops;
37 
38  public:
40  //
43  //
44 
47  InstationarySumLocalOperator(const ArgRefs& lops_)
48  : lops(transformTuple<AddPtrTypeEvaluator>(lops_))
49  { }
50 
52  template<std::size_t i>
53  void setSummand(typename tuple_element<i,Args>::type& summand)
54  { get<i>(lops) = &summand; }
55 
57  template<std::size_t i>
58  typename tuple_element<i,Args>::type& getSummand()
59  { return *get<i>(lops); }
60 
62 
64  //
67  //
68 
69  private:
70  template<typename T1, typename T2>
71  struct OrOperation
72  : public integral_constant<bool, T1::value || T2:: value>
73  { };
74  template<template<int> class Value>
75  struct AccFlag : public GenericForLoop<OrOperation, Value, 0, size-1>
76  { };
77 
78  template<int i>
79  struct PatternVolumeValue : public integral_constant
80  < bool, tuple_element<i, Args>::type::doPatternVolume>
81  { };
82  template<int i>
83  struct PatternVolumePostSkeletonValue : public integral_constant
84  < bool, tuple_element<i, Args>::type::doPatternVolumePostSkeleton>
85  { };
86  template<int i>
87  struct PatternSkeletonValue : public integral_constant
88  < bool, tuple_element<i, Args>::type::doPatternSkeleton>
89  { };
90  template<int i>
91  struct PatternBoundaryValue : public integral_constant
92  < bool, tuple_element<i, Args>::type::doPatternBoundary>
93  { };
94 
95  template<int i>
96  struct AlphaVolumeValue : public integral_constant
97  < bool, tuple_element<i, Args>::type::doAlphaVolume>
98  { };
99  template<int i>
100  struct AlphaVolumePostSkeletonValue : public integral_constant
101  < bool, tuple_element<i, Args>::type::doAlphaVolumePostSkeleton>
102  { };
103  template<int i>
104  struct AlphaSkeletonValue : public integral_constant
105  < bool, tuple_element<i, Args>::type::doAlphaSkeleton>
106  { };
107  template<int i>
108  struct AlphaBoundaryValue : public integral_constant
109  < bool, tuple_element<i, Args>::type::doAlphaBoundary>
110  { };
111 
112  template<int i>
113  struct LambdaVolumeValue : public integral_constant
114  < bool, tuple_element<i, Args>::type::doLambdaVolume>
115  { };
116  template<int i>
117  struct LambdaVolumePostSkeletonValue : public integral_constant
118  < bool, tuple_element<i, Args>::type::doLambdaVolumePostSkeleton>
119  { };
120  template<int i>
121  struct LambdaSkeletonValue : public integral_constant
122  < bool, tuple_element<i, Args>::type::doLambdaSkeleton>
123  { };
124  template<int i>
125  struct LambdaBoundaryValue : public integral_constant
126  < bool, tuple_element<i, Args>::type::doLambdaBoundary>
127  { };
128 
129  template<int i>
130  struct OneSidedSkeletonRequiredValue : public integral_constant
131  < bool, ( ( tuple_element<i, Args>::type::doAlphaSkeleton ||
132  tuple_element<i, Args>::type::doLambdaSkeleton) &&
133  ! tuple_element<i, Args>::type::doSkeletonTwoSided)>
134  { };
135  template<int i>
136  struct TwoSidedSkeletonRequiredValue : public integral_constant
137  < bool, ( ( tuple_element<i, Args>::type::doAlphaSkeleton ||
138  tuple_element<i, Args>::type::doLambdaSkeleton) &&
139  tuple_element<i, Args>::type::doSkeletonTwoSided)>
140  { };
141 
142  public:
162 
165  enum { doAlphaVolume =
181 
183  enum { doLambdaVolume =
195 
201  "Some summands require a one-sided skelton, others a "
202  "two-sided skeleton. This is not supported.");
203 
205 
207  //
210  //
211 
212  private:
213  // template meta program helpers for the pattern_* methods
214 
215  template<int i>
216  struct PatternVolumeOperation {
217  template<typename LFSU, typename LFSV, typename LocalPattern>
218  static void apply(const ArgPtrs& lops,
219  const LFSU& lfsu, const LFSV& lfsv,
220  LocalPattern& pattern)
221  {
223  tuple_element<i,Args>::type::doPatternVolume>::
224  pattern_volume(*get<i>(lops), lfsu, lfsv, pattern);
225  }
226  };
227 
228  template<int i>
229  struct PatternVolumePostSkeletonOperation {
230  template<typename LFSU, typename LFSV, typename LocalPattern>
231  static void apply(const ArgPtrs& lops,
232  const LFSU& lfsu, const LFSV& lfsv,
233  LocalPattern& pattern)
234  {
236  tuple_element<i,Args>::type::doPatternVolumePostSkeleton>::
237  pattern_volume_post_skeleton(*get<i>(lops), lfsu, lfsv, pattern);
238  }
239  };
240 
241  template<int i>
242  struct PatternSkeletonOperation {
243  template<typename LFSU, typename LFSV, typename LocalPattern>
244  static void apply(const ArgPtrs& lops,
245  const LFSU& lfsu_s, const LFSV& lfsv_s,
246  const LFSU& lfsu_n, const LFSV& lfsv_n,
247  LocalPattern& pattern_sn,
248  LocalPattern& pattern_ns)
249  {
251  tuple_element<i,Args>::type::doPatternSkeleton>::
252  pattern_skeleton(*get<i>(lops),
253  lfsu_s, lfsv_s, lfsu_n, lfsv_n,
254  pattern_sn, pattern_ns);
255  }
256  };
257 
258  template<int i>
259  struct PatternBoundaryOperation {
260  template<typename LFSU, typename LFSV, typename LocalPattern>
261  static void apply(const ArgPtrs& lops,
262  const LFSU& lfsu_s, const LFSV& lfsv_s,
263  LocalPattern& pattern_ss)
264  {
266  tuple_element<i,Args>::type::doPatternBoundary>::
267  pattern_boundary(*get<i>(lops), lfsu_s, lfsv_s, pattern_ss);
268  }
269  };
270 
271  public:
273 
278  template<typename LFSU, typename LFSV, typename LocalPattern>
279  void pattern_volume
280  ( const LFSU& lfsu, const LFSV& lfsv,
281  LocalPattern& pattern) const
282  {
283  ForLoop<PatternVolumeOperation, 0, size-1>::
284  apply(lops, lfsu, lfsv, pattern);
285  }
286 
289 
294  template<typename LFSU, typename LFSV, typename LocalPattern>
296  ( const LFSU& lfsu, const LFSV& lfsv,
297  LocalPattern& pattern) const
298  {
299  ForLoop<PatternVolumePostSkeletonOperation, 0, size-1>::
300  apply(lops, lfsu, lfsv, pattern);
301  }
302 
304 
309  template<typename LFSU, typename LFSV, typename LocalPattern>
310  void pattern_skeleton
311  ( const LFSU& lfsu_s, const LFSV& lfsv_s,
312  const LFSU& lfsu_n, const LFSV& lfsv_n,
313  LocalPattern& pattern_sn,
314  LocalPattern& pattern_ns) const
315  {
316  ForLoop<PatternSkeletonOperation, 0, size-1>::
317  apply(lops, lfsu_s, lfsv_s, lfsu_n, lfsv_n,
318  pattern_sn, pattern_ns);
319  }
320 
322 
327  template<typename LFSU, typename LFSV, typename LocalPattern>
328  void pattern_boundary
329  ( const LFSU& lfsu_s, const LFSV& lfsv_s,
330  LocalPattern& pattern_ss) const
331  {
332  ForLoop<PatternBoundaryOperation, 0, size-1>::
333  apply(lops, lfsu_s, lfsv_s, pattern_ss);
334  }
335 
337 
339  //
342  //
343 
344  private:
345  // template meta program helpers for the alpha_* methods
346 
347  template<int i>
348  struct AlphaVolumeOperation {
349  template<typename EG, typename LFSU, typename X, typename LFSV,
350  typename R>
351  static void apply(const ArgPtrs& lops, const EG& eg,
352  const LFSU& lfsu, const X& x, const LFSV& lfsv,
353  R& r)
354  {
356  tuple_element<i,Args>::type::doAlphaVolume>::
357  alpha_volume(*get<i>(lops), eg, lfsu, x, lfsv, r);
358  }
359  };
360 
361  template<int i>
362  struct AlphaVolumePostSkeletonOperation {
363  template<typename EG, typename LFSU, typename X, typename LFSV,
364  typename R>
365  static void apply(const ArgPtrs& lops, const EG& eg,
366  const LFSU& lfsu, const X& x, const LFSV& lfsv,
367  R& r)
368  {
370  tuple_element<i,Args>::type::doAlphaVolumePostSkeleton>::
371  alpha_volume_post_skeleton(*get<i>(lops), eg,
372  lfsu, x, lfsv,
373  r);
374  }
375  };
376 
377  template<int i>
378  struct AlphaSkeletonOperation {
379  template<typename IG, typename LFSU, typename X, typename LFSV,
380  typename R>
381  static void apply(const ArgPtrs& lops, const IG& ig,
382  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
383  const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
384  R& r_s, R& r_n)
385  {
387  tuple_element<i,Args>::type::doAlphaSkeleton>::
388  alpha_skeleton(*get<i>(lops), ig,
389  lfsu_s, x_s, lfsv_s,
390  lfsu_n, x_n, lfsv_n,
391  r_s, r_n);
392  }
393  };
394 
395  template<int i>
396  struct AlphaBoundaryOperation {
397  template<typename IG, typename LFSU, typename X, typename LFSV,
398  typename R>
399  static void apply(const ArgPtrs& lops, const IG& ig,
400  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
401  R& r_s)
402  {
404  tuple_element<i,Args>::type::doAlphaBoundary>::
405  alpha_boundary(*get<i>(lops), ig, lfsu_s, x_s, lfsv_s, r_s);
406  }
407  };
408 
409  public:
411 
415  template<typename EG, typename LFSU, typename X, typename LFSV,
416  typename R>
417  void alpha_volume
418  ( const EG& eg,
419  const LFSU& lfsu, const X& x, const LFSV& lfsv,
420  R& r) const
421  {
422  ForLoop<AlphaVolumeOperation, 0, size-1>::
423  apply(lops, eg, lfsu, x, lfsv, r);
424  }
425 
428 
432  template<typename EG, typename LFSU, typename X, typename LFSV,
433  typename R>
435  ( const EG& eg,
436  const LFSU& lfsu, const X& x, const LFSV& lfsv,
437  R& r) const
438  {
439  ForLoop<AlphaVolumePostSkeletonOperation, 0, size-1>::
440  apply(lops, eg, lfsu, x, lfsv, r);
441  }
442 
444 
448  template<typename IG, typename LFSU, typename X, typename LFSV,
449  typename R>
450  void alpha_skeleton
451  ( const IG& ig,
452  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
453  const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
454  R& r_s, R& r_n) const
455  {
456  ForLoop<AlphaSkeletonOperation, 0, size-1>::
457  apply(lops, ig,
458  lfsu_s, x_s, lfsv_s,
459  lfsu_n, x_n, lfsv_n,
460  r_s, r_n);
461  }
462 
464 
468  template<typename IG, typename LFSU, typename X, typename LFSV,
469  typename R>
470  void alpha_boundary
471  ( const IG& ig,
472  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
473  R& r_s) const
474  {
475  ForLoop<AlphaVolumePostSkeletonOperation, 0, size-1>::
476  apply(lops, ig, lfsu_s, x_s, lfsv_s, r_s);
477  }
478 
480 
482  //
485  //
486 
487  private:
488  // template meta program helpers for the lambda_* methods
489 
490  template<int i>
491  struct LambdaVolumeOperation {
492  template<typename EG, typename LFSV, typename R>
493  static void apply(const ArgPtrs& lops, const EG& eg,
494  const LFSV& lfsv,
495  R& r)
496  {
498  tuple_element<i,Args>::type::doLambdaVolume>::
499  lambda_volume(*get<i>(lops), eg, lfsv, r);
500  }
501  };
502 
503  template<int i>
504  struct LambdaVolumePostSkeletonOperation {
505  template<typename EG, typename LFSV, typename R>
506  static void apply(const ArgPtrs& lops, const EG& eg,
507  const LFSV& lfsv,
508  R& r)
509  {
511  tuple_element<i,Args>::type::doLambdaVolumePostSkeleton>::
512  lambda_volume_post_skeleton(*get<i>(lops), eg, lfsv, r);
513  }
514  };
515 
516  template<int i>
517  struct LambdaSkeletonOperation {
518  template<typename IG, typename LFSV, typename R>
519  static void apply(const ArgPtrs& lops, const IG& ig,
520  const LFSV& lfsv_s,
521  const LFSV& lfsv_n,
522  R& r_s, R& r_n)
523  {
525  tuple_element<i,Args>::type::doLambdaSkeleton>::
526  lambda_skeleton(*get<i>(lops), ig,
527  lfsv_s, lfsv_n,
528  r_s, r_n);
529  }
530  };
531 
532  template<int i>
533  struct LambdaBoundaryOperation {
534  template<typename IG, typename LFSV, typename R>
535  static void apply(const ArgPtrs& lops, const IG& ig,
536  const LFSV& lfsv_s,
537  R& r_s)
538  {
540  tuple_element<i,Args>::type::doLambdaBoundary>::
541  lambda_boundary(*get<i>(lops), ig, lfsv_s, r_s);
542  }
543  };
544 
545  public:
547 
551  template<typename EG, typename LFSV, typename R>
552  void lambda_volume(const EG& eg, const LFSV& lfsv, R& r) const
553  {
554  ForLoop<LambdaVolumeOperation, 0, size-1>::
555  apply(lops, eg, lfsv, r);
556  }
557 
560 
564  template<typename EG, typename LFSV, typename R>
565  void lambda_volume_post_skeleton(const EG& eg,
566  const LFSV& lfsv,
567  R& r) const
568  {
569  ForLoop<LambdaVolumePostSkeletonOperation, 0, size-1>::
570  apply(lops, eg, lfsv, r);
571  }
572 
574 
578  template<typename IG, typename LFSV, typename R>
579  void lambda_skeleton(const IG& ig,
580  const LFSV& lfsv_s, const LFSV& lfsv_n,
581  R& r_s, R& r_n) const
582  {
583  ForLoop<LambdaSkeletonOperation, 0, size-1>::
584  apply(lops, ig, lfsv_s, lfsv_n, r_s, r_n);
585  }
586 
588 
592  template<typename IG, typename LFSV, typename R>
593  void lambda_boundary(const IG& ig, const LFSV& lfsv_s, R& r_s) const
594  {
595  ForLoop<LambdaBoundaryOperation, 0, size-1>::
596  apply(lops, ig, lfsv_s, r_s);
597  }
598 
600 
602  //
605  //
606 
607  private:
608  // template meta program helpers for the jacobian_apply_* methods
609 
610  template<int i>
611  struct JacobianApplyVolumeOperation {
612  template<typename EG, typename LFSU, typename X, typename LFSV,
613  typename Y>
614  static void apply(const ArgPtrs& lops, const EG& eg,
615  const LFSU& lfsu, const X& x, const LFSV& lfsv,
616  Y& y)
617  {
619  tuple_element<i,Args>::type::doAlphaVolume>::
620  jacobian_apply_volume(*get<i>(lops), eg, lfsu, x, lfsv, y);
621  }
622  };
623 
624  template<int i>
625  struct JacobianApplyVolumePostSkeletonOperation {
626  template<typename EG, typename LFSU, typename X, typename LFSV,
627  typename Y>
628  static void apply(const ArgPtrs& lops, const EG& eg,
629  const LFSU& lfsu, const X& x, const LFSV& lfsv,
630  Y& y)
631  {
633  tuple_element<i,Args>::type::doAlphaVolumePostSkeleton>::
634  jacobian_apply_volume_post_skeleton(*get<i>(lops), eg,
635  lfsu, x, lfsv,
636  y);
637  }
638  };
639 
640  template<int i>
641  struct JacobianApplySkeletonOperation {
642  template<typename IG, typename LFSU, typename X, typename LFSV,
643  typename Y>
644  static void apply(const ArgPtrs& lops, const IG& ig,
645  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
646  const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
647  Y& y_s, Y& y_n)
648  {
650  tuple_element<i,Args>::type::doAlphaSkeleton>::
651  jacobian_apply_skeleton(*get<i>(lops), ig,
652  lfsu_s, x_s, lfsv_s,
653  lfsu_n, x_n, lfsv_n,
654  y_s, y_n);
655  }
656  };
657 
658  template<int i>
659  struct JacobianApplyBoundaryOperation {
660  template<typename IG, typename LFSU, typename X, typename LFSV,
661  typename Y>
662  static void apply(const ArgPtrs& lops, const IG& ig,
663  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
664  Y& y_s)
665  {
667  tuple_element<i,Args>::type::doAlphaBoundary>::
668  jacobian_apply_boundary(*get<i>(lops), ig,
669  lfsu_s, x_s, lfsv_s,
670  y_s);
671  }
672  };
673 
674  public:
676 
680  template<typename EG, typename LFSU, typename X, typename LFSV,
681  typename Y>
683  ( const EG& eg,
684  const LFSU& lfsu, const X& x, const LFSV& lfsv,
685  Y& y) const
686  {
687  ForLoop<JacobianApplyVolumeOperation, 0, size-1>::
688  apply(lops, eg, lfsu, x, lfsv, y);
689  }
690 
693 
697  template<typename EG, typename LFSU, typename X, typename LFSV,
698  typename Y>
700  ( const EG& eg,
701  const LFSU& lfsu, const X& x, const LFSV& lfsv,
702  Y& y) const
703  {
704  ForLoop<JacobianApplyVolumePostSkeletonOperation, 0, size-1>::
705  apply(lops, eg, lfsu, x, lfsv, y);
706  }
707 
709 
713  template<typename IG, typename LFSU, typename X, typename LFSV,
714  typename Y>
716  ( const IG& ig,
717  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
718  const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
719  Y& y_s, Y& y_n) const
720  {
721  ForLoop<JacobianApplySkeletonOperation, 0, size-1>::
722  apply(lops, ig,
723  lfsu_s, x_s, lfsv_s,
724  lfsu_n, x_n, lfsv_n,
725  y_s, y_n);
726  }
727 
729 
733  template<typename IG, typename LFSU, typename X, typename LFSV,
734  typename Y>
736  ( const IG& ig,
737  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
738  Y& y_s) const
739  {
740  ForLoop<JacobianApplyBoundaryOperation, 0, size-1>::
741  apply(lops, ig, lfsu_s, x_s, lfsv_s, y_s);
742  }
743 
745 
747  //
750  //
751 
752  private:
753  // template meta program helpers for the jacobian_apply_* methods
754 
755  template<int i>
756  struct JacobianVolumeOperation {
757  template<typename EG, typename LFSU, typename X, typename LFSV,
758  typename LocalMatrix>
759  static void apply(const ArgPtrs& lops, const EG& eg,
760  const LFSU& lfsu, const X& x, const LFSV& lfsv,
761  LocalMatrix& mat)
762  {
764  tuple_element<i,Args>::type::doAlphaVolume>::
765  jacobian_volume(*get<i>(lops), eg, lfsu, x, lfsv, mat);
766  }
767  };
768 
769  template<int i>
770  struct JacobianVolumePostSkeletonOperation {
771  template<typename EG, typename LFSU, typename X, typename LFSV,
772  typename LocalMatrix>
773  static void apply(const ArgPtrs& lops, const EG& eg,
774  const LFSU& lfsu, const X& x, const LFSV& lfsv,
775  LocalMatrix& mat)
776  {
778  tuple_element<i,Args>::type::doAlphaVolumePostSkeleton>::
779  jacobian_volume_post_skeleton(*get<i>(lops), eg,
780  lfsu, x, lfsv,
781  mat);
782  }
783  };
784 
785  template<int i>
786  struct JacobianSkeletonOperation {
787  template<typename IG, typename LFSU, typename X, typename LFSV,
788  typename LocalMatrix>
789  static void apply(const ArgPtrs& lops, const IG& ig,
790  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
791  const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
792  LocalMatrix& mat_ss, LocalMatrix& mat_sn,
793  LocalMatrix& mat_ns, LocalMatrix& mat_nn)
794  {
796  tuple_element<i,Args>::type::doAlphaSkeleton>::
797  jacobian_skeleton(*get<i>(lops), ig,
798  lfsu_s, x_s, lfsv_s,
799  lfsu_n, x_n, lfsv_n,
800  mat_ss, mat_sn, mat_ns, mat_nn);
801  }
802  };
803 
804  template<int i>
805  struct JacobianBoundaryOperation {
806  template<typename IG, typename LFSU, typename X, typename LFSV,
807  typename LocalMatrix>
808  static void apply(const ArgPtrs& lops, const IG& ig,
809  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
810  LocalMatrix& mat_ss)
811  {
813  tuple_element<i,Args>::type::doAlphaBoundary>::
814  jacobian_boundary(*get<i>(lops), ig,
815  lfsu_s, x_s, lfsv_s, mat_ss);
816  }
817  };
818 
819  public:
821 
825  template<typename EG, typename LFSU, typename X, typename LFSV,
826  typename LocalMatrix>
827  void jacobian_volume
828  ( const EG& eg,
829  const LFSU& lfsu, const X& x, const LFSV& lfsv,
830  LocalMatrix& mat) const
831  {
832  ForLoop<JacobianVolumeOperation, 0, size-1>::
833  apply(lops, eg, lfsu, x, lfsv, mat);
834  }
835 
837 
841  template<typename EG, typename LFSU, typename X, typename LFSV,
842  typename LocalMatrix>
844  ( const EG& eg,
845  const LFSU& lfsu, const X& x, const LFSV& lfsv,
846  LocalMatrix& mat) const
847  {
848  ForLoop<JacobianVolumePostSkeletonOperation, 0, size-1>::
849  apply(lops, eg, lfsu, x, lfsv, mat);
850  }
851 
853 
857  template<typename IG, typename LFSU, typename X, typename LFSV,
858  typename LocalMatrix>
859  void jacobian_skeleton
860  ( const IG& ig,
861  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
862  const LFSU& lfsu_n, const X& x_n, const LFSV& lfsv_n,
863  LocalMatrix& mat_ss, LocalMatrix& mat_sn,
864  LocalMatrix& mat_ns, LocalMatrix& mat_nn) const
865  {
866  ForLoop<JacobianSkeletonOperation, 0, size-1>::
867  apply(lops, ig,
868  lfsu_s, x_s, lfsv_s,
869  lfsu_n, x_n, lfsv_n,
870  mat_ss, mat_sn, mat_ns, mat_nn);
871  }
872 
874 
878  template<typename IG, typename LFSU, typename X, typename LFSV,
879  typename LocalMatrix>
880  void jacobian_boundary
881  ( const IG& ig,
882  const LFSU& lfsu_s, const X& x_s, const LFSV& lfsv_s,
883  LocalMatrix& mat_ss) const
884  {
885  ForLoop<JacobianBoundaryOperation, 0, size-1>::
886  apply(lops, ig, lfsu_s, x_s, lfsv_s, mat_ss);
887  }
888 
890 
892  //
895  //
896 
898  typedef typename tuple_element<0, Args>::type::RealType RealType;
899 
900  private:
901  // template meta program helpers for the methods related to instationary
902  // stuff
903 
904  template<int i> struct SetTimeOperation {
905  static void apply(ArgPtrs& lops, RealType t)
906  { get<i>(lops)->setTime(t); }
907  };
908 
909  template<int i> struct PreStepOperation {
910  static void apply(ArgPtrs& lops,
911  RealType time, RealType dt, int stages)
912  { get<i>(lops)->preStep(time, dt, stages); }
913  };
914 
915  template<int i> struct PostStepOperation {
916  static void apply(ArgPtrs& lops)
917  { get<i>(lops)->postStep(); }
918  };
919 
920  template<int i> struct PreStageOperation {
921  static void apply(ArgPtrs& lops, RealType time, int r)
922  { get<i>(lops)->preStage(time, r); }
923  };
924 
925  template<int i> struct PostStageOperation {
926  static void apply(ArgPtrs& lops)
927  { get<i>(lops)->postStage(); }
928  };
929 
930  template<int i> struct SuggestTimestepOperation {
931  static void apply(ArgPtrs& lops, RealType& dt)
932  { dt = get<i>(lops)->suggestTimestep(dt); }
933  };
934 
935  public:
937  void setTime (RealType t)
938  {
939  ForLoop<SetTimeOperation, 0, size-1>::apply(lops, t);
940  }
941 
943  RealType getTime () const
944  {
945  return get<0>(lops)->getTime();
946  }
947 
949  void preStep (RealType time, RealType dt, int stages)
950  {
951  ForLoop<PreStepOperation, 0, size-1>::apply(lops, time, dt, stages);
952  }
953 
955  void postStep ()
956  {
957  ForLoop<PostStepOperation, 0, size-1>::apply(lops);
958  }
959 
961  void preStage (RealType time, int r)
962  {
963  ForLoop<PreStageOperation, 0, size-1>::apply(lops, time, r);
964  }
965 
967  int getStage () const
968  {
969  return get<0>(lops)->getStage();
970  }
971 
973  void postStage ()
974  {
975  ForLoop<PostStageOperation, 0, size-1>::apply(lops);
976  }
977 
979 
984  RealType suggestTimestep (RealType dt) const
985  {
986  ForLoop<SuggestTimestepOperation, 0, size-1>::apply(lops, dt);
987  return dt;
988  }
989 
991  };
992 
994  }
995 }
996 
997 #endif // DUNE_PDELAB_LOCALOPERATOR_SUM_HH
RealType getTime() const
get current time
Definition: sum.hh:943
tuple_element< i, Args >::type & getSummand()
get the i&#39;th component of the sum
Definition: sum.hh:58
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&#39;s jacobians
Definition: sum.hh:716
void setTime(RealType t)
set time for subsequent evaluation
Definition: sum.hh:937
static const unsigned int value
Definition: gridfunctionspace/tags.hh:177
const IG & ig
Definition: constraints.hh:148
void postStage()
to be called once at the end of each stage
Definition: sum.hh:973
void preStage(RealType time, int r)
to be called once before each stage
Definition: sum.hh:961
void lambda_volume_post_skeleton(const EG &eg, const LFSV &lfsv, R &r) const
get an element&#39;s contribution to lambda after the intersections have been handled ...
Definition: sum.hh:565
void pattern_volume_post_skeleton(const LFSU &lfsu, const LFSV &lfsv, LocalPattern &pattern) const
get an element&#39;s contribution to the sparsity pattern after the intersections have been handled ...
Definition: sum.hh:296
Definition: adaptivity.hh:27
void preStep(RealType time, RealType dt, int stages)
to be called once before each time step
Definition: sum.hh:949
int getStage() const
get current stage
Definition: sum.hh:967
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&#39;s contribution to alpha
Definition: sum.hh:451
InstationarySumLocalOperator(const ArgRefs &lops_)
construct a InstationarySumLocalOperator from a tuple of local operators
Definition: sum.hh:47
void jacobian_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, LocalMatrix &mat) const
get an element&#39;s jacobian after the intersections have been handled
Definition: sum.hh:844
void setSummand(typename tuple_element< i, Args >::type &summand)
set the i&#39;th component of the sum
Definition: sum.hh:53
void jacobian_apply_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, Y &y) const
apply an element&#39;s jacobian
Definition: sum.hh:683
void pattern_boundary(const LFSU &lfsu_s, const LFSV &lfsv_s, LocalPattern &pattern_ss) const
get a boundary intersection&#39;s contribution to the sparsity pattern
Definition: sum.hh:329
RealType suggestTimestep(RealType dt) const
to be called after stage 1
Definition: sum.hh:984
void alpha_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
get an element&#39;s contribution to alpha after the intersections have been handled
Definition: sum.hh:435
void lambda_volume(const EG &eg, const LFSV &lfsv, R &r) const
get an element&#39;s contribution to lambda
Definition: sum.hh:552
A dense matrix for storing data associated with the degrees of freedom of a pair of LocalFunctionSpac...
Definition: localmatrix.hh:184
void pattern_volume(const LFSU &lfsu, const LFSV &lfsv, LocalPattern &pattern) const
get an element&#39;s contribution to the sparsity pattern
Definition: sum.hh:280
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&#39;s contribution to alpha
Definition: sum.hh:471
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&#39;s contribution to the sparsity pattern
Definition: sum.hh:311
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&#39;s jacobian
Definition: sum.hh:736
void postStep()
to be called once at the end of each time step
Definition: sum.hh:955
void jacobian_apply_volume_post_skeleton(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, Y &y) const
apply an element&#39;s jacobian after the intersections have been handled
Definition: sum.hh:700
void jacobian_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, LocalMatrix &mat) const
get an element&#39;s jacobian
Definition: sum.hh:828
void alpha_volume(const EG &eg, const LFSU &lfsu, const X &x, const LFSV &lfsv, R &r) const
get an element&#39;s contribution to alpha
Definition: sum.hh:418
tuple_element< 0, Args >::type::RealType RealType
Export type used for time values.
Definition: sum.hh:898
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&#39;s contribution to lambda
Definition: sum.hh:579
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&#39;s jacobian
Definition: sum.hh:881
void lambda_boundary(const IG &ig, const LFSV &lfsv_s, R &r_s) const
get a boundary intersections&#39;s contribution to lambda
Definition: sum.hh:593
Definition: callswitch.hh:63
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&#39;s jacobians
Definition: sum.hh:860
A local operator to take the sum of other local operators.
Definition: sum.hh:29