dune-fem  2.4.1-rc
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Dune::Fem::LocalFunctionAdapter< LocalFunctionImpl > Class Template Reference

LocalFunctionAdapter wrapped a class with a local evaluate method into a grid function. More...

#include </local/tomalk/somewhere/tmp/dune-fem/dune/fem/function/common/localfunctionadapter.hh>

Inheritance diagram for Dune::Fem::LocalFunctionAdapter< LocalFunctionImpl >:
Inheritance graph

Classes

struct  ArgumentIF
 
struct  ArgumentInitializer
 
struct  LocalFunctionInitializer
 
struct  LocalFunctionInitializer< ArgumentType, true >
 

Public Types

typedef ThisType DiscreteFunctionType
 
typedef LocalFunctionImpl LocalFunctionImplType
 Evaluate class. More...
 
typedef BaseType::FunctionType FunctionType
 type of function More...
 
typedef LocalFunctionAdapterTraits< LocalFunctionImplTypeTraits
 traits class More...
 
typedef Traits::GridPartType GridPartType
 type of grid part More...
 
typedef Traits::DiscreteFunctionSpaceType DiscreteFunctionSpaceType
 type of discrete function space More...
 
typedef Traits::GridType GridType
 type of grid More...
 
typedef Traits::DomainFieldType DomainFieldType
 domain type More...
 
typedef Traits::RangeFieldType RangeFieldType
 range type More...
 
typedef Traits::DomainType DomainType
 domain type More...
 
typedef Traits::RangeType RangeType
 range type More...
 
typedef Traits::JacobianRangeType JacobianRangeType
 jacobian type More...
 
typedef Traits::EntityType EntityType
 type of codim 0 entity More...
 
typedef Traits::LocalFunctionType LocalFunctionType
 type of local function to export More...
 
typedef LocalFunctionImpl::FunctionSpaceType FunctionSpaceType
 type of function space this function belongs to More...
 
typedef FunctionSpaceType::HessianRangeType HessianRangeType
 hessian type More...
 
typedef Mapping< DomainFieldType, RangeFieldType, DomainType, RangeTypeMappingType
 type of mapping base class More...
 

