DUNE-FEM (unstable)

Dune::Fem::MutableLocalFunction< DiscreteFunction > Class Template Reference

#include <dune/fem/function/localfunction/mutable.hh>

Public Types

typedef DiscreteFunction DiscreteFunctionType
 type of DiscreteFunction
 
typedef BaseType::EntityType EntityType
 type of the entity, the local function lives on is given by the space
 
typedef BaseType::LocalDofVectorType LocalDofVectorType
 type of local Dof vector object
 
typedef BaseType::BasisFunctionSetType BasisFunctionSetType
 type of BasisFunctionSet
 
typedef LocalDofVectorType::value_type DofType
 type of DoF use with the discrete function
 
typedef LocalDofVectorType::size_type SizeType
 type of index
 
typedef BasisFunctionSetType::FunctionSpaceType FunctionSpaceType
 type of functionspace
 
typedef FunctionSpaceType::DomainFieldType DomainFieldType
 field type of the domain
 
typedef FunctionSpaceType::RangeFieldType RangeFieldType
 field type of the range
 
typedef FunctionSpaceType::DomainType DomainType
 type of domain vectors, i.e., type of coordinates
 
typedef FunctionSpaceType::RangeType RangeType
 type of range vectors, i.e., type of function values
 
typedef FunctionSpaceType::JacobianRangeType JacobianRangeType
 type of the Jacobian, i.e., type of evaluated Jacobian matrix
 
typedef FunctionSpaceType::HessianRangeType HessianRangeType
 type of the Hessian
 
typedef EntityType::Geometry::LocalCoordinate LocalCoordinateType
 type of local coordinates
 
typedef Traits::derived_type derived_type
 type of derived vector class
 
typedef Traits::value_type value_type
 export the type representing the field
 
typedef FieldTraits< value_type >::field_type field_type
 export the type representing the field
 
typedef Traits::value_type block_type
 export the type representing the components
 
typedef Traits::size_type size_type
 The type used for the index access and size operation.
 
typedef DenseIterator< DenseVector, value_typeIterator
 Iterator class for sequential access.
 
typedef Iterator iterator
 typedef for stl compliant access
 
typedef DenseIterator< const DenseVector, const value_typeConstIterator
 ConstIterator class for sequential access.
 
typedef ConstIterator const_iterator
 typedef for stl compliant access
 

Public Member Functions

 MutableLocalFunction (DiscreteFunctionType &discreteFunction)
 Constructor creating empty local function from given discrete function.
 
 MutableLocalFunction (const DiscreteFunctionType &discreteFunction)
 Constructor creating empty local function from given discrete function.
 
 MutableLocalFunction (DiscreteFunctionType &discreteFunction, const EntityType &entity)
 Constructor creating local function from given discrete function and entity, not empty.
 
 MutableLocalFunction (const DiscreteFunctionType &dFunction, const EntityType &entity)
 Constructor creating local function from given discrete function and entity, not empty.
 
 MutableLocalFunction (const ThisType &other)
 copy constructor
 
 MutableLocalFunction (ThisType &&other)
 move constructor
 
const LocalDofVectorTypelocalDofVector () const
 return const reference to local Dof Vector

 
LocalDofVectorTypelocalDofVector ()
 return mutable reference to local Dof Vector

 
const DofTypeoperator[] (SizeType num) const
 access to local dofs (read-only) More...
 
DofTypeoperator[] (SizeType num)
 access to local dofs (read-write) More...
 
value_typeoperator[] (size_type i)
 random access
 
void assign (const LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType, T > &other)
 assign all DoFs of this local function More...
 
void clear ()
 set all DoFs to zero
 
void axpy (const PointType &x, const RangeType &factor)
 axpy operation for local function More...
 
void axpy (const PointType &x, const JacobianRangeType &factor)
 axpy operation for local function More...
 
void axpy (const PointType &x, const RangeType &factor1, const JacobianRangeType &factor2)
 axpy operation for local function More...
 
template<class Other >
derived_typeaxpy (const field_type &a, const DenseVector< Other > &x)
 vector space axpy operation ( *this += a x )
 
int order () const
 obtain the order of this local function More...
 
const BasisFunctionSetTypebasisFunctionSet () const
 obtain the basis function set for this local function More...
 
const EntityTypeentity () const
 obtain the entity, this local function lives on More...
 
void evaluate (const PointType &x, RangeType &ret) const
 evaluate the local function More...
 
void jacobian (const PointType &x, JacobianRangeType &ret) const
 evaluate Jacobian of the local function More...
 
void hessian (const PointType &x, HessianRangeType &ret) const
 evaluate Hessian of the local function More...
 
int numDofs () const
 obtain the number of local DoFs More...
 
SizeType size () const
 obtain the number of local DoFs More...
 
