dune-vtk 2.12
Loading...
Searching...
No Matches
vtkfunctionwrapper.hh
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright © DUNE Project contributors, see file AUTHORS.md
2// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception OR LGPL-3.0-or-later
3#pragma once
4
5#include <memory>
6
8
9namespace Dune::Vtk
10{
12 template <class GridView>
14 {
15 using Entity = typename GridView::template Codim<0>::Entity;
16 using Domain = typename Entity::Geometry::LocalCoordinate;
17
18 public:
21 : fct_(std::move(fct))
22 {}
23
25 void bind (Entity const& entity)
26 {
27 entity_ = &entity;
28 }
29
31 void unbind ()
32 {
33 entity_ = nullptr;
34 }
35
37 double evaluate (int comp, Domain const& x) const
38 {
39 return fct_->evaluate(comp, *entity_, x);
40 }
41
43 {
44 return self;
45 }
46
47 private:
49 Entity const* entity_ = nullptr;
50 };
51
52} // end namespace Dune::Vtk
STL namespace.
Definition datacollector.hh:19
Implementation of DataCollector for cells, with continuous data.
Definition celltypedatacollector.hh:20
Type erasure for Legacy VTKFunction.
Definition vtkfunctionwrapper.hh:14
friend VTKFunctionWrapper localFunction(const VTKFunctionWrapper &self)
Definition vtkfunctionwrapper.hh:42
double evaluate(int comp, Domain const &x) const
Evaluate the Dune::VTKFunction in LocalCoordinates on the stored Entity.
Definition vtkfunctionwrapper.hh:37
void unbind()
Unsets the stored entity pointer.
Definition vtkfunctionwrapper.hh:31
VTKFunctionWrapper(std::shared_ptr< VTKFunction< GridView > const > fct)
Constructor. Stores a shared pointer to the passed Dune::VTKFunction.
Definition vtkfunctionwrapper.hh:20
void bind(Entity const &entity)
Stores a pointer to the passed entity.
Definition vtkfunctionwrapper.hh:25