3 #ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS12DLOCALINTERPOLATION_HH
4 #define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS12DLOCALINTERPOLATION_HH
8 #include <dune/geometry/quadraturerules.hh>
35 sign0 = sign1 = sign2 = 1.0;
52 n2[0] = 1.0/sqrt(2.0);
53 n2[1] = 1.0/sqrt(2.0);
54 c0 = 0.5*n0[0] - 1.0*n0[1];
55 c1 = -1.0*n1[0] + 0.5*n1[1];
56 c2 = 0.5*n2[0] + 0.5*n2[1];
67 template<
typename F,
typename C>
71 typedef typename LB::Traits::RangeFieldType Scalar;
72 typedef typename LB::Traits::DomainFieldType Vector;
74 auto&& f = Impl::makeFunctionWithCallOperator<typename LB::Traits::DomainType>(ff);
77 fill(out.begin(), out.end(), 0.0);
79 const int qOrder1 = 4;
80 const Dune::QuadratureRule<Scalar,1>& rule1 = Dune::QuadratureRules<Scalar,1>::rule(Dune::GeometryTypes::simplex(1), qOrder1);
82 for (
typename Dune::QuadratureRule<Scalar,1>::const_iterator it = rule1.begin();
83 it != rule1.end(); ++it)
85 Scalar qPos = it->position();
86 typename LB::Traits::DomainType localPos;
91 out[0] += (y[0]*n0[0] + y[1]*n0[1])*it->weight()*sign0/c0;
92 out[3] += (y[0]*n0[0] + y[1]*n0[1])*(2.0*qPos - 1.0)*it->weight()/c0;
97 out[1] += (y[0]*n1[0] + y[1]*n1[1])*it->weight()*sign1/c1;
98 out[4] += (y[0]*n1[0] + y[1]*n1[1])*(1.0 - 2.0*qPos)*it->weight()/c1;
100 localPos[0] = 1.0 - qPos;
103 out[2] += (y[0]*n2[0] + y[1]*n2[1])*it->weight()*sign2/c2;
104 out[5] += (y[0]*n2[0] + y[1]*n2[1])*(2.0*qPos - 1.0)*it->weight()/c2;
107 const int qOrder2 = 8;
108 const Dune::QuadratureRule<Vector,2>& rule2 = Dune::QuadratureRules<Vector,2>::rule(Dune::GeometryTypes::simplex(2), qOrder2);
110 for (
typename Dune::QuadratureRule<Vector,2>::const_iterator it = rule2.begin();
111 it != rule2.end(); ++it)
113 Dune::FieldVector<double,2> qPos = it->position();
116 out[6] += y[0]*it->weight();
117 out[7] += y[1]*it->weight();
122 typename LB::Traits::RangeFieldType sign0,sign1,sign2;
123 typename LB::Traits::DomainType n0,n1,n2;
124 typename LB::Traits::RangeFieldType c0,c1,c2;
Definition: bdfmcube.hh:16
First order Raviart-Thomas shape functions on the reference quadrilateral.
Definition: raviartthomas12dlocalinterpolation.hh:24
RT12DLocalInterpolation(unsigned int s=0)
Make set number s, where 0 <= s < 8.
Definition: raviartthomas12dlocalinterpolation.hh:33
void interpolate(const F &ff, std::vector< C > &out) const
Interpolate a given function with shape functions.
Definition: raviartthomas12dlocalinterpolation.hh:68