void axpyQuadrature (const QuadratureType &quad, const Vectors &... values)
 evaluate all basisfunctions for all quadrature points, multiply with the given factor and add the result to the local coefficients

 
void axpyQuadrature (const QuadratureType &quad, const RangeVectorType &rangeVector, const JacobianRangeVectorType &jacobianVector)
 evaluate all basisfunctions for all quadrature points, multiply with the given factor and add the result to the local coefficients
 
void evaluateQuadrature (const QuadratureType &quad, Vectors &... vec) const
 evaluate all basisfunctions for all quadrature points and store the results in the result vector
 
void jacobianQuadrature (const QuadratureType &quad, Vectors &... vec) const
 evaluate all Jacobians for all basis functions for all quadrature points and store the results in the result vector
 
void hessianQuadrature (const QuadratureType &quad, Vectors &... vec) const
 evaluate all hessians of all basis functions for all quadrature points and store the results in the result vector
 
const LocalDofVectorTypelocalDofVector () const
 return const reference to local Dof Vector

 
bool valid () const
 Returns true if local function if bind or init was previously called.
 
value_typefront ()
 return reference to first element
 
const value_typefront () const
 return reference to first element
 
value_typeback ()
 return reference to last element
 
const value_typeback () const
 return reference to last element
 
bool empty () const
 checks whether the container is empty
 
Iterator begin ()
 begin iterator
 
ConstIterator begin () const
 begin ConstIterator
 
Iterator end ()
 end iterator
 
ConstIterator end () const
 end ConstIterator
 
Iterator beforeEnd ()
 
ConstIterator beforeEnd () const
 
Iterator beforeBegin ()
 
ConstIterator beforeBegin () const
 
Iterator find (size_type i)
 return iterator to given element or end()
 
ConstIterator find (size_type i) const
 return iterator to given element or end()
 
template<class Other >
derived_typeoperator+= (const DenseVector< Other > &x)
 vector space addition
 
template<typename ValueType >
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator+= (const ValueType &kk)
 vector space add scalar to all comps More...
 
template<class Other >
derived_typeoperator-= (const DenseVector< Other > &x)
 vector space subtraction
 
template<typename ValueType >
std::enable_if< std::is_convertible< ValueType, value_type >::value, derived_type >::type & operator-= (const ValueType &kk)
 vector space subtract scalar from all comps More...
 
template<class Other >
derived_type operator+ (const DenseVector< Other > &b) const
 Binary vector addition.
 
template<class Other >
derived_type operator- (const DenseVector< Other > &b) const
 Binary vector subtraction.
 
derived_type operator- () const
 Vector negation.
 
template<typename FieldType >
std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator*= (const FieldType &kk)
 vector space multiplication with scalar More...
 
template<typename FieldType >
std::enable_if< std::is_convertible< FieldType, field_type >::value, derived_type >::type & operator/= (const FieldType &kk)
 vector space division by scalar More...
 
template<class Other >
bool operator== (const DenseVector< Other > &x) const
 Binary vector comparison.
 
template<class Other >
bool operator!= (const DenseVector< Other > &x) const
 Binary vector incomparison.
 
template<class Other >
PromotionTraits< field_type, typename DenseVector< Other >::field_type >::PromotedType operator* (const DenseVector< Other > &x) const
 indefinite vector dot product \(\left (x^T \cdot y \right)\) which corresponds to Petsc's VecTDot More...
 
template<class Other >
PromotionTraits< field_type, typename DenseVector< Other >::field_type >::PromotedType dot (const DenseVector< Other > &x) const
 vector dot product \(\left (x^H \cdot y \right)\) which corresponds to Petsc's VecDot More...
 
FieldTraits< value_type >::real_type one_norm () const
 one norm (sum over absolute values of entries)
 
FieldTraits< value_type >::real_type one_norm_real () const
 simplified one norm (uses Manhattan norm for complex values)
 
FieldTraits< value_type >::real_type two_norm () const
 two norm sqrt(sum over squared values of entries)
 
FieldTraits< value_type >::real_type two_norm2 () const
 square of two norm (sum over squared values of entries), need for block recursion
 
template<typename vt = value_type, typename std::enable_if<!HasNaN< vt >::value, int >::type = 0>
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
 
template<typename vt = value_type, typename std::enable_if< HasNaN< vt >::value, int >::type = 0>
FieldTraits< vt >::real_type infinity_norm () const
 infinity norm (maximum of absolute values of entries)
 
template<typename vt = value_type, typename std::enable_if<!HasNaN< vt >::value, int >::type = 0>
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
template<typename vt = value_type, typename std::enable_if< HasNaN< vt >::value, int >::type = 0>
FieldTraits< vt >::real_type infinity_norm_real () const
 simplified infinity norm (uses Manhattan norm for complex values)
 
