5#include <dune/functions/common/typeerasure.hh>
7#include <amdis/ContextGeometry.hpp>
8#include <amdis/common/ConceptsBase.hpp>
9#include <amdis/common/TypeTraits.hpp>
14template <
class Traits,
class... Nodes>
15struct LocalOperatorDefinition
17 using MatVec =
typename Traits::ElementContainer;
18 using CG = ContextGeometry<typename Traits::LocalContext>;
19 using Element =
typename CG::Element;
24 virtual ~Interface() =
default;
25 virtual void bind(Element
const&) = 0;
26 virtual void unbind() = 0;
27 virtual void assemble(CG
const&, Nodes
const&..., MatVec&)
const = 0;
32 struct Model :
public Impl
35 void bind(Element
const& e)
final { this->get().bind(e); }
36 void unbind() final { this->get().unbind(); }
37 void assemble(CG
const& cg, Nodes
const&... ns, MatVec& mv)
const final {
38 this->get().assemble(cg,ns...,mv); }
45 auto require(LOp&& lop) ->
decltype
47 lop.bind(std::declval<Element>()),
49 lop.assemble(std::declval<CG>(), std::declval<Nodes>()..., std::declval<MatVec&>())
53 using Base = Dune::Functions::TypeErasureBase<Interface, Model>;
72template <
class Traits,
class... Nodes>
74 :
public Impl::LocalOperatorDefinition<Traits,Nodes...>::Base
76 using Definition = Impl::LocalOperatorDefinition<
Traits,Nodes...>;
77 using Super =
typename Definition::Base;
81 using MatVec =
typename Traits::ElementContainer;
87 using Element =
typename ContextGeo::Element;
91 template <
class Impl, Dune::disableCopyMove<LocalOperator,Impl> = 0>
95 static_assert(Concepts::models<
typename Definition::Concept(
Impl)>,
96 "Implementation does not model the LocalOperator concept.");
108 this->asInterface().bind(element);
114 this->asInterface().unbind();
125 this->asInterface().assemble(cg,ns...,mv);
The base class for a local operator to be used in a Assembler.
Definition: LocalOperator.hpp:75
LocalOperator()=default
Default Constructor.
typename ContextGeo::Element Element
The grid entity of codim=0.
Definition: LocalOperator.hpp:87
void bind(Element const &element)
Binds the local operator to an element.
Definition: LocalOperator.hpp:106
void assemble(ContextGeo const &cg, Nodes const &... ns, MatVec &mv) const
Assemble a local element matrix or vector on the element that is bound.
Definition: LocalOperator.hpp:123
typename Traits::ElementContainer MatVec
Type of the element matrix or element vector.
Definition: LocalOperator.hpp:81
void unbind()
Unbinds operator from element.
Definition: LocalOperator.hpp:112
LocalOperator(Impl &&impl)
Constructor. Pass any type supporting the LocalOperatorInterface.
Definition: LocalOperator.hpp:92
Wrapper class for element and geometry.
Definition: ContextGeometry.hpp:49