dune-fem 2.12-git
Loading...
Searching...
No Matches
Dune::Fem::LocalAnalyticalFunctionBinder< DiscreteFunctionSpaceImpl > Class Template Reference

LocalAnalyticalFunctionBinder binds a C++ local analytical function (and also its Jacobian and Hessian) to an object which provides all the methods and types needed by the LocalFunctionAdapter. It stores a copy as a std::function. More...

#include <dune/fem/function/common/localfunctionadapter.hh>

Inheritance diagram for Dune::Fem::LocalAnalyticalFunctionBinder< DiscreteFunctionSpaceImpl >:
Inheritance graph

Public Types

typedef DiscreteFunctionSpaceImpl DiscreteFunctionSpaceType
 
typedef LocalAnalyticalFunctionBinder< DiscreteFunctionSpaceType > ThisType
 
typedef DiscreteFunctionSpaceType::FunctionSpaceType FunctionSpaceType
 
typedef DiscreteFunctionSpaceType::GridPartType GridPartType
 
typedef DiscreteFunctionSpaceType::EntityType EntityType
 
typedef FunctionSpaceType::DomainType DomainType
 
typedef FunctionSpaceType::RangeType RangeType
 
typedef DiscreteFunctionSpaceType::DomainFieldType DomainFieldType
 
typedef DiscreteFunctionSpaceType::RangeFieldType RangeFieldType
 
typedef FunctionSpaceType::JacobianRangeType JacobianRangeType
 
typedef FunctionSpaceType::HessianRangeType HessianRangeType
 
typedef std::function< RangeType(const DomainType &, double, const EntityType &)> AnalyticalFunctionType
 
typedef std::function< JacobianRangeType(const DomainType &, double, const EntityType &)> AnalyticalJacobianType
 
typedef std::function< HessianRangeType(const DomainType &, double, const EntityType &)> AnalyticalHessianType
 
typedef EntityType::Geometry Geometry
 type of geometry
 
typedef Geometry::ctype ctype
 type of coordinate field
 
typedef std::decay_t< decltype(Dune::ReferenceElements< ctype, Geometry::coorddimension >::general(std::declval< const Dune::GeometryType & >())) > ReferenceElementType
 type of reference element
 

Public Member Functions

 LocalAnalyticalFunctionBinder (const AnalyticalFunctionType &f=[](const auto &, auto, const auto &){return RangeType(0.0);}, const AnalyticalJacobianType &j=[](const auto &, auto, const auto &){return JacobianRangeType(0.0);}, const AnalyticalHessianType &h=[](const auto &, auto, const auto &){return HessianRangeType(0.0);}, double t=0.0)
 constructor
 
 LocalAnalyticalFunctionBinder (const ThisType &)=default
 
 LocalAnalyticalFunctionBinder (ThisType &&)=default
 
ThisType & operator= (const ThisType &)=default
 
ThisType & operator= (ThisType &&)=default
 
AnalyticalFunctionType & function ()
 get local function
 
const AnalyticalFunctionType & function () const
 get local function
 
AnalyticalJacobianType & jacobian ()
 get jacobian local function
 
const AnalyticalJacobianType & jacobian () const
 get jacobian local function
 
AnalyticalHessianType & hessian ()
 get hessian local function
 
const AnalyticalHessianType & hessian () const
 get hessian local function
 
template<class PointType >
void evaluate (const PointType &x, RangeType &ret) const
 evaluate local function
 
template<class PointType >
void jacobian (const PointType &x, JacobianRangeType &ret) const
 evaluate jacobian local function
 
template<class PointType >
void hessian (const PointType &x, HessianRangeType &ret) const
 evaluate hessian local function
 
void init (const EntityType &entity)
 initialize entity
 
template<typename Arg >
void initialize (Arg &&, double time)
 initialize time
 
double time () const
 get time
 
const Entity & entity () const
 return entity
 
bool valid () const
 return true if entity pointer is set
 
const Geometry & geometry () const
 return geometry
 
Dune::GeometryType type () const
 return geometry type
 
const ReferenceElementType & referenceElement () const
 return reference element
 