size_type N () const
 number of blocks in the vector (are of size 1 here)
 
size_type dim () const
 dimension of the vector space
 

Static Public Attributes

static const int dimDomain
 dimension of the domain
 
static const int dimRange
 dimension of the range
 
constexpr static int blocklevel = 1
 The number of block levels we contain. This is the leaf, that is, 1.
 

Protected Member Functions

void init (const EntityType &entity)
 initialize the local function for an entity More...
 
void init (const BasisFunctionSetType &basisFunctionSet)
 initialize the local function for an basisFunctionSet More...
 
void bind (const EntityType &entity)
 initialize the local function for an entity More...
 

Related Functions

(Note that these are not member functions.)

template<typename V >
std::ostream & operator<< (std::ostream &s, const DenseVector< V > &v)
 Write a DenseVector to an output stream. More...
 

Detailed Description

template<class DiscreteFunction>
class Dune::Fem::MutableLocalFunction< DiscreteFunction >

Manages the getting and deleting of local function pointers and acts like a local functions

Member Function Documentation

◆ assign()

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::assign ( const LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , T > &  other)
inlineinherited

assign all DoFs of this local function

Parameters
[in]lflocal function to assign DoFs from

◆ axpy() [1/3]

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::axpy ( const PointType &  x,
const JacobianRangeType factor 
)
inlineinherited

axpy operation for local function

Denoting the DoFs of the local function by \(u_i\) and the basis functions by \(\varphi_i\), this function performs the following operation:

\[ u_i = u_i + factor \cdot \nabla\varphi_i( x ) \]

Parameters
[in]xpoint to evaluate jacobian of basis functions in
[in]factoraxpy factor

◆ axpy() [2/3]

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::axpy ( const PointType &  x,
const RangeType factor 
)
inlineinherited

axpy operation for local function

Denoting the DoFs of the local function by \(u_i\) and the basis functions by \(\varphi_i\), this function performs the following operation:

\[ u_i = u_i + factor \cdot \varphi_i( x ) \]

Parameters
[in]xpoint to evaluate basis functions in
[in]factoraxpy factor

◆ axpy() [3/3]

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::axpy ( const PointType &  x,
const RangeType factor1,
const JacobianRangeType factor2 
)
inlineinherited

axpy operation for local function

Denoting the DoFs of the local function by \(u_i\) and the basis functions by \(\varphi_i\), this function performs the following operation:

\[ u_i = u_i + factor1 \cdot \varphi_i( x ) + factor2 \cdot \nabla\varphi_i( x ) \]

Parameters
[in]xpoint to evaluate basis functions in
[in]factor1axpy factor for \(\varphi( x )\)
[in]factor2axpy factor for \(\nabla\varphi( x )\)

◆ basisFunctionSet()

const BasisFunctionSetType& Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::basisFunctionSet ( ) const
inlineinherited

obtain the basis function set for this local function

Returns
reference to the basis function set

◆ beforeBegin() [1/2]

template<typename V >
Iterator Dune::DenseVector< V >::beforeBegin ( )
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.

◆ beforeBegin() [2/2]

template<typename V >
ConstIterator Dune::DenseVector< V >::beforeBegin ( ) const
inlineinherited
Returns
an iterator that is positioned before the first entry of the vector.

◆ beforeEnd() [1/2]

template<typename V >
Iterator Dune::DenseVector< V >::beforeEnd ( )
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector, i.e. at the last entry.

References Dune::DenseVector< V >::size().

◆ beforeEnd() [2/2]

template<typename V >
ConstIterator Dune::DenseVector< V >::beforeEnd ( ) const
inlineinherited
Returns
an iterator that is positioned before the end iterator of the vector. i.e. at the last element

References Dune::DenseVector< V >::size().

◆ bind()

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::bind ( const EntityType entity)
inlineprotectedinherited

initialize the local function for an entity

Binds the local function to an basisFunctionSet and entity.

Note
Must be overloaded on the derived implementation class.
Parameters
[in]entityto bind the local function to

◆ dot()

template<typename V >
template<class Other >
PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< V >::dot ( const DenseVector< Other > &  x) const
inlineinherited

vector dot product \(\left (x^H \cdot y \right)\) which corresponds to Petsc's VecDot

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecDot.html

Parameters
xother vector
Returns

References Dune::dot(), and Dune::DenseVector< V >::size().

◆ entity()

const EntityType& Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::entity ( ) const
inlineinherited

obtain the entity, this local function lives on

Returns
reference to the entity

◆ evaluate()

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::evaluate ( const PointType &  x,
RangeType ret 
) const
inlineinherited

evaluate the local function

Parameters
[in]xevaluation point in local coordinates
[out]retvalue of the function in the given point

◆ hessian()

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::hessian ( const PointType &  x,
HessianRangeType ret 
) const
inlineinherited

