| 1 |
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
| 2 |
// vi: set et ts=4 sw=2 sts=2: |
| 3 |
// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root |
| 4 |
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception |
| 5 |
#ifndef DUNE_LOCALFUNCTIONS_REFINED_REFINEDP1_HH |
| 6 |
#define DUNE_LOCALFUNCTIONS_REFINED_REFINEDP1_HH |
| 7 |
|
| 8 |
#include <dune/geometry/type.hh> |
| 9 |
|
| 10 |
#include <dune/localfunctions/common/localfiniteelementtraits.hh> |
| 11 |
#include <dune/localfunctions/lagrange/p0.hh> |
| 12 |
|
| 13 |
#include <dune/localfunctions/lagrange/lagrangesimplex.hh> |
| 14 |
#include <dune/localfunctions/refined/refinedp1/refinedp1localbasis.hh> |
| 15 |
|
| 16 |
namespace Dune |
| 17 |
{ |
| 18 |
|
| 19 |
/** \brief Piecewise linear continuous Lagrange functions on a uniformly refined simplex element |
| 20 |
* |
| 21 |
* \tparam D Number type used for domain coordinates |
| 22 |
* \tparam R Number type used for shape function values |
| 23 |
* \tparam dim Dimension of the domain |
| 24 |
* |
| 25 |
* \ingroup LocalFunctions |
| 26 |
*/ |
| 27 |
template<class D, class R, int dim> |
| 28 |
class RefinedP1LocalFiniteElement |
| 29 |
{ |
| 30 |
public: |
| 31 |
/** \brief Export all types used by this implementation |
| 32 |
*/ |
| 33 |
typedef LocalFiniteElementTraits<RefinedP1LocalBasis<D,R,dim>, |
| 34 |
Impl::LagrangeSimplexLocalCoefficients<dim,2>, |
| 35 |
Impl::LagrangeSimplexLocalInterpolation<Impl::LagrangeSimplexLocalBasis<D,R,dim,2> > > Traits; |
| 36 |
|
| 37 |
/** \brief Default constructor |
| 38 |
*/ |
| 39 |
RefinedP1LocalFiniteElement () |
| 40 |
{} |
| 41 |
|
| 42 |
/** \brief The set of shape functions |
| 43 |
*/ |
| 44 |
const typename Traits::LocalBasisType& localBasis () const |
| 45 |
{ |
| 46 |
return basis_; |
| 47 |
} |
| 48 |
|
| 49 |
/** \brief Produces the assignments of the degrees of freedom to the element subentities |
| 50 |
*/ |
| 51 |
const typename Traits::LocalCoefficientsType& localCoefficients () const |
| 52 |
{ |
| 53 |
return coefficients_; |
| 54 |
} |
| 55 |
|
| 56 |
/** \brief Evaluates all degrees of freedom for a given function |
| 57 |
*/ |
| 58 |
const typename Traits::LocalInterpolationType& localInterpolation () const |
| 59 |
{ |
| 60 |
return interpolation_; |
| 61 |
} |
| 62 |
|
| 63 |
/** \brief Number of shape functions of this finite element */ |
| 64 |
unsigned int size () const |
| 65 |
{ |
| 66 |
return basis_.size(); |
| 67 |
} |
| 68 |
|
| 69 |
/** \brief The element type that this finite element is defined on |
| 70 |
*/ |
| 71 |
static constexpr GeometryType type () |
| 72 |
{ |
| 73 |
return GeometryTypes::simplex(dim); |
| 74 |
} |
| 75 |
|
| 76 |
private: |
| 77 |
RefinedP1LocalBasis<D,R,dim> basis_; |
| 78 |
Impl::LagrangeSimplexLocalCoefficients<dim,2> coefficients_; |
| 79 |
// Yes, the template argument here really is LagrangeSimplexLocalBasis, even though this is not |
| 80 |
// the local basis of the refined locale finite element: The reason is that LagrangeSimplexLocalInterpolation |
| 81 |
// uses this argument to determine the polynomial order, and RefinedP1LocalBasis returns order 1 |
| 82 |
// whereas order 2 is needed here. |
| 83 |
Impl::LagrangeSimplexLocalInterpolation<Impl::LagrangeSimplexLocalBasis<D,R,dim,2> > interpolation_; |
| 84 |
}; |
| 85 |
|
| 86 |
} |
| 87 |
|
| 88 |
#endif // DUNE_LOCALFUNCTIONS_REFINED_REFINEDP1_HH |