Public Member Functions

 LocalFunctionAdapter (const std::string &name, LocalFunctionImplType &localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
 constructer taking instance of EvalImp class More...
 
 LocalFunctionAdapter (const ThisType &other)
 
 ~LocalFunctionAdapter ()
 
unsigned int order () const
 return the order of the space More...
 
const LocalFunctionImplTypelocalFunctionImpl () const
 return local function implementation More...
 
LocalFunctionImplTypelocalFunctionImpl ()
 return local function implementation More...
 
void evaluate (const DomainType &global, RangeType &result) const
 evaluate function on local coordinate local More...
 
LocalFunctionType localFunction (const EntityType &entity)
 obtain a local function for an entity (read-write) More...
 
const LocalFunctionType localFunction (const EntityType &entity) const
 obtain a local function for an entity (read-write) More...
 
const std::string & name () const
 obtain the name of the discrete function More...
 
const DiscreteFunctionSpaceTypespace () const
 
const GridPartTypegridPart () const
 
template<class DFType >
DiscreteFunctionTypeoperator+= (const DFType &g)
 
template<class DFType >
DiscreteFunctionTypeoperator-= (const DFType &g)
 substract all degrees of freedom from given discrete function using the dof iterators More...
 
DiscreteFunctionTypeoperator*= (const RangeFieldType &scalar)
 multiply all DoFs with a scalar factor More...
 
DiscreteFunctionTypeoperator/= (const RangeFieldType &scalar)
 devide all DoFs by a scalar factor More...
 
template<class ArgumentType >
void initialize (const ArgumentType &arg, const double time)
 initialize local function with argument (see insertfunctionpass.hh) More...
 
void registerLocalFunction (LocalFunctionType *lf) const
 add LocalFunction to list of local functions More...
 
void deleteLocalFunction (LocalFunctionType *lf) const
 remove LocalFunction to list of local functions More...
 
virtual void operator() (const DomainType &arg, RangeType &dest) const
 application operator call evaluate More...
 
void operator() (const DomainType &arg, RangeType &dest) const
 Application operator that applies all operators in the linear combination stack. More...
 
void jacobian (const DomainType &x, JacobianRangeType &jacobian) const
 evaluate the Jacobian of the function More...
 
void hessian (const DomainType &x, HessianRangeType &hessian) const
 evaluate the hessian of the function More...
 

Protected Types

typedef std::set< LocalFunctionType * > LocalFunctionListType
 set of created local functions More...
 

Protected Member Functions

const LocalFunctionAdapter< LocalFunctionImpl > & asImp () const
 
LocalFunctionAdapter< LocalFunctionImpl > & asImp ()
 

Static Protected Member Functions

static const LocalFunctionAdapter< LocalFunctionImpl > & asImp (const ThisType &other)
 
static LocalFunctionAdapter< LocalFunctionImpl > & asImp (ThisType &other)
 

Protected Attributes

DiscreteFunctionSpaceType space_
 
LocalFunctionImplTypelocalFunctionImpl_
 
LocalFunctionListType lfList_
 
const ArgumentIFargInitializer_
 
const std::string name_
 
const unsigned int order_
 

Detailed Description

template<class LocalFunctionImpl>
class Dune::Fem::LocalFunctionAdapter< LocalFunctionImpl >

LocalFunctionAdapter wrapped a class with a local evaluate method into a grid function.

The class takes one template argument LocalFunctionImpl which holds the method evaluate(...) to evaluate the local function

template<class PointType> LocalFunctionImpl::evaluate(const PointType& x,RangeType& val)

and a method init(...)

LocalFunctionImpl::init(const EntityType& entity)

to set the entity.

It is important to know that the point x it is not necessary of type DomainType. More precisely, if the evaluate(...) is used with a caching quadrature point the type is different. Indeed floating point coordinates are not very well suited to address the cache therefore quadrature[i] return a QuadraturePointWrapper (which simply stores a reference to the quadrature and the index i).

In order to be sure that the point x is of type DomainType, you can use the function coordinate(x) which can be also called with a DomainType.

Therefore, the local implementation should be something like

template<class PointType> LocalFunctionImpl::evaluate(const PointType& x,RangeType& val) { const DomainType xDomain(coordiante(x)); // do stuff with xDomain }

to avoid type conflicts.

Required type in LocalFunctionImpl are:

FunctionSpaceType GridPartType EntityType DomainType RangeType

An instance of the LocalFunctionImpl class is passed to the constructor.

In order to adapt a lambda or a plain C++ function, you can directly use the LocalAnalyticalFunctionBinder which provides all the necessary types and methods.

Member Typedef Documentation

typedef LocalFunctionImpl::FunctionSpaceType Dune::Fem::Function< LocalFunctionImpl::FunctionSpaceType , LocalFunctionAdapter< LocalFunctionImpl > >::FunctionSpaceType
inherited

type of function space this function belongs to

typedef FunctionSpaceType :: HessianRangeType Dune::Fem::Function< LocalFunctionImpl::FunctionSpaceType , LocalFunctionAdapter< LocalFunctionImpl > >::HessianRangeType
inherited

hessian type

typedef Mapping< DomainFieldType, RangeFieldType, DomainType, RangeType > Dune::Fem::Function< LocalFunctionImpl::FunctionSpaceType , LocalFunctionAdapter< LocalFunctionImpl > >::MappingType
inherited

type of mapping base class

Member Function Documentation

static const LocalFunctionAdapter< LocalFunctionImpl > & Dune::Fem::BartonNackmanInterface< Function< LocalFunctionImpl::FunctionSpaceType, LocalFunctionAdapter< LocalFunctionImpl > > , LocalFunctionAdapter< LocalFunctionImpl > >::asImp ( const ThisType other)
inlinestaticprotectedinherited
static LocalFunctionAdapter< LocalFunctionImpl > & Dune::Fem::BartonNackmanInterface< Function< LocalFunctionImpl::FunctionSpaceType, LocalFunctionAdapter< LocalFunctionImpl > > , LocalFunctionAdapter< LocalFunctionImpl > >::asImp ( ThisType other)
inlinestaticprotectedinherited
const LocalFunctionAdapter< LocalFunctionImpl > & Dune::Fem::BartonNackmanInterface< Function< LocalFunctionImpl::FunctionSpaceType, LocalFunctionAdapter< LocalFunctionImpl > > , LocalFunctionAdapter< LocalFunctionImpl > >::asImp ( ) const
inlineprotectedinherited
LocalFunctionAdapter< LocalFunctionImpl > & Dune::Fem::BartonNackmanInterface< Function< LocalFunctionImpl::FunctionSpaceType, LocalFunctionAdapter< LocalFunctionImpl > > , LocalFunctionAdapter< LocalFunctionImpl > >::asImp ( )
inlineprotectedinherited
void Dune::Fem::Function< LocalFunctionImpl::FunctionSpaceType , LocalFunctionAdapter< LocalFunctionImpl > >::hessian ( const DomainType x,
HessianRangeType hessian 
) const
inlineinherited

evaluate the hessian of the function

Parameters
[in]xevaluation point
[out]hessianvalue of the hessian in x
void Dune::Fem::Function< LocalFunctionImpl::FunctionSpaceType , LocalFunctionAdapter< LocalFunctionImpl > >::jacobian ( const DomainType x,
JacobianRangeType jacobian 
) const
inlineinherited

evaluate the Jacobian of the function

Parameters
[in]xevaluation point
[out]jacobianvalue of the Jacobian in x
virtual void Dune::Fem::Function< LocalFunctionImpl::FunctionSpaceType , LocalFunctionAdapter< LocalFunctionImpl > >::operator() ( const DomainType arg,
RangeType dest 
) const
inlinevirtualinherited

application operator call evaluate

Parameters
[in]argargument
[out]destdestination, i.e. f(arg)
void Dune::Fem::Mapping< LocalFunctionImpl::FunctionSpaceType::DomainFieldType , LocalFunctionImpl::FunctionSpaceType::RangeFieldType , LocalFunctionImpl::FunctionSpaceType::DomainType , LocalFunctionImpl::FunctionSpaceType::RangeType >::operator() ( const DomainType arg,
RangeType dest 
) const
inlineinherited

Application operator that applies all operators in the linear combination stack.

Parameters
[in]argargument
[out]destdestination

References Dune::Fem::Mapping< DFieldType, RFieldType, DType, RType >::operator()().


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