DUNE-ACFEM (2.5.1)

GridFunctionExpressions

Define the usual algebraic vector space operations for grid-functions. More...

Modules

 BoundaryFunctionExpressions
 Similar to the WrapperExpressionOptimiztation, but rather not an optimization.
 
 IndicatorFunctionExpressions
 When viewing the BoundaryIndicator as the characteristic function of a subset of the boundary then it is somewhat natural (and straight forward) to form multiplication operations with indicators and GridFunctions.
 
 FunctionExpressionOptimizations
 Define common expression optimizations, like double identity-wrapping, double unary minus, operations which involve the usual zero-elements (ZeroGridFunction, ZeroParameter).
 

Classes

struct  Dune::ACFem::BinaryFunctionExpressionOperation< MultiplyOperation >
 S-multiplication with scalar functions and scalar products. More...
 
struct  Dune::ACFem::BinaryFunctionExpressionOperation< SMultiplyOperation >
 Multiplication from the left by a scalar constant. More...
 
struct  Dune::ACFem::BinaryGridFunctionExpressionTraits< BinOp, LeftFunction, RightFunction >
 traits of BinaryGridFunctionExpression More...
 
class  Dune::ACFem::BinaryGridFunctionExpression< BinOp, LeftFunction, RightFunction >
 BinaryGridFunctionExpression implements point-wise vector-space operations for GridFunction-types. More...
 
class  Dune::ACFem::BinaryGridFunctionExpression< BinOp, LeftFunction, RightFunction >::LocalFunction
 General local function object for binary grid-function expressions. More...
 
struct  Dune::ACFem::BinaryGridFunctionExpressionTraits< SMultiplyOperation, Factor, Function >
 S-multiplication with RangeFieldType scalars. More...
 
class  Dune::ACFem::BinaryGridFunctionExpression< SMultiplyOperation, Factor, Function >
 S-multiplication with RangeFieldType scalars. More...
 
struct  Dune::ACFem::UnaryGridFunctionExpressionTraits< UnOp, Function >
 traits of UnaryGridFunctionExpression More...
 
class  Dune::ACFem::UnaryGridFunctionExpression< UnOp, FunctionType >
 UnaryGridFunctionExpression implements point-wise unary operations for GridFunction-types. More...
 
class  Dune::ACFem::UnaryGridFunctionExpression< IdentityOperation, FunctionType >
 Specialize for the identity wrapper operation. More...
 
class  Dune::ACFem::UnaryGridFunctionExpression< InvertOperation, FunctionType >
 For the sake of BoundarySupportedFunction we need to specialize the InvertOperation. More...
 

Functions

template<class GridFunction >
static const Fem::Function< typename GridFunction::FunctionSpaceType, GridFunction > & Dune::ACFem::asExprFunction (const GridFunction &arg)
 Cast to the proper underlying expression class; for the generic case this is just the underlying Fem::Function base-class.
 
template<class UnOp , class Function >
static const UnaryGridFunctionExpression< UnOp, Function > & Dune::ACFem::asExprFunction (const UnaryGridFunctionExpression< UnOp, Function > &arg)
 Cast to the proper underlying expression class; this is the identity-specialization for things which actually are* expressions.
 
template<class BinOp , class LeftFunction , class RightFunction >
static const BinaryGridFunctionExpression< BinOp, LeftFunction, RightFunction > & Dune::ACFem::asExprFunction (const BinaryGridFunctionExpression< BinOp, LeftFunction, RightFunction > &arg)
 Cast to the proper underlying expression class; this is the identity-specialization for things which actually are* expressions.
 
template<class F1 , class F2 >
static ZeroGridFunction< typename FunctionMultiplicationResultTraits< typename F1::FunctionSpaceType, typename F2::FunctionSpaceType >::FunctionSpaceType, typename F1::GridPartType > Dune::ACFem::zeroProduct (const F1 &f1, const F2 &f2)
 Generate the proper zero-functions for products evaluating to zero. More...
 
template<class GridFunction >
GridFunction::LocalFunctionType Dune::ACFem::localFunction (const GridFunction &f)
 Generate a local function from any GridFunction.
 
template<class FunctionSpace , class GridPart >
FractionGridFunction< typename FunctionSpace::FunctionSpaceType::ScalarFunctionSpaceType, GridPart, 1L, 1UL > Dune::ACFem::oneFunction (const FunctionSpace &space, const GridPart &gridPart)
 Generate a proper constant-one function from the given Fem::FunctionSpace and Fem::GridPart. More...
 
