DUNE-FEM (unstable)
#include <dune/fem/function/common/discretefunction.hh>
Public Types | |
typedef Impl | DiscreteFunctionType |
type of the discrete function (Barton-Nackman parameter) | |
typedef BaseType::DiscreteFunctionSpaceType | DiscreteFunctionSpaceType |
type of discrete function space | |
typedef BaseType::GridPartType | GridPartType |
type of the underlying grid part | |
typedef DiscreteFunctionSpaceType::DomainType | DomainType |
type of domain vector | |
typedef DiscreteFunctionSpaceType::RangeType | RangeType |
type of range vector | |
typedef DiscreteFunctionSpaceType::JacobianRangeType | JacobianRangeType |
type of jacobian | |
typedef DiscreteFunctionSpaceType::HessianRangeType | HessianRangeType |
type of hessian | |
typedef DiscreteFunctionSpaceType::DomainFieldType | DomainFieldType |
type of domain field (usually a float type) | |
typedef DiscreteFunctionSpaceType::RangeFieldType | RangeFieldType |
type of range field (usually a float type) | |
typedef Traits::DofIteratorType | DofIteratorType |
type of the dof iterator | |
typedef Traits::ConstDofIteratorType | ConstDofIteratorType |
type of the const dof iterator | |
typedef Traits::DofVectorType | DofVectorType |
type of DofVector | |
typedef Traits::LocalDofVectorType | LocalDofVectorType |
type of LocalDofVector | |
typedef Traits::LocalDofVectorAllocatorType | LocalDofVectorAllocatorType |
type of LocalDofVector | |
typedef BaseType::LocalFunctionType | LocalFunctionType |
type of local functions | |
typedef DofVectorType::SizeType | SizeType |
size type of the block vector | |
typedef DiscreteFunctionSpaceType::FunctionSpaceType | FunctionSpaceType |
type of associated function space | |
typedef DiscreteFunctionSpaceType::GridType | GridType |
type of the underlying grid | |
typedef BaseType::MappingType | MappingType |
type of mapping base class for this discrete function | |
Public Member Functions | |
const std::string & | name () const |
obtain the name of the discrete function More... | |
std::string & | name () |
obtain the name of the discrete function More... | |
constexpr int | order () const |
obtain an upper bound on the polynomial order of the underlying space. More... | |
bool | continuous () const |
returns true if the space contains only globally continuous functions More... | |
const DiscreteFunctionSpaceType & | space () const |
obtain a reference to the corresponding DiscreteFunctionSpace More... | |
const GridPartType & | gridPart () const |
obtain a reference to the underlying grid part | |
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... | |
LocalFunctionType | localFunction () |
obtain an uninitialized local function (read-write) More... | |
const LocalFunctionType | localFunction () const |
obtain an uninitialized local function (read-write) More... | |
void | clear () |
set all degrees of freedom to zero More... | |
int | blocks () const |
obtain total number of blocks, i.e. size / blockSize. More... | |
DofBlockPtrType | block (unsigned int index) |
ConstDofBlockPtrType | block (unsigned int index) const |
SizeType | size () const |
Return the number of blocks in the block vector. More... | |
ConstDofIteratorType | dbegin () const |
Obtain the constant iterator pointing to the first dof. More... | |
DofIteratorType | dbegin () |
Obtain the non-constant iterator pointing to the first dof. More... | |
ConstDofIteratorType | dend () const |
Obtain the constant iterator pointing to the last dof. More... | |
DofIteratorType | dend () |
Obtain the non-constant iterator pointing to the last dof. More... | |
template<class DFType > | |
void | axpy (const RangeFieldType &s, const DiscreteFunctionInterface< DFType > &g) |
axpy operation More... | |
void | axpy (const RangeFieldType &s, const DiscreteFunctionInterfaceType &g) |
axpy operation More... | |
template<class DFType > | |
RangeFieldType | scalarProductDofs (const DiscreteFunctionInterface< DFType > &other) const |
Scalar product between the DoFs of two discrete functions. More... | |
Dune::FieldTraits< RangeFieldType >::real_type | normSquaredDofs () const |
Squared small l^2 norm of all dofs. More... | |
void | print (std ::ostream &out) const |
print all DoFs to a stream (for debugging purposes) More... | |
bool | dofsValid () const |
check for NaNs More... | |
template<class DFType > | |
void | assign (const DiscreteFunctionInterface< DFType > &g) |
void | assign (const DiscreteFunctionType &g) |
template<class Operation > | |
CommDataHandle< Operation >::Type | dataHandle (const Operation &operation) |
return reference to data handle object More... | |
void | communicate () |
do default communication of space for this discrete function More... | |
void | evaluate (const DomainType &x, RangeType &value) const |
evaluate the function 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 (const DomainType &x,HessianRangeType &hessian) const More... | |
template<class DFType > | |
DiscreteFunctionType & | operator+= (const DiscreteFunctionInterface< DFType > &g) |
add another discrete function to this one More... | |
DiscreteFunctionType & | operator+= (const DiscreteFunctionType &g) |
add another discrete function to this one More... | |
template<class DFType > | |
DiscreteFunctionType & | operator-= (const DiscreteFunctionInterface< DFType > &g) |
substract all degrees of freedom from given discrete function using the dof iterators More... | |
DiscreteFunctionType & | operator-= (const DiscreteFunctionType &g) |
substract all degrees of freedom from given discrete function using the dof iterators More... | |
DiscreteFunctionType & | operator*= (const RangeFieldType &scalar) |
multiply all DoFs with a scalar factor More... | |
DiscreteFunctionType & | operator/= (const RangeFieldType &scalar) |
devide all DoFs by a scalar factor More... | |
template<class StreamTraits > | |
void | read (InStreamInterface< StreamTraits > &in) |
read the discrete function from a stream More... | |
template<class StreamTraits > | |
void | write (OutStreamInterface< StreamTraits > &out) const |
write the discrete function into a stream More... | |
void | enableDofCompression () |
Enable this discrete function for dof compression, i.e. during grid changes a dof compression is done when the DofManagers compress is called. More... | |
template<class LocalDofs > | |
void | addScaledLocalDofs (const EntityType &entity, const RangeFieldType &s, const LocalDofs &localDofs) |
add scaled local Dofs to dof vector associated with the entity More... | |
template<class LocalDofs > | |
void | addLocalDofs (const EntityType &entity, const LocalDofs &localDofs) |
add local Dofs to dof vector associated with the entity More... | |
template<class LocalDofs > | |
void | setLocalDofs (const EntityType &entity, const LocalDofs &localDofs) |
set local Dofs to dof vector associated with the entity More... | |
template<class Vector > | |
void | getLocalDofs (const EntityType &entity, Vector &localDofs) const |
fill local Dofs to dof vector associated with the entity More... | |
LocalDofVectorAllocatorType & | localDofVectorAllocator () const |
obtain the local function storage More... | |
template<class AssembleOperation > | |
void | beginAssemble () |
Initiate the assemble of values using the LocalContribution concept. More... | |
template<class AssembleOperation > | |
void | endAssemble (const bool communicate=true) |
Finalize the assemble of values using the LocalContribution concept. More... | |
void | getLocalDofReferences (const EntityType &entity, LocalDofVectorType &localDofs) |
get local Dofs and store a reference to it in the LocalDofVector | |
Static Public Attributes | |
static constexpr std::size_t | blockSize = Hybrid::size( BlockIndices() ) |
size of the dof blocks | |
Protected Member Functions | |
DiscreteFunctionDefault (const std::string &name, const DiscreteFunctionSpaceType &dfSpace) | |
Constructor storing discrete function space and local function factory. More... | |
virtual void | backup () const |
virtual void | restore () |
virtual void | insertSubData () |
virtual void | removeSubData () |
template<class Functor > | |
void | evaluateGlobal (const DomainType &x, Functor functor) const |
evaluate functor in global coordinate | |
Related Functions | |
(Note that these are not member functions.) | |
template<class Impl > | |
std::ostream & | operator<< (std::ostream &out, const DiscreteFunctionInterface< Impl > &df) |
write a discrete function into an STL stream More... | |
Detailed Description
class Dune::Fem::DiscreteFunctionDefault< Impl >
Default implementation of the discrete function. This class is responsible for the dof storage. Different implementations of the discrete function use different dof storage. The default implementation provides +=, -= and so on operators and a DofIterator access, which can run over all dofs in an efficient way. Furthermore with an entity you can access a local function to evaluate the discrete function by multiplying the dofs and the basefunctions.
Constructor & Destructor Documentation
◆ DiscreteFunctionDefault()
|
inlineprotected |
Constructor storing discrete function space and local function factory.
The discrete function space is passed to the interface class and the local function storage is initialized.
- Parameters
-
[in] name name of the discrete function [in] dfSpace discrete function space [in] lfFactory local function factory
Member Function Documentation
◆ addLocalDofs()
|
inline |
add local Dofs to dof vector associated with the entity
- Parameters
-
[in] entity Entity to focus view of discrete function [in] localDofs the local dofs vector to be added
References Dune::Fem::DiscreteFunctionDefault< Impl >::space().
◆ addScaledLocalDofs()
|
inline |
add scaled local Dofs to dof vector associated with the entity
- Parameters
-
[in] entity Entity to focus view of discrete function [in] s scaling factor [in] localDofs the local dofs vector to be added
References Dune::Fem::DiscreteFunctionDefault< Impl >::space().
◆ assign() [1/2]
|
inline |
◆ assign() [2/2]
|
inline |
◆ axpy() [1/2]
|
inline |
axpy operation
Adds s * g to this discrete function.
- Parameters
-
[in] s scalar value to scale g with [in] g discrete function to add
◆ axpy() [2/2]
|
inline |
axpy operation
Adds s * g to this discrete function.
- Parameters
-
[in] s scalar value to scale g with [in] g discrete function to add
◆ backup()
|
inlineprotectedvirtual |
Implements Dune::Fem::PersistentObject.
References Dune::Fem::DiscreteFunctionDefault< Impl >::write().
◆ beginAssemble()
|
inline |
Initiate the assemble of values using the LocalContribution concept.
- Template Parameters
-
AssembleOperation the specific operation (Add, Set, ...)
References DUNE_THROW.
◆ block() [1/2]
|
inline |
◆ block() [2/2]
|
inline |
◆ blocks()
|
inline |
obtain total number of blocks, i.e. size / blockSize.
The number of blocks of DoFs (degrees of freedom) can also be seen as the size of the discrete function divided by the blockSize.
- Returns
- total number of DoFs blocks
◆ clear()
|
inline |
set all degrees of freedom to zero
◆ communicate()
|
inline |
do default communication of space for this discrete function
References DUNE_THROW, and Dune::Fem::DiscreteFunctionDefault< Impl >::space().
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::endAssemble().
◆ continuous()
|
inline |
returns true if the space contains only globally continuous functions
For example, a Lagrange space returns true while a discontiuous Galerkin space returns false.
- Returns
- true if the space contians only globally continous functions, false otherwise
References Dune::Fem::DiscreteFunctionDefault< Impl >::space().
◆ dataHandle()
CommDataHandle< Operation >::Type Dune::Fem::DiscreteFunctionDefault< Impl >::dataHandle | ( | const Operation & | operation | ) |
return reference to data handle object
◆ dbegin() [1/2]
|
inline |
Obtain the non-constant iterator pointing to the first dof.
- Returns
- Non-Constant iterator pointing to the first dof
◆ dbegin() [2/2]
|
inline |
Obtain the constant iterator pointing to the first dof.
- Returns
- Constant iterator pointing to the first dof
◆ dend() [1/2]
|
inline |
Obtain the non-constant iterator pointing to the last dof.
- Returns
- Non-Constant iterator pointing to the last dof
◆ dend() [2/2]
|
inline |
Obtain the constant iterator pointing to the last dof.
- Returns
- Constant iterator pointing to the last dof
Referenced by Dune::Fem::SparseRowMatrixObject< DomainSpace, RangeSpace, Matrix >::extractDiagonal().
◆ dofsValid()
|
inline |
check for NaNs
- Returns
- if one of the DoFs is NaN false is returned, otherwise true
◆ enableDofCompression()
|
inline |
Enable this discrete function for dof compression, i.e. during grid changes a dof compression is done when the DofManagers compress is called.
- Note
- The default implementation does nothing.
◆ endAssemble()
|
inline |
Finalize the assemble of values using the LocalContribution concept.
- Template Parameters
-
AssembleOperation the specific operation (Add, Set, ...)
References Dune::Fem::DiscreteFunctionDefault< Impl >::communicate(), and DUNE_THROW.
◆ evaluate()
|
inline |
evaluate the function
- Parameters
-
[in] x evaluation point [out] value value of the function in x
References Dune::Fem::DiscreteFunctionDefault< Impl >::localFunction().
◆ getLocalDofs()
|
inline |
fill local Dofs to dof vector associated with the entity
- Parameters
-
[in] entity Entity to focus view of discrete function [out] localDofs the local dofs vector to be set
- Note
- localDofs should have sufficient size to store the dof values
References Dune::Fem::DiscreteFunctionDefault< Impl >::space().
Referenced by Dune::Fem::LocalDataInliner< DiscreteFunctionType, ContainsCheck >::inlineData().
◆ hessian()
|
inline |
evaluate the hessian of the function (const DomainType &x,HessianRangeType &hessian) const
- Parameters
-
[in] x evaluation point [out] hessian value of the hessian in x (const DomainType &x,HessianRangeType &hessian) const
References Dune::Fem::DiscreteFunctionDefault< Impl >::hessian(), and Dune::Fem::DiscreteFunctionDefault< Impl >::localFunction().
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::hessian().
◆ insertSubData()
|
protectedvirtual |
Reimplemented from Dune::Fem::PersistentObject.
References Dune::Fem::Capabilities::isPersistentIndexSet< IndexSet >::map().
◆ jacobian()
|
inline |
evaluate the Jacobian of the function
- Parameters
-
[in] x evaluation point [out] jacobian value of the Jacobian in x
References Dune::Fem::DiscreteFunctionDefault< Impl >::jacobian(), and Dune::Fem::DiscreteFunctionDefault< Impl >::localFunction().
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::jacobian().
◆ localDofVectorAllocator()
|
inline |
obtain the local function storage
- Returns
- a reference to the local function storage
◆ localFunction() [1/4]
|
inline |
obtain an uninitialized local function (read-write)
- Note
- before calling any method of the local function initialize it passing an entity
- Returns
- an uninitialized local function
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::evaluate(), Dune::Fem::DiscreteFunctionDefault< Impl >::hessian(), and Dune::Fem::DiscreteFunctionDefault< Impl >::jacobian().
◆ localFunction() [2/4]
|
inline |
obtain an uninitialized local function (read-write)
- Note
- before calling any method of the local function initialize it passing an entity
- Returns
- an uninitialized local function
◆ localFunction() [3/4]
|
inline |
obtain a local function for an entity (read-write)
- Parameters
-
[in] entity Entity to focus view of discrete function
- Returns
- a local function associated with the entity
Referenced by Dune::Fem::HdivProjection< DiscreteFunctionType >::normalJump().
◆ localFunction() [4/4]
|
inline |
obtain a local function for an entity (read-write)
- Parameters
-
[in] entity Entity to focus view of discrete function
- Returns
- a local function associated with the entity
◆ name() [1/2]
|
inline |
obtain the name of the discrete function
- Returns
- string holding name of discrete function
◆ name() [2/2]
|
inline |
obtain the name of the discrete function
- Returns
- string holding name of discrete function
◆ normSquaredDofs()
|
inline |
Squared small l^2 norm of all dofs.
- Note
- This is already parallel, so do not sum over all processes after calling scalarProductDofs!
- It is assumed that the discrete function has been communicated (i.e., every local DoF hat the value of the corresponding global DoF).
- Returns
- the squared norm of the DoF-vectors
◆ operator*=()
|
inline |
multiply all DoFs with a scalar factor
- Parameters
-
[in] scalar factor to multiply DoFs with
- Returns
- reference to this discrete function (i.e. *this)
◆ operator+=() [1/2]
|
inline |
add another discrete function to this one
- Parameters
-
[in] g discrete function to add
- Returns
- a reference to this discrete function (i.e. *this)
◆ operator+=() [2/2]
|
inline |
add another discrete function to this one
- Parameters
-
[in] g discrete function to add
- Returns
- a reference to this discrete function (i.e. *this)
◆ operator-=() [1/2]
|
inline |
substract all degrees of freedom from given discrete function using the dof iterators
- Parameters
-
[in] g discrete function which is substracted from this discrete function
- Returns
- reference to this (i.e. *this)
◆ operator-=() [2/2]
|
inline |
substract all degrees of freedom from given discrete function using the dof iterators
- Parameters
-
[in] g discrete function which is substracted from this discrete function
- Returns
- reference to this (i.e. *this)
◆ operator/=()
|
inline |
devide all DoFs by a scalar factor
- Parameters
-
[in] scalar factor with which all dofs are devided
- Returns
- reference to this discrete function (i.e. *this)
References Dune::Fem::DiscreteFunctionInterface< Impl >::operator*=().
◆ order()
|
inlineconstexpr |
obtain an upper bound on the polynomial order of the underlying space.
References Dune::Fem::DiscreteFunctionDefault< Impl >::space().
◆ print()
|
inline |
print all DoFs to a stream (for debugging purposes)
- Parameters
-
[in] out stream to print to
◆ read()
|
inline |
read the discrete function from a stream
- Parameters
-
[in] in stream to read the discrete function from
- Note
- This call will automatically enable dof compression for this discrete function.
References DUNE_MODULE_VERSION_ID, DUNE_THROW, and DUNE_VERSION_ID.
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::restore().
◆ removeSubData()
|
protectedvirtual |
Reimplemented from Dune::Fem::PersistentObject.
References Dune::Fem::Capabilities::isPersistentIndexSet< IndexSet >::map().
◆ restore()
|
inlineprotectedvirtual |
Implements Dune::Fem::PersistentObject.
References Dune::Fem::DiscreteFunctionDefault< Impl >::read().
◆ scalarProductDofs()
|
inline |
Scalar product between the DoFs of two discrete functions.
- Note
- This is a parallel scalar product, so do not sum over all processes after calling scalarProductDofs!
- It is assumed that the discrete function has been communicated (i.e., every local DoF hat the value of the corresponding global DoF).
- Parameters
-
[in] other discrete function to evaluate the scalar product with
- Returns
- the scalar product of the DoF-vectors
References Dune::Fem::ParallelScalarProduct< DiscreteFunction >::scalarProductDofs().
◆ setLocalDofs()
|
inline |
set local Dofs to dof vector associated with the entity
- Parameters
-
[in] entity Entity to focus view of discrete function [in] localDofs the local dofs vector to be set
References Dune::Fem::DiscreteFunctionDefault< Impl >::space().
Referenced by Dune::Fem::LocalDataXtractor< DiscreteFunctionType, ContainsCheck >::xtractData().
◆ size()
|
inline |
Return the number of blocks in the block vector.
- Returns
- Number of block in the block vector
References Dune::Fem::DiscreteFunctionInterface< Impl >::blockSize.
◆ space()
|
inline |
obtain a reference to the corresponding DiscreteFunctionSpace
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::addLocalDofs(), Dune::Fem::DiscreteFunctionDefault< Impl >::addScaledLocalDofs(), Dune::Fem::DiscreteFunctionDefault< Impl >::communicate(), Dune::Fem::DiscreteFunctionDefault< Impl >::continuous(), Dune::Fem::DiscreteFunctionDefault< Impl >::getLocalDofReferences(), Dune::Fem::DiscreteFunctionDefault< Impl >::getLocalDofs(), Dune::Fem::DiscreteFunctionDefault< Impl >::gridPart(), Dune::Fem::DiscreteFunctionDefault< Impl >::order(), and Dune::Fem::DiscreteFunctionDefault< Impl >::setLocalDofs().
◆ write()
|
inline |
write the discrete function into a stream
- Parameters
-
[in] out stream to write the discrete function to
References DUNE_MODULE_VERSION_ID.
Referenced by Dune::Fem::DiscreteFunctionDefault< Impl >::backup().
Friends And Related Function Documentation
◆ operator<<()
|
related |
write a discrete function into an STL stream
- Parameters
-
[in] out STL stream to write to [in] df discrete function to write
- Returns
- the STL stream (for concatenation)
References Dune::Fem::DiscreteFunctionInterface< Impl >::print().
The documentation for this class was generated from the following files:
- dune/fem/function/common/discretefunction.hh
- dune/fem/function/common/discretefunction_inline.hh