Loading...
Searching...
No Matches
lfeprebasismixin.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_LFEPREBASISMIXIN_HH
#define DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
#include <cassert>
#include <type_traits>
#include <dune/common/exceptions.hh>
#include <dune/functions/functionspacebases/leafprebasismappermixin.hh>
#include <dune/functions/functionspacebases/nodes.hh>
#include <dune/grid/common/mcmgmapper.hh>
namespace Dune::Functions {
template <class GV, class LFE>
class LFEPreBasisMixin :
public LeafPreBasisMapperMixin< GV >
{
using Base = LeafPreBasisMapperMixin< GV >;
public:
using GridView = GV;
class Node;
template <class LFE_ = LFE,
std::enable_if_t<std::is_default_constructible_v<LFE_>, int> = 0>
LFEPreBasisMixin (const GridView& gv, MCMGLayout layout)
: Base(gv, layout)
, lfe_{}
{}
template <class LFE_>
LFEPreBasisMixin (const GridView& gv, LFE_&& lfe, MCMGLayout layout)
: Base(gv, layout)
, lfe_(std::forward<LFE_>(lfe))
{}
Node makeNode () const
{
return Node(lfe_);
}
private:
LFE lfe_;
};
// deduction guide
template <class GV, class LFE>
LFEPreBasisMixin(const GV&, const LFE&, MCMGLayout)
-> LFEPreBasisMixin<GV,LFE>;
template <class GV, class LFE>
class LFEPreBasisMixin<GV,LFE>::Node
: public LeafBasisNode
{
static constexpr int dim = GV::dimension;
public:
using size_type = std::size_t;
using Element = typename GV::template Codim<0>::Entity;
using FiniteElement = LFE;
explicit Node (const LFE& lfe)
: lfe_{&lfe}
, element_{nullptr}
{}
const Element& element () const
{
assert(!!element_);
return *element_;
}
const FiniteElement& finiteElement () const
{
assert(!!lfe_);
return *lfe_;
}
void bind (const Element& e)
{
element_ = &e;
this->setSize(lfe_->size());
}
protected:
const FiniteElement* lfe_;
const Element* element_;
};
} // end namespace Dune::Functions
#endif // DUNE_FUNCTIONS_FUNCTIONSPACEBASES_LFEPREBASISMIXIN_HH
nodes.hh
leafprebasismappermixin.hh
Dune::Functions
Definition monomialset.hh:19
Dune::Functions::LFEPreBasisMixin
LFEPreBasisMixin(const GV &, const LFE &, MCMGLayout) -> LFEPreBasisMixin< GV, LFE >
Dune::Functions::LeafPreBasisMapperMixin::LeafPreBasisMapperMixin
LeafPreBasisMapperMixin(const GridView &gv, Dune::MCMGLayout layout)
Construct from GridView and local DOF layout.
Definition leafprebasismappermixin.hh:74
Dune::Functions::LFEPreBasisMixin
A pre-basis mixin class parametrized with a local finite-element and a DOF layout.
Definition lfeprebasismixin.hh:57
Dune::Functions::LFEPreBasisMixin::LFEPreBasisMixin
LFEPreBasisMixin(const GridView &gv, LFE_ &&lfe, MCMGLayout layout)
Constructor for a given grid view object, local finite-element and layout.
Definition lfeprebasismixin.hh:86
Dune::Functions::LFEPreBasisMixin::LFEPreBasisMixin
LFEPreBasisMixin(const GridView &gv, MCMGLayout layout)
Constructor for a given grid view object and layout.
Definition lfeprebasismixin.hh:75
Dune::Functions::LFEPreBasisMixin::makeNode
Node makeNode() const
Create tree node.
Definition lfeprebasismixin.hh:92
Dune::Functions::LFEPreBasisMixin< GV, LagrangeSimplexLocalFiniteElement< typename GV::ctype, R, GV::dimension, 1 > >::GridView
GV GridView
Definition lfeprebasismixin.hh:63
Dune::Functions::LFEPreBasisMixin::Node::FiniteElement
LFE FiniteElement
Definition lfeprebasismixin.hh:126
Dune::Functions::LFEPreBasisMixin::Node::size_type
std::size_t size_type
Definition lfeprebasismixin.hh:124
Dune::Functions::LFEPreBasisMixin::Node::finiteElement
const FiniteElement & finiteElement() const
Return the LocalFiniteElement for the element we are bound to; might raise an error if unbound.
Definition lfeprebasismixin.hh:146
Dune::Functions::LFEPreBasisMixin::Node::element
const Element & element() const
Return current element; might raise an error if unbound.
Definition lfeprebasismixin.hh:135
Dune::Functions::LFEPreBasisMixin::Node::lfe_
const FiniteElement * lfe_
Definition lfeprebasismixin.hh:160
Dune::Functions::LFEPreBasisMixin::Node::bind
void bind(const Element &e)
Bind to element. Stores a pointer to the passed element reference.
Definition lfeprebasismixin.hh:153
Dune::Functions::LFEPreBasisMixin::Node::Node
Node(const LFE &lfe)
Constructor; stores a pointer to the passed local finite-element lfe.
Definition lfeprebasismixin.hh:129
Dune::Functions::LFEPreBasisMixin::Node::Element
typename GV::template Codim< 0 >::Entity Element
Definition lfeprebasismixin.hh:125
Dune::Functions::LFEPreBasisMixin::Node::element_
const Element * element_
Definition lfeprebasismixin.hh:161
Dune::Functions::BasisNodeMixin::setSize
void setSize(const size_type size)
Definition nodes.hh:197
Dune::Functions::LeafBasisNode
Definition nodes.hh:218