evaluate Hessian of the local function

Note
Though the Hessian is evaluated on the reference element, the return value is the Hessian with respect to the actual entity.
Parameters
[in]xevaluation point in local coordinates
[out]retHessian of the function in the evaluation point

◆ init() [1/2]

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::init ( const BasisFunctionSetType basisFunctionSet)
inlineprotectedinherited

initialize the local function for an basisFunctionSet

Binds the local function to an basisFunctionSet and entity.

Note
A local function must be initialized to an entity before it can be used.
This function can be called multiple times to use the local function for more than one entity.
Parameters
[in]basisFunctionSetto bind the local function to

◆ init() [2/2]

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::init ( const EntityType entity)
inlineprotectedinherited

initialize the local function for an entity

Binds the local function to an basisFunctionSet and entity.

Note
Must be overloaded on the derived implementation class.
Parameters
[in]entityto bind the local function to

◆ jacobian()

void Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::jacobian ( const PointType &  x,
JacobianRangeType ret 
) const
inlineinherited

evaluate Jacobian of the local function

Note
Though the Jacobian is evaluated on the reference element, the return value is the Jacobian with respect to the actual entity.
Parameters
[in]xevaluation point in local coordinates
[out]retJacobian of the function in the evaluation point

◆ numDofs()

int Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::numDofs ( ) const
inlineinherited

obtain the number of local DoFs

Obtain the number of local DoFs of this local function. The value is identical to the number of basis functons on the entity.

Returns
number of local DoFs

◆ operator*()

template<typename V >
template<class Other >
PromotionTraits<field_type,typename DenseVector<Other>::field_type>::PromotedType Dune::DenseVector< V >::operator* ( const DenseVector< Other > &  x) const
inlineinherited

indefinite vector dot product \(\left (x^T \cdot y \right)\) which corresponds to Petsc's VecTDot

http://www.mcs.anl.gov/petsc/petsc-current/docs/manualpages/Vec/VecTDot.html

Parameters
xother vector
Returns

References Dune::DenseVector< V >::size().

◆ operator*=()

template<typename V >
template<typename FieldType >
std::enable_if< std::is_convertible<FieldType, field_type>::value, derived_type >::type& Dune::DenseVector< V >::operator*= ( const FieldType &  kk)
inlineinherited

vector space multiplication with scalar

we use enable_if to avoid an ambiguity, if the function parameter can be converted to field_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to field_type.

References Dune::DenseVector< V >::size().

◆ operator+=()

template<typename V >
template<typename ValueType >
std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< V >::operator+= ( const ValueType &  kk)
inlineinherited

vector space add scalar to all comps

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

References Dune::DenseVector< V >::size().

◆ operator-=()

template<typename V >
template<typename ValueType >
std::enable_if< std::is_convertible<ValueType, value_type>::value, derived_type >::type& Dune::DenseVector< V >::operator-= ( const ValueType &  kk)
inlineinherited

vector space subtract scalar from all comps

we use enable_if to avoid an ambiguity, if the function parameter can be converted to value_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to value_type.

References Dune::DenseVector< V >::size().

◆ operator/=()

template<typename V >
template<typename FieldType >
std::enable_if< std::is_convertible<FieldType, field_type>::value, derived_type >::type& Dune::DenseVector< V >::operator/= ( const FieldType &  kk)
inlineinherited

vector space division by scalar

we use enable_if to avoid an ambiguity, if the function parameter can be converted to field_type implicitly. (see FS#1457)

The function is only enabled, if the parameter is directly convertible to field_type.

References Dune::DenseVector< V >::size().

◆ operator[]() [1/2]

DofType& Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::operator[] ( SizeType  num)
inlineinherited

access to local dofs (read-write)

Parameters
[in]numlocal DoF number
Returns
reference to DoF

◆ operator[]() [2/2]

const DofType& Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::operator[] ( SizeType  num) const
inlineinherited

access to local dofs (read-only)

Parameters
[in]numlocal dof number
Returns
reference to dof

◆ order()

int Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::order ( ) const
inlineinherited

obtain the order of this local function

The order of a local function refers to the polynomial order required to integrate it exactly.

Note
It is not completely clear what this value should be, e.g., for bilinear basis functions.
Returns
order of the local function

◆ size()

SizeType Dune::Fem::LocalFunction< DiscreteFunctionTraits< DiscreteFunction > ::DiscreteFunctionSpaceType ::BasisFunctionSetType , DiscreteFunctionTraits< DiscreteFunction > ::LocalDofVectorType >::size ( ) const
inlineinherited

obtain the number of local DoFs

Obtain the number of local DoFs of this local function. The value is identical to the number of basis functons on the entity.

Returns
number of local DoFs

The documentation for this class was generated from the following file:
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.80.0 (May 16, 22:29, 2024)