3 #ifndef DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS1_CUBE2D_LOCALINTERPOLATION_HH
4 #define DUNE_LOCALFUNCTIONS_RAVIARTTHOMAS1_CUBE2D_LOCALINTERPOLATION_HH
8 #include <dune/geometry/quadraturerules.hh>
35 sign0 = sign1 = sign2 = sign3 = 1.0;
71 template<
class F,
class C>
75 typedef typename LB::Traits::RangeFieldType Scalar;
76 typedef typename LB::Traits::DomainFieldType Vector;
78 auto&& f = Impl::makeFunctionWithCallOperator<typename LB::Traits::DomainType>(ff);
81 fill(out.begin(), out.end(), 0.0);
84 const QuadratureRule<Scalar,1>& rule1 = QuadratureRules<Scalar,1>::rule(GeometryTypes::cube(1), qOrder);
86 for (
typename QuadratureRule<Scalar,1>::const_iterator it = rule1.begin();
87 it != rule1.end(); ++it)
89 Scalar qPos = it->position();
90 typename LB::Traits::DomainType localPos;
95 out[0] += (y[0]*n0[0] + y[1]*n0[1])*it->weight()*sign0;
96 out[1] += (y[0]*n0[0] + y[1]*n0[1])*(2.0*qPos - 1.0)*it->weight();
101 out[2] += (y[0]*n1[0] + y[1]*n1[1])*it->weight()*sign1;
102 out[3] += (y[0]*n1[0] + y[1]*n1[1])*(1.0 - 2.0*qPos)*it->weight();
107 out[4] += (y[0]*n2[0] + y[1]*n2[1])*it->weight()*sign2;
108 out[5] += (y[0]*n2[0] + y[1]*n2[1])*(1.0 - 2.0*qPos)*it->weight();
113 out[6] += (y[0]*n3[0] + y[1]*n3[1])*it->weight()*sign3;
114 out[7] += (y[0]*n3[0] + y[1]*n3[1])*(2.0*qPos - 1.0)*it->weight();
117 const QuadratureRule<Vector,2>& rule2 = QuadratureRules<Vector,2>::rule(GeometryTypes::cube(2), qOrder);
119 for (
typename QuadratureRule<Vector,2>::const_iterator it=rule2.begin(); it!=rule2.end(); ++it)
121 FieldVector<double,2> qPos = it->position();
124 out[8] += y[0]*it->weight();
125 out[9] += y[1]*it->weight();
126 out[10] += y[0]*qPos[1]*it->weight();
127 out[11] += y[1]*qPos[0]*it->weight();
132 typename LB::Traits::RangeFieldType sign0, sign1, sign2, sign3;
133 typename LB::Traits::DomainType n0, n1, n2, n3;
Definition: bdfmcube.hh:16
First order Raviart-Thomas shape functions on the reference quadrilateral.
Definition: raviartthomas1cube2dlocalinterpolation.hh:25
void interpolate(const F &ff, std::vector< C > &out) const
Interpolate a given function with shape functions.
Definition: raviartthomas1cube2dlocalinterpolation.hh:72
RT1Cube2DLocalInterpolation(unsigned int s=0)
Make set number s, where 0 <= s < 16.
Definition: raviartthomas1cube2dlocalinterpolation.hh:33