template<class F >
auto Dune::ACFem::oneFunction (const F &f) -> decltype(oneFunction(f.space(), f.gridPart()))
 Generate a proper constant-one function from the given function. More...
 
template<class F >
auto Dune::ACFem::zeroFunction (const Fem::Function< typename F::FunctionSpaceType, F > &f_) -> ZeroGridFunction< typename F::FunctionSpaceType, typename F::GridPartType >
 Generate a ZeroGridFunction on the same function space.
 
template<class F >
auto Dune::ACFem::constantFunction (const Fem::Function< typename F::FunctionSpaceType, F > &f_, const typename F::FunctionSpaceType::RangeType &c) -> ConstantGridFunction< typename F::FunctionSpaceType, typename F::GridPartType >
 Generate a ConstantGridFunction on the same function space.
 
template<class Function >
static auto Dune::ACFem::operator* (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_, const typename Function::RangeFieldType &s) -> decltype(s *asImp(f_))
 f * s
 
template<class Parameter , class Function >
static BinaryGridFunctionExpression< SMultiplyOperation, Parameter, Function > Dune::ACFem::operator* (const ParameterInterface< Parameter > &s_, const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Param * f.
 
template<class Parameter , class Function >
static auto Dune::ACFem::operator* (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_, const ParameterInterface< Parameter > &s_) -> decltype(asImp(s_) *asImp(f_))
 f * Param
 
template<class LeftFunction , class RightFunction >
auto Dune::ACFem::operator/ (const Fem::Function< typename LeftFunction::FunctionSpaceType, LeftFunction > &l_, const Fem::Function< typename RightFunction::FunctionSpaceType::ScalarFunctionSpaceType, RightFunction > &r_) -> decltype(asImp(l_) *std::declval< UnaryGridFunctionExpression< InvertOperation, RightFunction > >())
 Divide some function by a scalar function.
 
template<class RightFunction >
auto Dune::ACFem::operator/ (const typename RightFunction::RangeFieldType &l_, const Fem::Function< typename RightFunction::FunctionSpaceType::ScalarFunctionSpaceType, RightFunction > &r_) -> decltype(l_ *std::declval< UnaryGridFunctionExpression< InvertOperation, RightFunction > >())
 Divide a field element by a scalar function.
 
template<class LeftParameter , class RightFunction >
auto Dune::ACFem::operator/ (const ParameterInterface< LeftParameter > &l_, const Fem::Function< typename RightFunction::FunctionSpaceType::ScalarFunctionSpaceType, RightFunction > &r_) -> decltype(asImp(l_) *std::declval< UnaryGridFunctionExpression< InvertOperation, RightFunction > >())
 Divide a parameter by a scalar function.
 
template<class Function >
static auto Dune::ACFem::operator/ (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_, const typename Function::RangeFieldType &s) -> decltype((1.0/s) *asImp(f_))
 Divide a function by a scalar.
 
template<class Function >
static BinaryGridFunctionExpression< PlusOperation, ConstantGridFunction< typename Function::FunctionSpaceType, typename Function::GridPartType >, Function > Dune::ACFem::operator+ (const typename Function::RangeType &s, const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Add a constant function to a function. More...
 
template<class Function >
static auto Dune::ACFem::operator+ (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_, const typename Function::RangeType &s_) -> decltype(s_+f_)
 Add a constant to a function from the right. More...
 
template<class Parameter , class Function >
static BinaryGridFunctionExpression< PlusOperation, ParameterGridFunction< Parameter, typename Function::FunctionSpaceType, typename Function::GridPartType >, Function > Dune::ACFem::operator+ (const ParameterInterface< Parameter > &s_, const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Add a constant parameter to a function. More...
 
template<class Parameter , class Function >
static auto Dune::ACFem::operator+ (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_, const ParameterInterface< Parameter > &s_) -> decltype(s_+f_)
 Add a constant parameter to a function from the right. More...
 
template<class Parameter , class Function >
static BinaryGridFunctionExpression< MinusOperation, ParameterGridFunction< Parameter, typename Function::FunctionSpaceType, typename Function::GridPartType >, Function > Dune::ACFem::operator- (const ParameterInterface< Parameter > &s_, const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Substract a function from a constant parameter, yielding a grid function as result. More...
 
template<class Parameter , class Function >
static BinaryGridFunctionExpression< MinusOperation, Function, ParameterGridFunction< Parameter, typename Function::FunctionSpaceType, typename Function::GridPartType > > Dune::ACFem::operator- (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_, const ParameterInterface< Parameter > &s_)
 Substract a constant parameter from a function. More...
 
template<class Function >
static UnaryGridFunctionExpression< IdentityOperation, Function > Dune::ACFem::operator* (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Turn a Fem::Function which must have the Fem::HasLocalFunction property into a GridFunctionExpression.
 
template<class Function >
static auto Dune::ACFem::operator+ (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_) -> decltype(*asImp(f_))
 unary + == unary *
 
template<class Function >
static UnaryGridFunctionExpression< ExpOperation, Function > Dune::ACFem::exp (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise exponentiation, exp(f)(x) = [exp(f(x)_0),...,exp(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< LogOperation, Function > Dune::ACFem::log (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise logarithm, log(f)(x) = [log(f(x)_0),...,log(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< SqrtOperation, Function > Dune::ACFem::sqrt (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise square-root, sqrt(f)(x) = [sqrt(f(x)_0),...,sqrt(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< SquareOperation, Function > Dune::ACFem::sqr (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Square operation, yielding the square of the Euclidian norm.
 
template<class Function >
static UnaryGridFunctionExpression< SinOperation, Function > Dune::ACFem::sin (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise sine function, sin(f)(x) = [sin(f(x)_0),...,sin(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< CosOperation, Function > Dune::ACFem::cos (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise cosine function, cos(f)(x) = [cos(f(x)_0),...,cos(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< TanOperation, Function > Dune::ACFem::tan (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise tanine function, tan(f)(x) = [tan(f(x)_0),...,tan(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< AtanOperation, Function > Dune::ACFem::atan (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise atan function, atan(f)(x) = [atan(f(x)_0),...,atan(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< AsinOperation, Function > Dune::ACFem::asin (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise asin function, asin(f)(x) = [asin(f(x)_0),...,asin(f(x)_N].
 
template<class Function >
static UnaryGridFunctionExpression< AcosOperation, Function > Dune::ACFem::acos (const Fem::Function< typename Function::FunctionSpaceType, Function > &f_)
 Component-wise acos function, acos(f)(x) = [acos(f(x)_0),...,acos(f(x)_N].
 

Detailed Description

Define the usual algebraic vector space operations for grid-functions.

The resulting expression templates have LocalFunction facilities. Note that Fem already defines operator-methods for Fem::Mapping (which is a base class for Fem::Function). This has some potential for ambiguous overloads. The other problem is that Fem does not define an interface class for GridFunction. The HasLocalFunction stuff is really not usable in this context. We therefore simply define the expressions for anything which is a Fem::Function and throw a static error if the HasLocalFunction property is not there.

Bug:
Expression templates for wrapped or adapted non-discrete functions have some potential to be inefficient because the local-to-global coordinate mapping potentially is evaluated too often. The WrapperExpressionOptimizations reduce this inefficiency by grouping adapted or wrapped non-discrete functions together. Another good idea would be to optionally cache the global coordinates for quadrature rules (like the values of the basis-functions are precomputed at quadrature points)

Function Documentation

◆ oneFunction() [1/2]

template<class F >
auto Dune::ACFem::oneFunction ( const F &  f) -> decltype(oneFunction(f.space(), f.gridPart()))

Generate a proper constant-one function from the given function.

Parameters
fIgnored, but for the type deduction and f.gridPart(). Type deduction is thus delagated to the C++ compiler.
Returns
A FractionGridFunction which evaluates to to F::RangeFieldType(1).

References Dune::ACFem::oneFunction().

◆ oneFunction() [2/2]

template<class FunctionSpace , class GridPart >
FractionGridFunction<typename FunctionSpace::FunctionSpaceType::ScalarFunctionSpaceType, GridPart, 1L, 1UL> Dune::ACFem::oneFunction ( const FunctionSpace &  space,
const GridPart &  gridPart 
)

Generate a proper constant-one function from the given Fem::FunctionSpace and Fem::GridPart.

Parameters
[in]spaceUsed only n order to deduce the proper scalar-function-space automatically.
[in]gridPartThe Fem::GridPart this function lives on.
Returns
A FractionGridFunction which evaluates to FunctionSpace::RangeFieldType(1).

Referenced by Dune::ACFem::EllipticModel< FunctionSpace, GridPart, Problem >::dirichletWeightFunction(), main(), and Dune::ACFem::oneFunction().

◆ operator+() [1/4]

template<class Parameter , class Function >
static auto Dune::ACFem::operator+ ( const Fem::Function< typename Function::FunctionSpaceType, Function > &  f_,
const ParameterInterface< Parameter > &  s_ 
) -> decltype(s_ + f_)
inlinestatic

Add a constant parameter to a function from the right.

This is handled by first creating a constant function, then this function is added to the function argument. We probably could use "auto" to simplify things ...

◆ operator+() [2/4]

template<class Function >
static auto Dune::ACFem::operator+ ( const Fem::Function< typename Function::FunctionSpaceType, Function > &  f_,
const typename Function::RangeType &  s_ 
) -> decltype(s_ + f_)
inlinestatic

Add a constant to a function from the right.

This is handled by first creating a constant function, then this function is added to the function argument. We probably could use "auto" to simplify things ...

◆ operator+() [3/4]

template<class Parameter , class Function >
static BinaryGridFunctionExpression<PlusOperation, ParameterGridFunction<Parameter, typename Function::FunctionSpaceType, typename Function::GridPartType>, Function> Dune::ACFem::operator+ ( const ParameterInterface< Parameter > &  s_,
const Fem::Function< typename Function::FunctionSpaceType, Function > &  f_ 
)
inlinestatic

Add a constant parameter to a function.

This is handled by first creating a constant function, then this function is added to the function argument. We probably could use "auto" to simplify things ...

◆ operator+() [4/4]

template<class Function >
static BinaryGridFunctionExpression<PlusOperation, ConstantGridFunction<typename Function::FunctionSpaceType, typename Function::GridPartType>, Function> Dune::ACFem::operator+ ( const typename Function::RangeType &  s,
const Fem::Function< typename Function::FunctionSpaceType, Function > &  f_ 
)
inlinestatic

Add a constant function to a function.

This is handled by first creating a constant function, then this function is added to the function argument. We probably could use "auto" to simplify things ...

◆ operator-() [1/2]

template<class Parameter , class Function >
static BinaryGridFunctionExpression<MinusOperation, Function, ParameterGridFunction<Parameter, typename Function::FunctionSpaceType, typename Function::GridPartType> > Dune::ACFem::operator- ( const Fem::Function< typename Function::FunctionSpaceType, Function > &  f_,
const ParameterInterface< Parameter > &  s_ 
)
inlinestatic

Substract a constant parameter from a function.

This is handled by first creating a constant function, then this function is added to the function argument. We probably could use "auto" to simplify things ...

◆ operator-() [2/2]

template<class Parameter , class Function >
static BinaryGridFunctionExpression<MinusOperation, ParameterGridFunction<Parameter, typename Function::FunctionSpaceType, typename Function::GridPartType>, Function> Dune::ACFem::operator- ( const ParameterInterface< Parameter > &  s_,
const Fem::Function< typename Function::FunctionSpaceType, Function > &  f_ 
)
inlinestatic

Substract a function from a constant parameter, yielding a grid function as result.

. This is handled by first creating a constant function, then this function is added to the function argument. We probably could use "auto" to simplify things ...

◆ zeroProduct()

template<class F1 , class F2 >
static ZeroGridFunction< typename FunctionMultiplicationResultTraits<typename F1::FunctionSpaceType, typename F2::FunctionSpaceType>::FunctionSpaceType, typename F1::GridPartType> Dune::ACFem::zeroProduct ( const F1 &  f1,
const F2 &  f2 
)
inlinestatic

Generate the proper zero-functions for products evaluating to zero.

The ZeroGridFunction potentially is vector valued. When multiplying vector-valued functions there are several cases (vector*vector -> scalar, vector*scalar -> vector, scalar*vector -> vector, scalar*scalar -> vector) which yield ZeroGridFunction objects with different funtction space. This template function takes care of generating a compatible ZeroGridFunction which fits the result function-space.

Parameters
[in]f1Ignored but for the type and the f1.gridPart(). Abused in order to delegate the proper type definitions to the C++ compiler.
[in]f2Ignored but for the type. Abused in order to delegate the proper type definitions to the C++ compiler.
Returns
A ZeroGridFunction compatible with the result function-space.

Referenced by Dune::ACFem::operator*().

Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (Apr 23, 22:30, 2024)