Serac  0.1
Serac is an implicit thermal strucural mechanics simulation code.
Public Member Functions | List of all members
serac::mfem_ext::StdFunctionOperator Class Reference

StdFunctionOperator is a class wrapping mfem::Operator so that the user can use std::function to define the implementations of mfem::Operator::Mult and mfem::Operator::GetGradient. More...

#include <stdfunction_operator.hpp>

Collaboration diagram for serac::mfem_ext::StdFunctionOperator:
Collaboration graph
[legend]

Public Member Functions

 StdFunctionOperator (int n)
 Default constructor for creating a square uninitialized StdFunctionOperator. More...
 
 StdFunctionOperator (int h, int w)
 Default constructor for creating a rectangular uninitialized StdFunctionOperator. More...
 
 StdFunctionOperator (int n, std::function< void(const mfem::Vector &, mfem::Vector &)> function)
 Constructor for a square StdFunctionOperator that only defines mfem::Operator::Mult. More...
 
 StdFunctionOperator (int h, int w, std::function< void(const mfem::Vector &, mfem::Vector &)> function)
 Constructor for a rectangular StdFunctionOperator that only defines mfem::Operator::Mult. More...
 
 StdFunctionOperator (int n, std::function< void(const mfem::Vector &, mfem::Vector &)> function, std::function< mfem::Operator &(const mfem::Vector &)> jacobian)
 Constructor for a square StdFunctionOperator that defines mfem::Operator::Mult and mfem::Operator::GetGradient. More...
 
 StdFunctionOperator (int h, int w, std::function< void(const mfem::Vector &, mfem::Vector &)> function, std::function< mfem::Operator &(const mfem::Vector &)> jacobian)
 Constructor for a rectangular StdFunctionOperator that defines mfem::Operator::Mult and mfem::Operator::GetGradient. More...
 
void Mult (const mfem::Vector &k, mfem::Vector &y) const
 The underlying mult (e.g. residual evaluation) method. More...
 
mfem::Operator & GetGradient (const mfem::Vector &k) const
 The underlying GetGradient (e.g. residual jacobian evaluation) method. More...
 

Detailed Description

StdFunctionOperator is a class wrapping mfem::Operator so that the user can use std::function to define the implementations of mfem::Operator::Mult and mfem::Operator::GetGradient.

The main benefit of this approach is that lambda capture lists allow for a flexible inline representation of the overloaded functions, without having to manually define a separate functor class.

Definition at line 31 of file stdfunction_operator.hpp.

Constructor & Destructor Documentation

◆ StdFunctionOperator() [1/6]

serac::mfem_ext::StdFunctionOperator::StdFunctionOperator ( int  n)
inline

Default constructor for creating a square uninitialized StdFunctionOperator.

Parameters
[in]nThe size of the square operator

Definition at line 38 of file stdfunction_operator.hpp.

◆ StdFunctionOperator() [2/6]

serac::mfem_ext::StdFunctionOperator::StdFunctionOperator ( int  h,
int  w 
)
inline

Default constructor for creating a rectangular uninitialized StdFunctionOperator.

Parameters
[in]hThe height of the operator
[in]wThe width of the operator

Definition at line 46 of file stdfunction_operator.hpp.

◆ StdFunctionOperator() [3/6]

serac::mfem_ext::StdFunctionOperator::StdFunctionOperator ( int  n,
std::function< void(const mfem::Vector &, mfem::Vector &)>  function 
)
inline

Constructor for a square StdFunctionOperator that only defines mfem::Operator::Mult.

Parameters
[in]nThe size fo the operator
[in]functionThe function that defines the mult (typically residual evaluation) method

Definition at line 54 of file stdfunction_operator.hpp.

◆ StdFunctionOperator() [4/6]

serac::mfem_ext::StdFunctionOperator::StdFunctionOperator ( int  h,
int  w,
std::function< void(const mfem::Vector &, mfem::Vector &)>  function 
)
inline

Constructor for a rectangular StdFunctionOperator that only defines mfem::Operator::Mult.

Parameters
[in]hThe height of the operator
[in]wThe width of the operator
[in]functionThe function that defines the mult (typically residual evaluation) method

Definition at line 66 of file stdfunction_operator.hpp.

◆ StdFunctionOperator() [5/6]

serac::mfem_ext::StdFunctionOperator::StdFunctionOperator ( int  n,
std::function< void(const mfem::Vector &, mfem::Vector &)>  function,
std::function< mfem::Operator &(const mfem::Vector &)>  jacobian 
)
inline

Constructor for a square StdFunctionOperator that defines mfem::Operator::Mult and mfem::Operator::GetGradient.

Parameters
[in]nThe size of the operator
[in]functionThe function that defines the mult (typically residual evaluation) method
[in]jacobianThe function that defines the GetGradient (typically residual jacobian evaluation) method

Definition at line 79 of file stdfunction_operator.hpp.

◆ StdFunctionOperator() [6/6]

serac::mfem_ext::StdFunctionOperator::StdFunctionOperator ( int  h,
int  w,
std::function< void(const mfem::Vector &, mfem::Vector &)>  function,
std::function< mfem::Operator &(const mfem::Vector &)>  jacobian 
)
inline

Constructor for a rectangular StdFunctionOperator that defines mfem::Operator::Mult and mfem::Operator::GetGradient.

Parameters
[in]hThe height of the operator
[in]wThe width of the operator
[in]functionThe function that defines the mult (typically residual evaluation) method
[in]jacobianThe function that defines the GetGradient (typically residual jacobian evaluation) method

Definition at line 94 of file stdfunction_operator.hpp.

Member Function Documentation

◆ GetGradient()

mfem::Operator& serac::mfem_ext::StdFunctionOperator::GetGradient ( const mfem::Vector &  k) const
inline

The underlying GetGradient (e.g. residual jacobian evaluation) method.

Parameters
[in]kThe current state input vector
Returns
A non-owning reference to the gradient operator

Definition at line 114 of file stdfunction_operator.hpp.

◆ Mult()

void serac::mfem_ext::StdFunctionOperator::Mult ( const mfem::Vector &  k,
mfem::Vector &  y 
) const
inline

The underlying mult (e.g. residual evaluation) method.

Parameters
[in]kstate input vector
[out]youtput residual vector

Definition at line 106 of file stdfunction_operator.hpp.


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