Loading...
Searching...
No Matches
hierarchicallagrangewithelementbubblebasis.hh
Go to the documentation of this file.
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
#ifndef DUNE_FUNCTIONS_FUNCTIONSPACEBASES_HierarchicalLagrangeWOTHELEMENTBUBBLEBASIS_HH
#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_HierarchicalLagrangeWOTHELEMENTBUBBLEBASIS_HH
#include <type_traits>
#include <dune/common/exceptions.hh>
#include <dune/common/math.hh>
#include <dune/localfunctions/hierarchical/hierarchicalp1withelementbubble.hh>
#include <dune/localfunctions/hierarchical/hierarchicalp2withelementbubble.hh>
#include <dune/functions/functionspacebases/defaultglobalbasis.hh>
#include <dune/functions/functionspacebases/lfeprebasismixin.hh>
#include <dune/geometry/type.hh>
namespace Dune {
namespace Functions {
// *****************************************************************************
// Implementation for Hierarchical Lagrange Basis (of order 1-2) with an
// element bubble function (of order dim+1).
//
// - currently only supports simplex grids
//
// *****************************************************************************
template<typename GV, int k, typename R=double>
class HierarchicalLagrangeWithElementBubblePreBasis;
template<typename GV, typename R>
class HierarchicalLagrangeWithElementBubblePreBasis<GV,1,R>
: public LFEPreBasisMixin<GV, HierarchicalP1WithElementBubbleLocalFiniteElement<typename GV::ctype,R,GV::dimension>>
{
using Base = LFEPreBasisMixin<GV, HierarchicalP1WithElementBubbleLocalFiniteElement<typename GV::ctype,R,GV::dimension>>;
public:
HierarchicalLagrangeWithElementBubblePreBasis (const GV& gridView) :
Base(gridView, [](GeometryType gt, int) { return (gt.isVertex() || gt.dim() == GV::dimension) ? 1 : 0; })
{
for (auto gt : gridView.indexSet().types(0)) {
if (!gt.isSimplex())
DUNE_THROW(Dune::NotImplemented,
"Hierarchical Lagrange basis only implemented for simplex grids.");
}
}
};
template<typename GV, typename R>
class HierarchicalLagrangeWithElementBubblePreBasis<GV,2,R>
: public LFEPreBasisMixin<GV, HierarchicalP2WithElementBubbleLocalFiniteElement<typename GV::ctype,R,GV::dimension>>
{
using Base = LFEPreBasisMixin<GV, HierarchicalP2WithElementBubbleLocalFiniteElement<typename GV::ctype,R,GV::dimension>>;
public:
HierarchicalLagrangeWithElementBubblePreBasis (const GV& gridView) :
Base(gridView, [](GeometryType gt, int) { return (gt.dim() <= 1 || gt.dim() == GV::dimension) ? 1 : 0; })
{
for (auto gt : gridView.indexSet().types(0)) {
if (!gt.isSimplex())
DUNE_THROW(Dune::NotImplemented,
"Hierarchical Lagrange basis only implemented for simplex grids.");
}
}
};
namespace BasisFactory {
template<int k, typename R=double>
auto hierarchicalLagrangeWithElementBubble()
{
static_assert(0 < k && k <= 2);
return [](const auto& gridView) {
return HierarchicalLagrangeWithElementBubblePreBasis<std::decay_t<decltype(gridView)>, k, R>(gridView);
};
}
template<typename R=double>
auto hierarchicalP1B()
{
return hierarchicalLagrangeWithElementBubble<1,R>();
}
template<typename R=double>
auto hierarchicalP2B()
{
return hierarchicalLagrangeWithElementBubble<2,R>();
}
} // end namespace BasisFactory
template<typename GV, int k, typename R=double>
using HierarchicalLagrangeWithElementBubbleBasis = DefaultGlobalBasis<HierarchicalLagrangeWithElementBubblePreBasis<GV, k, R> >;
} // end namespace Functions
} // end namespace Dune
#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_HierarchicalLagrangeWOTHELEMENTBUBBLEBASIS_HH
lfeprebasismixin.hh
defaultglobalbasis.hh
Dune::Functions::BasisFactory::hierarchicalLagrangeWithElementBubble
auto hierarchicalLagrangeWithElementBubble()
A factory that can create a HierarchicalLagrangeWithElementBubble pre-basis.
Definition hierarchicallagrangewithelementbubblebasis.hh:90
Dune::Functions::HierarchicalLagrangeWithElementBubbleBasis
DefaultGlobalBasis< HierarchicalLagrangeWithElementBubblePreBasis< GV, k, R > > HierarchicalLagrangeWithElementBubbleBasis
Basis of a Hierarchical Lagrange finite element space with element bubble functions.
Definition hierarchicallagrangewithelementbubblebasis.hh:125
Dune
Definition monomialset.hh:19
Dune::Functions
Definition monomialset.hh:19
Dune::Functions::BasisFactory
Definition argyrisbasis.hh:926
Dune::Functions::BasisFactory::hierarchicalP2B
auto hierarchicalP2B()
Explicit factory for k=2 for the HierarchicalLagrangeWithElementBubblePreBasis pre-basis.
Definition hierarchicallagrangewithelementbubblebasis.hh:107
Dune::Functions::BasisFactory::hierarchicalP1B
auto hierarchicalP1B()
Explicit factory for k=1 for the HierarchicalLagrangeWithElementBubblePreBasis pre-basis.
Definition hierarchicallagrangewithelementbubblebasis.hh:100
Dune::Functions::DefaultGlobalBasis
Global basis for given pre-basis.
Definition defaultglobalbasis.hh:53
Dune::Functions::HierarchicalLagrangeWithElementBubblePreBasis
A pre-basis for a hierarchical basis.
Definition hierarchicallagrangewithelementbubblebasis.hh:42
Dune::Functions::HierarchicalLagrangeWithElementBubblePreBasis< GV, 1, R >::HierarchicalLagrangeWithElementBubblePreBasis
HierarchicalLagrangeWithElementBubblePreBasis(const GV &gridView)
Definition hierarchicallagrangewithelementbubblebasis.hh:50
Dune::Functions::HierarchicalLagrangeWithElementBubblePreBasis< GV, 2, R >::HierarchicalLagrangeWithElementBubblePreBasis
HierarchicalLagrangeWithElementBubblePreBasis(const GV &gridView)
Definition hierarchicallagrangewithelementbubblebasis.hh:67
Dune::Functions::LFEPreBasisMixin< GV, HierarchicalP1WithElementBubbleLocalFiniteElement< GV::ctype, R, GV::dimension > >::gridView
const GridView & gridView() const
Definition leafprebasismappermixin.hh:95
Dune::Functions::LFEPreBasisMixin< GV, HierarchicalP1WithElementBubbleLocalFiniteElement< GV::ctype, R, GV::dimension > >::LFEPreBasisMixin
LFEPreBasisMixin(const GridView &gv, MCMGLayout layout)
Definition lfeprebasismixin.hh:75