MFEM
v4.6.0
Finite element discretization library
|
#include <admfem.hpp>
Public Types | |
typedef codi::RealForwardGen< double > | ADFType |
typedef TAutoDiffVector< ADFType > | ADFVector |
typedef TAutoDiffDenseMatrix< ADFType > | ADFDenseMatrix |
typedef codi::RealForwardGen< ADFType > | ADSType |
typedef TAutoDiffVector< ADSType > | ADSVector |
typedef TAutoDiffDenseMatrix< ADSType > | ADSDenseMatrix |
typedef codi::RealForwardGen< double > | ADFType |
typedef TAutoDiffVector< ADFType > | ADFVector |
typedef TAutoDiffDenseMatrix< ADFType > | ADFDenseMatrix |
typedef codi::RealReverseGen< ADFType > | ADSType |
typedef TAutoDiffVector< ADSType > | ADSVector |
typedef TAutoDiffDenseMatrix< ADSType > | ADSDenseMatrix |
Public Member Functions | |
double | Eval (const mfem::Vector &vparam, mfem::Vector &uu) |
void | VectorFunc (const mfem::Vector &vparam, mfem::Vector &uu, mfem::Vector &rr) |
Provides the same functionality as Grad. More... | |
void | Grad (const mfem::Vector &vparam, mfem::Vector &uu, mfem::Vector &rr) |
void | Jacobian (mfem::Vector &vparam, mfem::Vector &uu, mfem::DenseMatrix &jac) |
Provides same functionality as Hessian. More... | |
void | Hessian (mfem::Vector &vparam, mfem::Vector &uu, mfem::DenseMatrix &jac) |
double | Eval (const Vector &vparam, Vector &uu) |
void | VectorFunc (const Vector &vparam, Vector &uu, Vector &rr) |
Provides the same functionality as Grad. More... | |
void | Grad (const Vector &vparam, Vector &uu, Vector &rr) |
void | Jacobian (mfem::Vector &vparam, mfem::Vector &uu, mfem::DenseMatrix &jac) |
Provides same functionality as Hessian. More... | |
void | Hessian (mfem::Vector &vparam, mfem::Vector &uu, mfem::DenseMatrix &jac) |
The class provides an evaluation of the first derivatives and the Hessian of a templated scalar function provided as a functor TFunctor. Both the first and the second derivatives are evaluated with the help of automatic differentiation (AD). The template parameters specify the size of the input vector (state_size) and the size of the parameters supplied to the function. The TFunctor functor is a template class with parameters [Float data type], [Vector type for the additional parameters], [Vector type for the state vector and the return residual]. The integer template parameters are the same ones passed to QFunctionAutoDiff.
The class provides an evaluation of the first derivatives and the Hessian of a templated scalar function provided as a functor TFunctor. Both the first and the second derivatives are evaluated with the help of automatic differentiation (AD). The template parameters specify the size of the input vector (state_size) and the size of the parameters supplied to the function. The TFunctor functor is a template class with parameters [Float data type], [Vector type for the additional parameters], [Vector type for the state vector and the return residual]. The integer template parameters are the same ones passed to QFunctionAutoDiff. The class duplicates Grad and Hessian, i.e., VectorFunc calls Grad, and Jacobian calls Hessian. The main reason is to provide the same interface as the QVectorFuncAutoDiff class used to differentiate vector functions. Such compatibility allows users to start implementation of their problem based only on some energy or a weak form. The gradients, computed with Grad/VectorFunc, of the function will contribute to the FE residual. Computed with Hessian/Jacobian, the Hessian will contribute to the tangent matrix in Newton's iterations. Once the implementation is complete and tested, the users can start improving the performance by replacing Grad/VectorFunc with a hand-coded version. The gradient is a vector function and can be differentiated with the functionality implemented in QVectorFuncAutoDiff. Thus, the user can directly employ AD for computing the contributions to the global tangent matrix. The main code will not require changes as the names Grad/VectorFunc and Hessian/Jacobian are mirrored.
Definition at line 242 of file admfem.hpp.
typedef TAutoDiffDenseMatrix<ADFType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADFDenseMatrix |
Definition at line 325 of file admfem.hpp.
typedef TAutoDiffDenseMatrix<ADFType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADFDenseMatrix |
Definition at line 334 of file admfem.hpp.
typedef codi::RealForwardGen<double> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADFType |
Definition at line 323 of file admfem.hpp.
typedef codi::RealForwardGen<double> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADFType |
Definition at line 332 of file admfem.hpp.
typedef TAutoDiffVector<ADFType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADFVector |
Definition at line 324 of file admfem.hpp.
typedef TAutoDiffVector<ADFType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADFVector |
Definition at line 333 of file admfem.hpp.
typedef TAutoDiffDenseMatrix<ADSType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADSDenseMatrix |
Definition at line 329 of file admfem.hpp.
typedef TAutoDiffDenseMatrix<ADSType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADSDenseMatrix |
Definition at line 338 of file admfem.hpp.
typedef codi::RealForwardGen<ADFType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADSType |
Definition at line 327 of file admfem.hpp.
typedef codi::RealReverseGen<ADFType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADSType |
Definition at line 336 of file admfem.hpp.
typedef TAutoDiffVector<ADSType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADSVector |
Definition at line 328 of file admfem.hpp.
typedef TAutoDiffVector<ADSType> mfem::QFunctionAutoDiff< TFunctor, state_size, param_size >::ADSVector |
Definition at line 337 of file admfem.hpp.
|
inline |
Evaluates a function for arguments vparam and uu. The evaluation is based on the operator() in the user provided functor TFunctor.
Definition at line 248 of file admfem.hpp.
|
inline |
Evaluates a function for arguments vparam and uu. The evaluation is based on the operator() in the user provided functor TFunctor.
Definition at line 635 of file admfem.hpp.
|
inline |
Returns the first derivative of TFunctor(...) with respect to the active arguments proved in vector uu. The length of rr is the same as for uu.
Definition at line 261 of file admfem.hpp.
|
inline |
Returns the first derivative of TFunctor(...) with respect to the active arguments proved in vector uu. The length of rr is the same as for uu.
Definition at line 648 of file admfem.hpp.
|
inline |
Returns the Hessian of TFunctor(...) in the dense matrix jac. The dimensions of jac are state_size x state_size, where state_size is the length of vector uu.
Definition at line 345 of file admfem.hpp.
|
inline |
Returns the Hessian of TFunctor(...) in the dense matrix jac. The dimensions of jac are state_size x state_size, where state_size is the length of vector uu.
Definition at line 672 of file admfem.hpp.
|
inline |
Provides same functionality as Hessian.
Definition at line 316 of file admfem.hpp.
|
inline |
Provides same functionality as Hessian.
Definition at line 664 of file admfem.hpp.
|
inline |
Provides the same functionality as Grad.
Definition at line 254 of file admfem.hpp.
|
inline |
Provides the same functionality as Grad.
Definition at line 641 of file admfem.hpp.