Go to the documentation of this file.
4 #ifndef DUNE_PDELAB_FINITEELEMENT_QKDGLOBATTO_HH
5 #define DUNE_PDELAB_FINITEELEMENT_QKDGLOBATTO_HH
7 #include <dune/localfunctions/common/localbasis.hh>
8 #include <dune/localfunctions/common/localkey.hh>
9 #include <dune/localfunctions/common/localfiniteelementtraits.hh>
10 #include <dune/localfunctions/common/localtoglobaladaptors.hh>
18 template<
class D,
class R,
int k>
29 for (
int order=1; order<=40; order++)
31 const Dune::QuadratureRule<D,1>& rule = Dune::QuadratureRules<D,1>::rule(Dune::GeometryType::cube,order,Dune::QuadratureType::GaussLobatto);
34 matched_order = order;
35 matched_size = rule.size();
40 if (matched_order<0) DUNE_THROW(Dune::Exception,
"could not find Gauss Lobatto rule of appropriate size");
41 const Dune::QuadratureRule<D,1>& rule = Dune::QuadratureRules<D,1>::rule(Dune::GeometryType::cube,matched_order,Dune::QuadratureType::GaussLobatto);
43 for (
typename Dune::QuadratureRule<D,1>::const_iterator it=rule.begin(); it!=rule.end(); ++it)
46 size_t member=count%2;
48 if (member==1) newj=group;
else newj=k-group;
49 xi_gl[newj] = it->position()[0];
50 w_gl[newj] = it->weight();
53 for (
int j=0; j<matched_size/2; j++)
57 xi_gl[j] = xi_gl[k-j];
71 R
p (
int i, D
x)
const
74 for (
int j=0; j<=k; j++)
75 if (j!=i) result *= (
x-xi_gl[j])/(xi_gl[i]-xi_gl[j]);
80 R
dp (
int i, D
x)
const
84 for (
int j=0; j<=k; j++)
87 R prod( 1.0/(xi_gl[i]-xi_gl[j]) );
88 for (
int l=0; l<=k; l++)
89 if (l!=i && l!=j) prod *= (
x-xi_gl[l])/(xi_gl[i]-xi_gl[l]);
120 template<
class D,
class R,
int k,
int d>
127 typedef LocalBasisTraits<D,d,Dune::FieldVector<D,d>,R,1,Dune::FieldVector<R,1>,Dune::FieldMatrix<R,1,d> >
Traits;
137 std::vector<typename Traits::RangeType>& out)
const
140 for (
size_t i=0; i<
size(); i++)
143 Dune::FieldVector<int,d> alpha(multiindex<k,d>(i));
149 for (
int j=0; j<d; j++)
150 out[i] *= poly.
p(alpha[j],in[j]);
157 std::vector<typename Traits::JacobianType>& out)
const
162 for (
size_t i=0; i<
size(); i++)
165 Dune::FieldVector<int,d> alpha(multiindex<k,d>(i));
168 for (
int j=0; j<d; j++)
172 out[i][0][j] = poly.
dp(alpha[j],in[j]);
175 for (
int l=0; l<d; l++)
177 out[i][0][j] *= poly.
p(alpha[l],in[l]);
190 template<
int k,
int d,
class LB>
198 template<
typename F,
typename C>
201 typename LB::Traits::DomainType x;
202 typename LB::Traits::RangeType y;
209 Dune::FieldVector<int,d> alpha(multiindex<k,d>(i));
212 for (
int j=0; j<d; j++)
213 x[j] = poly.
x(alpha[j]);
215 f.evaluate(x,y); out[i] = y;
221 template<
int d,
class LB>
226 template<
typename F,
typename C>
229 typename LB::Traits::DomainType x(0.5);
230 typename LB::Traits::RangeType y;
241 template<
class D,
class R,
int k,
int d>
254 typedef LocalFiniteElementTraits<LocalBasis,LocalCoefficients,LocalInterpolation>
Traits;
259 : gt(GeometryTypes::cube(d))
280 return interpolation;
297 LocalCoefficients coefficients;
298 LocalInterpolation interpolation;
308 template<
class Geometry,
class RF,
int k>
310 public ScalarLocalToGlobalFiniteElementAdaptorFactory<
311 QkDGGLLocalFiniteElement<
312 typename Geometry::ctype, RF, k, Geometry::mydimension
318 typename Geometry::ctype, RF, k, Geometry::mydimension
320 typedef ScalarLocalToGlobalFiniteElementAdaptorFactory<LFE, Geometry> Base;
322 static const LFE lfe;
329 template<
class Geometry,
class RF,
int k>
330 const typename QkDGGLFiniteElementFactory<Geometry, RF, k>::LFE
331 QkDGGLFiniteElementFactory<Geometry, RF, k>::lfe;
335 #endif // DUNE_PDELAB_FINITEELEMENT_QKDGLOBATTO_HH
Layout map for Q1 elements.
Definition: qkdglagrange.hh:214
const Traits::LocalBasisType & localBasis() const
Definition: qkdglobatto.hh:264
QkDGGLFiniteElementFactory()
default constructor
Definition: qkdglobatto.hh:326
const Traits::LocalInterpolationType & localInterpolation() const
Definition: qkdglobatto.hh:278
For backward compatibility – Do not use this!
Definition: adaptivity.hh:28
Factory for global-valued QkDG elements.
Definition: qkdglobatto.hh:309
QkDGGLLocalFiniteElement * clone() const
Definition: qkdglobatto.hh:290
R dp(int i, D x) const
Definition: qkdglobatto.hh:80
Lagrange polynomials at Gauss-Lobatto points.
Definition: qkdglobatto.hh:19
unsigned int size() const
number of shape functions
Definition: qkdglobatto.hh:130
@ n
Definition: qkdglobatto.hh:250
GeometryType type() const
Definition: qkdglobatto.hh:285
Definition: qkdglobatto.hh:242
Definition: qkdglagrange.hh:21
Definition: qkdglobatto.hh:191
R p(int i, D x) const
Definition: qkdglobatto.hh:71
QkDGGLLocalFiniteElement()
Definition: qkdglobatto.hh:258
R x(int i) const
Definition: qkdglobatto.hh:96
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition: qkdglobatto.hh:199
Lagrange shape functions of order k on the reference cube.
Definition: qkdglobatto.hh:121
void interpolate(const F &f, std::vector< C > &out) const
Local interpolation of a function.
Definition: qkdglobatto.hh:227
GaussLobattoLagrangePolynomials()
Definition: qkdglobatto.hh:25
void evaluateFunction(const typename Traits::DomainType &in, std::vector< typename Traits::RangeType > &out) const
Evaluate all shape functions.
Definition: qkdglobatto.hh:136
static const unsigned int value
Definition: gridfunctionspace/tags.hh:139
void evaluateJacobian(const typename Traits::DomainType &in, std::vector< typename Traits::JacobianType > &out) const
Evaluate Jacobian of all shape functions.
Definition: qkdglobatto.hh:156
LocalFiniteElementTraits< LocalBasis, LocalCoefficients, LocalInterpolation > Traits
Definition: qkdglobatto.hh:254
LocalBasisTraits< D, d, Dune::FieldVector< D, d >, R, 1, Dune::FieldVector< R, 1 >, Dune::FieldMatrix< R, 1, d > > Traits
Definition: qkdglobatto.hh:127
unsigned int order() const
Polynomial order of the shape functions.
Definition: qkdglobatto.hh:183
R w(int i) const
Definition: qkdglobatto.hh:102
const Traits::LocalCoefficientsType & localCoefficients() const
Definition: qkdglobatto.hh:271