6 #include <dune/common/exceptions.hh> 7 #include <dune/functions/gridfunctions/gridviewentityset.hh> 9 #include <amdis/common/DerivativeTraits.hpp> 10 #include <amdis/common/TypeTraits.hpp> 11 #include <amdis/gridfunctions/ConstantGridFunction.hpp> 12 #include <amdis/gridfunctions/GridFunction.hpp> 17 template <
class Signature,
class IndexSet,
class Container>
22 template <
class R,
class D,
class IndexSet,
class Container>
33 enum { hasDerivative =
true };
36 using Element =
typename IndexSet::template Codim<0>::Entity;
41 : indexSet_(&indexSet)
42 , container_(&container)
55 element_.emplace(element);
56 value_ = (*container_)[indexSet_->index(element)];
78 using RawSignature =
typename Dune::Functions::SignatureTraits<R(D)>::RawSignature;
80 DerivativeRange diff(0);
94 IndexSet
const* indexSet_;
95 Container
const* container_;
96 std::optional<Element> element_;
109 template <
class Gr
idView,
class Container>
113 using EntitySet = Dune::Functions::GridViewEntitySet<GridView, 0>;
114 using Domain =
typename EntitySet::GlobalCoordinate;
115 using Range =
typename Container::value_type;
117 enum { hasDerivative =
false };
120 using LocalDomain =
typename EntitySet::LocalCoordinate;
126 : entitySet_(gridView)
127 , container_(&container)
133 DUNE_THROW(Dune::NotImplemented,
"Global evaluation not yet implemented");
137 EntitySet
const& entitySet()
const 145 return {entitySet_.gridView().indexSet(), *container_};
149 EntitySet entitySet_;
150 Container
const* container_;
154 template <
class G,
class T>
D Domain
The LocalDomain this LocalFunction can be evaluated in.
Definition: ElementGridFunction.hpp:27
auto gridView() const
Return the GridView the data is defined on.
Definition: ElementVector.hpp:57
void bind(Element const &element)
Extract the constant data associated to the element.
Definition: ElementGridFunction.hpp:53
typename IndexSet::template Codim< 0 >::Entity Element
Type of the entity to bind.
Definition: ElementGridFunction.hpp:36
ElementGridFunction(GridView const &gridView, Container const &container)
Constructor. Stores the function fct and creates an EntitySet.
Definition: ElementGridFunction.hpp:125
Definition: ConstantGridFunction.hpp:19
Range const & operator()(Domain const &) const
Return the constant value_.
Definition: ElementGridFunction.hpp:68
int order() const
Return the constant polynomial order 0.
Definition: ElementGridFunction.hpp:88
Range operator()(Domain const &) const
Return the constant value_
Definition: ElementGridFunction.hpp:131
Data const & data() const
Get a const-ref to the internal data vector.
Definition: ElementVector.hpp:63
R Range
The range type of the LocalFunction.
Definition: ElementGridFunction.hpp:30
Definition: AdaptBase.hpp:6
An adaptive container that stores a value per grid element.
Definition: ElementVector.hpp:21
ElementLocalFunction(IndexSet const &indexSet, Container const &container)
Constructor. Stores the constant value.
Definition: ElementGridFunction.hpp:40
Element const & localContext() const
Return the bound element.
Definition: ElementGridFunction.hpp:46
auto makeDerivative(Type const &) const
Create a ConstantLocalFunction representing the derivative of a constant function, that ist, the value 0.
Definition: ElementGridFunction.hpp:76
Gridfunction returning a constant value per element.
Definition: ElementGridFunction.hpp:110
Definition: ElementGridFunction.hpp:18
Definition: DerivativeTraits.hpp:29
LocalFunction makeLocalFunction() const
Create an ElementLocalFunction.
Definition: ElementGridFunction.hpp:143
bool bound() const
Check whether this localfunction is bound to an element.
Definition: ElementGridFunction.hpp:62