Skip to content
Snippets Groups Projects
Commit 31aab778 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[assembler.local.codim0] add LocalOperatorApplicator

parent 755a54b7
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,7 @@
#include <dune/stuff/grid/walker/wrapper.hh>
#include <dune/stuff/la/container/interfaces.hh>
#include <dune/gdt/discretefunction/default.hh>
#include <dune/gdt/localoperator/interface.hh>
#include <dune/gdt/localoperator/interfaces.hh>
#include <dune/gdt/localfunctional/interface.hh>
......@@ -169,6 +170,49 @@ private:
}; // class LocalVolumeTwoFormAccumulator
template <class GridViewType, class LocalOperatorType, class SourceType, class RangeType>
class LocalOperatorApplicator : public Stuff::Grid::internal::Codim0Object<GridViewType>
{
static_assert(is_local_operator<LocalOperatorType>::value,
"LocalOperatorType has to be derived from LocalOperatorInterface!");
static_assert(Stuff::is_localizable_function<SourceType>::value,
"SourceType has to be derived from Stuff::LocalizableFunctionInterface!");
static_assert(is_discrete_function<RangeType>::value, "RangeType has to be a DiscreteFunctionDefault!");
typedef Stuff::Grid::internal::Codim0Object<GridViewType> BaseType;
public:
using typename BaseType::EntityType;
LocalOperatorApplicator(const GridViewType& grid_view, const LocalOperatorType& local_operator,
const SourceType& source, RangeType& range,
const Stuff::Grid::ApplyOn::WhichEntity<GridViewType>& where)
: grid_view_(grid_view)
, local_operator_(local_operator)
, source_(source)
, range_(range)
, where_(where)
{
}
virtual bool apply_on(const GridViewType& grid_view, const EntityType& entity) const
{
return where_.apply_on(grid_view, entity);
}
virtual void apply_local(const EntityType& entity)
{
local_operator_.apply(source_, *range_.local_discrete_function(entity));
}
private:
const GridViewType& grid_view_;
const LocalOperatorType& local_operator_;
const SourceType& source_;
RangeType& range_;
const Stuff::Grid::ApplyOn::WhichEntity<GridViewType>& where_;
}; // class LocalOperatorApplicator
namespace LocalAssembler {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment