dune-vtk 2.12
Loading...
Searching...
No Matches
vtkfunctionwrapper.hh
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4
6
7namespace Dune::Vtk
8{
10 template <class GridView>
12 {
13 using Entity = typename GridView::template Codim<0>::Entity;
14 using Domain = typename Entity::Geometry::LocalCoordinate;
15
16 public:
19 : fct_(std::move(fct))
20 {}
21
23 void bind (Entity const& entity)
24 {
25 entity_ = &entity;
26 }
27
29 void unbind ()
30 {
31 entity_ = nullptr;
32 }
33
35 double evaluate (int comp, Domain const& x) const
36 {
37 return fct_->evaluate(comp, *entity_, x);
38 }
39
41 {
42 return self;
43 }
44
45 private:
47 Entity const* entity_ = nullptr;
48 };
49
50} // end namespace Dune::Vtk
STL namespace.
Definition writer.hh:16
Type erasure for Legacy VTKFunction.
Definition vtkfunctionwrapper.hh:12
friend VTKFunctionWrapper localFunction(const VTKFunctionWrapper &self)
Definition vtkfunctionwrapper.hh:40
double evaluate(int comp, Domain const &x) const
Evaluate the Dune::VTKFunction in LocalCoordinates on the stored Entity.
Definition vtkfunctionwrapper.hh:35
void unbind()
Unsets the stored entity pointer.
Definition vtkfunctionwrapper.hh:29
VTKFunctionWrapper(std::shared_ptr< VTKFunction< GridView > const > fct)
Constructor. Stores a shared pointer to the passed Dune::VTKFunction.
Definition vtkfunctionwrapper.hh:18
void bind(Entity const &entity)
Stores a pointer to the passed entity.
Definition vtkfunctionwrapper.hh:23