2#ifndef DUNE_PDELAB_BACKEND_ISTL_CG_TO_DG_PROLONGATION_HH
3#define DUNE_PDELAB_BACKEND_ISTL_CG_TO_DG_PROLONGATION_HH
10#include <dune/localfunctions/common/interfaceswitch.hh>
12#include <dune/typetree/pairtraversal.hh>
13#include <dune/typetree/transformation.hh>
14#include <dune/typetree/visitor.hh>
16#include <dune/pdelab/common/geometrywrapper.hh>
17#include <dune/pdelab/gridoperator/common/localmatrix.hh>
18#include <dune/pdelab/localoperator/pattern.hh>
19#include <dune/pdelab/localoperator/flags.hh>
20#include <dune/pdelab/localoperator/idefault.hh>
29 namespace CG2DGHelper {
31 template <
typename Imp>
32 struct WrappedLocalShapeFunctionTraits {
33 typedef typename Imp::Traits::FiniteElementType::
34 Traits::LocalBasisType::Traits::RangeType RangeType;
35 typedef typename Imp::Traits::FiniteElementType::
36 Traits::LocalBasisType::Traits::DomainType DomainType;
40 template<
typename Imp>
41 class WrappedLocalShapeFunction
46 typedef typename Imp::Traits::FiniteElementType FEM;
47 typedef FiniteElementInterfaceSwitch<FEM> FESwitch;
48 typedef BasisInterfaceSwitch<typename FESwitch::Basis > BasisSwitch;
53 typedef WrappedLocalShapeFunctionTraits<Imp> Traits;
54 WrappedLocalShapeFunction (
const Imp& imp,
int comp) :
55 _imp(imp), _comp(comp) {}
60 _imp.finiteElement().localBasis().evaluateFunction(x,v);
66 class ComputeCG2DGVisitor :
67 public TypeTree::DefaultPairVisitor,
68 public TypeTree::DynamicTraversal,
69 public TypeTree::VisitTree
74 ComputeCG2DGVisitor(LocalMatrix<R>& mat) :
78 template<
typename LFSU,
typename LFSV,
typename TreePath>
79 void leaf(
const LFSU& lfsu,
const LFSV& lfsv, TreePath
treePath)
const
82 typedef typename LFSV::Traits::FiniteElementType DG_FEM;
83 typedef FiniteElementInterfaceSwitch<DG_FEM> FESwitch;
84 typedef BasisInterfaceSwitch<typename FESwitch::Basis > BasisSwitch;
85 typedef typename BasisSwitch::DomainField DF;
87 for (
unsigned int i=0; i<lfsu.size(); i++)
90 WrappedLocalShapeFunction<LFSU> f(lfsu, i);
92 FESwitch::interpolation(lfsv.finiteElement()).
95 for (
unsigned int j=0; j<lfsv.size(); j++)
97 _mat(lfsv,j,lfsu,i) = v[j];
106 class CG2DGProlongation :
107 public FullVolumePattern,
108 public LocalOperatorDefaultFlags,
109 public InstationaryLocalOperatorDefaultMethods<double>
111 template<
typename LFSU,
typename LFSV,
typename R>
112 void computeCG2DG(
const LFSU & lfsu,
const LFSV & lfsv,
113 LocalMatrix<R>& mat)
const
117 CG2DGHelper::ComputeCG2DGVisitor<R> cg2dg(mat);
122 enum { doPatternVolume =
true };
125 enum { doAlphaVolume =
true };
127 CG2DGProlongation () {}
134 template<
typename EG,
typename LFSU,
typename X,
typename LFSV,
typename M>
135 void jacobian_volume (
const EG&,
const LFSU& lfsu,
const X&,
const LFSV& lfsv,
138 computeCG2DG(lfsu, lfsv, mat.container());
vector space out of a tensor product of fields.
Definition: fvector.hh:91
A few common exception classes.
Implements a vector constructed from a given type representing a field and a compile-time given size.
void interpolate(const F &f, const GFS &gfs, XG &xg)
interpolation from a given grid function
Definition: interpolate.hh:177
constexpr auto treePath(const T &... t)
Constructs a new HybridTreePath from the given indices.
Definition: treepath.hh:326
void applyToTreePair(Tree1 &&tree1, Tree2 &&tree2, Visitor &&visitor)
Apply visitor to a pair of TypeTrees.
Definition: pairtraversal.hh:128
Dune namespace.
Definition: alignedallocator.hh:13
static const std::size_t dimDomainLocal
export dimension of local coordinates
Definition: interfaceswitch.hh:158
Basis::Traits::Range Range
export vector type of the values
Definition: interfaceswitch.hh:167
Basis::Traits::DomainField DomainField
export field types of the coordinates
Definition: interfaceswitch.hh:156
void leaf(T1 &&, T2 &&, TreePath) const
Method for leaf traversal.
Definition: visitor.hh:216