7#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_REFINEDLAGRANGEBASIS_HH
8#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_REFINEDLAGRANGEBASIS_HH
12#include <dune/common/exceptions.hh>
13#include <dune/common/math.hh>
15#include <dune/localfunctions/refined.hh>
21#include <dune/geometry/type.hh>
23#include <dune/grid/common/mcmgmapper.hh>
29template<
typename GV,
int k,
typename R>
30class RefinedLagrangeNode;
43template <
typename GV,
int k,
typename R =
double>
49 static const int dim = GV::dimension;
52 static_assert(k == 0 || k == 1);
55 static MCMGLayout dofLayout()
59 return [](GeometryType gt,
int) ->
size_t {
60 return (gt.dim() == dim) ? (1 << dim) : 0;
62 else if constexpr(k == 1)
64 return [](GeometryType gt,
int) ->
size_t {
65 return Dune::binomial(
int(k),
int(gt.dim()));
68 DUNE_THROW(Dune::NotImplemented,
69 "Refined basis not implemented for higher-order Lagrange (k>=2) elements.");
87 :
Base(gv, dofLayout())
89 for (
auto gt : gv.indexSet().types(0)) {
91 DUNE_THROW(Dune::NotImplemented,
92 "Refined Lagrange basis only implemented for simplex grids.");
109 static constexpr unsigned int order()
117template <
typename GV,
int k,
typename R>
121 static constexpr int dim = GV::dimension;
124 static_assert(k == 0 || k == 1);
128 using Element =
typename GV::template Codim<0>::Entity;
132 Dune::RefinedP0LocalFiniteElement<typename GV::ctype,R,dim>,
133 Dune::RefinedP1LocalFiniteElement<typename GV::ctype,R,dim>>;
180 static constexpr unsigned int order()
192namespace BasisFactory {
201template <
int k,
typename R=
double>
204 return [](
const auto& gridView) {
225template <
typename GV,
int k,
typename R=
double>
auto refinedLagrange()
Create a pre-basis factory that can create a RefinedLagrange pre-basis.
Definition refinedlagrangebasis.hh:202
Definition polynomial.hh:17
Global basis for given pre-basis.
Definition defaultglobalbasis.hh:50
A generic MixIn class for PreBasis with flat indices computed from a mapper.
Definition leafprebasismappermixin.hh:62
void setSize(const size_type size)
Definition nodes.hh:169
Definition refinedlagrangebasis.hh:120
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to.
Definition refinedlagrangebasis.hh:164
const Element * element_
Definition refinedlagrangebasis.hh:187
void bind(const Element &e)
Bind the node to the element e.
Definition refinedlagrangebasis.hh:170
const FiniteElement finiteElement_
Definition refinedlagrangebasis.hh:186
static constexpr unsigned int order()
Polynomial order used in the local Lagrange finite-elements in subdomains of the element.
Definition refinedlagrangebasis.hh:180
typename GV::template Codim< 0 >::Entity Element
Type of the element in the GridView.
Definition refinedlagrangebasis.hh:128
std::conditional_t<(k==0), Dune::RefinedP0LocalFiniteElement< typename GV::ctype, R, dim >, Dune::RefinedP1LocalFiniteElement< typename GV::ctype, R, dim > > FiniteElement
Type of the local finite-element.
Definition refinedlagrangebasis.hh:133
RefinedLagrangeNode()
The default constructor initializes all members to their default.
Definition refinedlagrangebasis.hh:144
const Element & element() const
Return current element. The behavior is undefined if the node is not bound to any element.
Definition refinedlagrangebasis.hh:153
A pre-basis for a refined Lagrange bases.
Definition refinedlagrangebasis.hh:46
static constexpr unsigned int order()
Polynomial order used in the local Lagrange finite-elements.
Definition refinedlagrangebasis.hh:109
Node makeNode() const
Create tree node.
Definition refinedlagrangebasis.hh:97
GV GridView
The grid view that the FE basis is defined on.
Definition refinedlagrangebasis.hh:75
RefinedLagrangePreBasis(const GridView &gv)
Constructor for a given grid view object.
Definition refinedlagrangebasis.hh:86