dune-fem  2.6-git
bindable.hh
Go to the documentation of this file.
1 #ifndef DUNE_FEM_FUNCTION_LOCALFUNCTION_BINDABLE_HH
2 #define DUNE_FEM_FUNCTION_LOCALFUNCTION_BINDABLE_HH
3 
6 #include <dune/fem/quadrature/quadrature.hh> // shouldn't be here (but otherwise the coordinate method doesn't work)
7 
8 namespace Dune
9 {
10  namespace Fem
11  {
12  struct BindableFunction : public HasLocalFunction {};
13 
14  template <class GridPart, class Range>
16  {
17  typedef GridPart GridPartType;
18  typedef typename GridPart::template Codim<0>::EntityType EntityType;
19  typedef typename EntityType::Geometry::GlobalCoordinate DomainType;
21  typedef typename FunctionSpaceType::RangeFieldType RangeFieldType;
22  typedef typename FunctionSpaceType::RangeType RangeType;
23  typedef typename FunctionSpaceType::JacobianRangeType JacobianRangeType;
24  typedef typename FunctionSpaceType::HessianRangeType HessianRangeType;
25  BindableGridFunction(const GridPart &gridPart)
26  : gridPart_(gridPart) {}
27  void bind(const EntityType &entity) { entity_ = entity; }
28  void unbind() {}
29  bool continuous() const { return true; }
30  template <class Point>
31  DomainType global(const Point &x) const
32  {
33  return entity_.geometry().global( Dune::Fem::coordinate(x) );
34  }
35  const GridPart& gridPart() const { return gridPart_; }
36  const EntityType &entity() const { return entity_; }
37  private:
38  EntityType entity_;
39  const GridPart &gridPart_;
40  };
41 
42  } // namespace Fem
43 } // namespace Dune
44 #endif // DUNE_FEM_FUNCTION_LOCALFUNCTION_BINDABLE_HH
Definition: bindguard.hh:11
static const Point & coordinate(const Point &x)
Definition: coordinate.hh:11
typename Impl::GridFunctionSpace< GridPart, T >::Type GridFunctionSpace
Definition: functionspace.hh:317
base class for determing whether a function has local functions or not
Definition: common/discretefunction.hh:56
Definition: bindable.hh:12
Definition: bindable.hh:16
FunctionSpaceType::JacobianRangeType JacobianRangeType
Definition: bindable.hh:23
GridPart::template Codim< 0 >::EntityType EntityType
Definition: bindable.hh:18
bool continuous() const
Definition: bindable.hh:29
void unbind()
Definition: bindable.hh:28
FunctionSpaceType::RangeFieldType RangeFieldType
Definition: bindable.hh:21
const GridPart & gridPart() const
Definition: bindable.hh:35
GridPart GridPartType
Definition: bindable.hh:17
FunctionSpaceType::HessianRangeType HessianRangeType
Definition: bindable.hh:24
void bind(const EntityType &entity)
Definition: bindable.hh:27
Dune::Fem::GridFunctionSpace< GridPartType, Range > FunctionSpaceType
Definition: bindable.hh:20
BindableGridFunction(const GridPart &gridPart)
Definition: bindable.hh:25
DomainType global(const Point &x) const
Definition: bindable.hh:31
EntityType::Geometry::GlobalCoordinate DomainType
Definition: bindable.hh:19
FunctionSpaceType::RangeType RangeType
Definition: bindable.hh:22
const EntityType & entity() const
Definition: bindable.hh:36