void bind (const EntityType &entity)
 set new entity object and geometry if enabled
 
void unbind ()
 release entity and geometry object
 

Protected Types

typedef std::optional< EntityType > EntityStorageType
 
typedef std::conditional< storeGeometry, std::optional< Geometry >, Empty >::type GeometryStorageType
 

Protected Member Functions

void copyGeometry (const EntityGeometryStorageImpl &other)
 

Protected Attributes

EntityStorageType entity_
 
GeometryStorageType geometry_
 

Detailed Description

template<class DiscreteFunctionSpaceImpl>
class Dune::Fem::LocalAnalyticalFunctionBinder< DiscreteFunctionSpaceImpl >

LocalAnalyticalFunctionBinder binds a C++ local analytical function (and also its Jacobian and Hessian) to an object which provides all the methods and types needed by the LocalFunctionAdapter. It stores a copy as a std::function.

Therefore, in order to transform the function

RangeType f(const DomainType& x,double t,const EntityType& entity) { // do stuff }

into a grid function, it is sufficient to pass it to the LocalAnalyticalFucntionBinder

typedef LocalAnalyticalFunctionBinder<DiscreteFunctionSpaceType> LocalAnalyticalFunctionType; LocalAnalyticalFunctionType localAnalyticalFunction(f);

and create the LocalFunctionAdapter

typedef LocalFunctionAdapter<LocalAnalyticalFunctionType> AdaptedFunctionType; AdaptedFunctionType fAdapted("adapted function",localAnalyticalFunction,gridPart);

Member Typedef Documentation

◆ ctype

template<class Entity , bool storeGeometry = true>
typedef Geometry::ctype Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::ctype
inherited

type of coordinate field

◆ EntityStorageType

template<class Entity , bool storeGeometry = true>
typedef std::optional< EntityType > Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::EntityStorageType
protectedinherited

◆ Geometry

template<class Entity , bool storeGeometry = true>
typedef EntityType::Geometry Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::Geometry
inherited

type of geometry

◆ GeometryStorageType

template<class Entity , bool storeGeometry = true>
typedef std::conditional<storeGeometry,std::optional<Geometry>,Empty>::type Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::GeometryStorageType
protectedinherited

◆ ReferenceElementType

template<class Entity , bool storeGeometry = true>
typedef std::decay_t< decltype( Dune::ReferenceElements< ctype, Geometry::coorddimension >:: general( std::declval< const Dune::GeometryType & >() ) ) > Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::ReferenceElementType
inherited

type of reference element

Member Function Documentation

◆ bind()

template<class Entity , bool storeGeometry = true>
void Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::bind ( const EntityType &  entity)
inlineinherited

set new entity object and geometry if enabled

◆ copyGeometry()

template<class Entity , bool storeGeometry = true>
void Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::copyGeometry ( const EntityGeometryStorageImpl< Entity, storeGeometry > &  other)
inlineprotectedinherited

◆ entity()

template<class Entity , bool storeGeometry = true>
const Entity & Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::entity ( ) const
inlineinherited

return entity

◆ geometry()

template<class Entity , bool storeGeometry = true>
const Geometry & Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::geometry ( ) const
inlineinherited

return geometry

◆ referenceElement()

template<class Entity , bool storeGeometry = true>
const ReferenceElementType & Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::referenceElement ( ) const
inlineinherited

return reference element

◆ type()

template<class Entity , bool storeGeometry = true>
Dune::GeometryType Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::type ( ) const
inlineinherited

return geometry type

◆ unbind()

template<class Entity , bool storeGeometry = true>
void Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::unbind ( )
inlineinherited

release entity and geometry object

◆ valid()

template<class Entity , bool storeGeometry = true>
bool Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::valid ( ) const
inlineinherited

return true if entity pointer is set

Member Data Documentation

◆ entity_

template<class Entity , bool storeGeometry = true>
EntityStorageType Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::entity_
protectedinherited

◆ geometry_

template<class Entity , bool storeGeometry = true>
GeometryStorageType Dune::Fem::EntityGeometryStorageImpl< Entity, storeGeometry >::geometry_
protectedinherited

The documentation for this class was generated from the following file: