dune-fem 2.8.0
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Related Functions | 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 <dune/fem/function/common/localfunctionadapter.hh>

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

Classes

struct  ArgumentIF
 
struct  ArgumentInitializer
 

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)
 
 LocalFunctionAdapter (const std::string &name, const LocalFunctionImplType &localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
 constructor taking a const reference instance of the local function class More...
 
 LocalFunctionAdapter (const std::string &name, LocalFunctionImplType &&localFunctionImpl, const GridPartType &gridPart, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
 constructor taking a r-value reference instance of the local function class More...
 
template<class ... Args>
 LocalFunctionAdapter (const std::string &name, const GridPartType &gridPart, unsigned int order, Args &... args)
 
template<class ... Args>
 LocalFunctionAdapter (const std::string &name, const GridPartType &gridPart, const std::tuple< Args &... > &args, unsigned int order=DiscreteFunctionSpaceType::polynomialOrder)
 
 LocalFunctionAdapter (const ThisType &other)
 
unsigned int order () const
 return the order of the space More...
 
bool continuous () const
 return true, probably More...
 
const LocalFuncStorageTypelocalFunctionImpl () const
 return local function implementation More...
 
LocalFuncStorageTypelocalFunctionImpl ()
 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)
 
const LocalFunctionType localFunction (const EntityType &entity) const
 
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, double time)
 initialize local function with argument and time 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 Traits::LocalFuncStorageType LocalFuncStorageType
 

Protected Member Functions

template<class ... Args, std::size_t ... index>
 LocalFunctionAdapter (const std::string &name, const GridPartType &gridPart, const std::tuple< Args &... > &args, unsigned int order, std::index_sequence< index... >)
 
const Implementation & asImp () const
 
Implementation & asImp ()
 

Static Protected Member Functions

static const Implementation & asImp (const ThisType &other)
 
static Implementation & asImp (ThisType &other)
 
static const Implementation & asImp (const ThisType &other)
 
static Implementation & asImp (ThisType &other)
 

Protected Attributes

DiscreteFunctionSpaceType space_
 
LocalFuncStorageType localFunctionImpl_
 
std::set< LocalFunctionType * > lfList_
 
std::unique_ptr< ArgumentIFargInitializer_
 
const std::string name_
 
const unsigned int order_
 

Related Functions

(Note that these are not member functions.)

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator+ (const Mapping< DFieldType, RFieldType, DType, RType > &a, const Mapping< DFieldType, RFieldType, DType, RType > &b)
 add two mappings More...
 
template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator- (const Mapping< DFieldType, RFieldType, DType, RType > &a, const Mapping< DFieldType, RFieldType, DType, RType > &b)
 substract two mappings More...
 
template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator* (const Mapping< DFieldType, RFieldType, DType, RType > &mapping, const RFieldType &factor)
 scale mapping with factor More...
 
template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator* (const RFieldType &factor, const Mapping< DFieldType, RFieldType, DType, RType > &mapping)
 scale mapping with factor More...
 
template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator/ (const Mapping< DFieldType, RFieldType, DType, RType > &mapping, const RFieldType &factor)
 operator / for mappings More...
 
template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator/ (const RFieldType &factor, const Mapping< DFieldType, RFieldType, DType, RType > &mapping)
 operator / for mappings More...
 

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

◆ FunctionSpaceType

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

type of function space this function belongs to

◆ HessianRangeType

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

hessian type

◆ MappingType

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

type of mapping base class

Member Function Documentation

◆ asImp() [1/6]

Implementation & Dune::Fem::BartonNackmanInterface< Interface, Implementation >::asImp ( )
inlineprotectedinherited

◆ asImp() [2/6]

const Implementation & Dune::Fem::BartonNackmanInterface< Interface, Implementation >::asImp ( ) const
inlineprotectedinherited

◆ asImp() [3/6]

static const Implementation & Dune::Fem::BartonNackmanInterface< Interface, Implementation >::asImp ( const ThisType other)
inlinestaticprotectedinherited

◆ asImp() [4/6]

template<class Interface , class Implementation >
static const Implementation & Dune::Fem::BartonNackmanInterface< Interface, Implementation >::asImp ( const ThisType other)
inlinestaticprotectedinherited

◆ asImp() [5/6]

static Implementation & Dune::Fem::BartonNackmanInterface< Interface, Implementation >::asImp ( ThisType other)
inlinestaticprotectedinherited

◆ asImp() [6/6]

template<class Interface , class Implementation >
static Implementation & Dune::Fem::BartonNackmanInterface< Interface, Implementation >::asImp ( ThisType other)
inlinestaticprotectedinherited

◆ hessian()

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

◆ jacobian()

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

◆ operator()() [1/2]

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)

◆ operator()() [2/2]

template<typename DFieldType , typename RFieldType , class DType , class RType >
void Dune::Fem::Mapping< DFieldType, RFieldType, DType, RType >::operator() ( const DomainType arg,
RangeType dest 
) const
inlineinherited

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

Parameters
[in]argargument
[out]destdestination

Friends And Related Function Documentation

◆ operator*() [1/2]

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator* ( const Mapping< DFieldType, RFieldType, DType, RType > &  mapping,
const RFieldType &  factor 
)
related

scale mapping with factor

Parameters
[in]mappingMapping which is scaled
[in]factorfactor with which mapping is scaled
Returns
new object mapping

◆ operator*() [2/2]

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator* ( const RFieldType &  factor,
const Mapping< DFieldType, RFieldType, DType, RType > &  mapping 
)
related

scale mapping with factor

Parameters
[in]factorfactor with which mapping is scaled
[in]mappingMapping which is scaled
Returns
new object mapping

◆ operator+()

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator+ ( const Mapping< DFieldType, RFieldType, DType, RType > &  a,
const Mapping< DFieldType, RFieldType, DType, RType > &  b 
)
related

add two mappings

Parameters
[in]amapping 1
[in]bmapping 2
Returns
new object mapping

◆ operator-()

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator- ( const Mapping< DFieldType, RFieldType, DType, RType > &  a,
const Mapping< DFieldType, RFieldType, DType, RType > &  b 
)
related

substract two mappings

Parameters
[in]amapping 1
[in]bmapping 2
Returns
new object mapping

◆ operator/() [1/2]

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator/ ( const Mapping< DFieldType, RFieldType, DType, RType > &  mapping,
const RFieldType &  factor 
)
related

operator / for mappings

Parameters
[in]mappingmapping which is divided
[in]factorf factor by which result of mapping is divided
Returns
new object mapping

◆ operator/() [2/2]

template<class DFieldType , class RFieldType , class DType , class RType >
static Mapping< DFieldType, RFieldType, DType, RType > operator/ ( const RFieldType &  factor,
const Mapping< DFieldType, RFieldType, DType, RType > &  mapping 
)
related

operator / for mappings

Parameters
[in]factorby which result of mapping is divided
[in]mappingwhich is divided
Returns
new object mapping

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