| 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_HIERARCHICAL_P2_WITH_ELEMENTBUBBLE_LOCALFINITEELEMENT_HH |
| 6 |
#define DUNE_HIERARCHICAL_P2_WITH_ELEMENTBUBBLE_LOCALFINITEELEMENT_HH |
| 7 |
|
| 8 |
#include <dune/geometry/type.hh> |
| 9 |
|
| 10 |
#include <dune/localfunctions/common/localfiniteelementtraits.hh> |
| 11 |
#include <dune/localfunctions/hierarchical/hierarchicalp2withelementbubble/hierarchicalsimplexp2withelementbubble.hh> |
| 12 |
|
| 13 |
|
| 14 |
namespace Dune |
| 15 |
{ |
| 16 |
/** |
| 17 |
* \brief Linear Lagrange functions enriched with quadratic edge bubble functions |
| 18 |
* and an element bubble function. |
| 19 |
* |
| 20 |
* The set of basis functions contains the classical Lagrange basis functions |
| 21 |
* of order 1, i.e., the barycentric coordinates, edge bubble functions as the |
| 22 |
* product of two linear functions, and a single element bubble function that |
| 23 |
* vanishes on all faces of the element. The element bubble function is the |
| 24 |
* product of all linear basis functions and thus has polynomial order `dim+1`. |
| 25 |
* |
| 26 |
* \note The implementation here is restricted to simplex elements. |
| 27 |
* |
| 28 |
* \tparam D Type to represent the field in the domain. |
| 29 |
* \tparam R Type to represent the field in the range. |
| 30 |
* \tparam dim Dimension of the domain. |
| 31 |
**/ |
| 32 |
template<class D, class R, int dim> |
| 33 |
class HierarchicalP2WithElementBubbleLocalFiniteElement |
| 34 |
{ |
| 35 |
public: |
| 36 |
//! Type of the local basis |
| 37 |
using LocalBasisType = HierarchicalSimplexP2WithElementBubbleLocalBasis<D,R,dim>; |
| 38 |
|
| 39 |
//! Type of the local coefficients |
| 40 |
using LocalCoefficientsType = HierarchicalSimplexP2WithElementBubbleLocalCoefficients<dim>; |
| 41 |
|
| 42 |
//! Type of the local interpolation |
| 43 |
using LocalInterpolationType = HierarchicalSimplexP2WithElementBubbleLocalInterpolation<LocalBasisType,dim>; |
| 44 |
|
| 45 |
//! Traits type that specifies the local basis, coefficients, and interpolation type. |
| 46 |
using Traits = LocalFiniteElementTraits<LocalBasisType,LocalCoefficientsType,LocalInterpolationType>; |
| 47 |
|
| 48 |
|
| 49 |
//! Returns the local basis, i.e., the set of shape functions |
| 50 |
const LocalBasisType& localBasis () const |
| 51 |
{ |
| 52 |
return basis_; |
| 53 |
} |
| 54 |
|
| 55 |
//! Returns the assignment of the degrees of freedom to the element subentities |
| 56 |
const LocalCoefficientsType& localCoefficients () const |
| 57 |
{ |
| 58 |
return coefficients_; |
| 59 |
} |
| 60 |
|
| 61 |
//! Returns object that evaluates degrees of freedom |
| 62 |
const LocalInterpolationType& localInterpolation () const |
| 63 |
{ |
| 64 |
return interpolation_; |
| 65 |
} |
| 66 |
|
| 67 |
//! Returns the number of shape functions in this finite-element |
| 68 |
static constexpr std::size_t size () noexcept |
| 69 |
{ |
| 70 |
return LocalBasisType::size(); |
| 71 |
} |
| 72 |
|
| 73 |
//! Returns the type of the geometry the finite-element is attached to |
| 74 |
static constexpr GeometryType type () noexcept |
| 75 |
{ |
| 76 |
return GeometryTypes::simplex(dim); |
| 77 |
} |
| 78 |
|
| 79 |
private: |
| 80 |
LocalCoefficientsType coefficients_{}; |
| 81 |
[[no_unique_address]] LocalBasisType basis_{}; |
| 82 |
[[no_unique_address]] LocalInterpolationType interpolation_{}; |
| 83 |
}; |
| 84 |
|
| 85 |
} |
| 86 |
|
| 87 |
#endif |