CppNoddy
0.92
|
A base class to be inherited by objects that define residuals. More...
#include <Residual.h>
Public Member Functions | |
Residual (const unsigned &order) | |
Constructor for a 'square' residual object that is, N residuals for N unknowns. More... | |
Residual (const unsigned &order, const unsigned &nvars) | |
Constructor for a 'non-square' residual object that is, there are less residual constraints than unknowns. More... | |
virtual | ~Residual () |
An empty destructor, virtual since we have virtual methods. More... | |
void | update (const DenseVector< _Type > &state) |
Update the Residual object for the current set of state variables. More... | |
const DenseVector< _Type > & | residual () const |
Return a handle to the residuals corresponding to the last update state. More... | |
const DenseMatrix< _Type > & | jacobian () const |
Retrun a handle to the Jacobian of the residual corresponding to the last update state. More... | |
_Type & | delta () |
const _Type & | delta () const |
unsigned | get_order () const |
Get the order of the residual vector. More... | |
unsigned | get_number_of_vars () const |
Get the number of variables that this residual condition is defined for. More... | |
virtual void | residual_fn (const DenseVector< _Type > &state, DenseVector< _Type > &f) const |
A blank virtual residual function method. More... | |
Protected Member Functions | |
virtual void | jacobian (const DenseVector< _Type > &state, DenseMatrix< _Type > &jac) const |
Because the residual evaluation at the current state is assumed to have already been done by the 'update' method, this routine is protected. More... | |
Protected Attributes | |
DenseMatrix< _Type > | JAC_AT_LAST_STATE |
Jacobian for the last state vector. More... | |
DenseVector< _Type > | FN_AT_LAST_STATE |
Residual for the last state vector. More... | |
DenseVector< _Type > | LAST_STATE |
The last state vector. More... | |
_Type | DELTA |
A default step for FD computation of the Jacobian. More... | |
unsigned | ORDER_OF_SYSTEM |
The order of the system of equations. More... | |
unsigned | NUMBER_OF_VARS |
The number of elements in the state vector. More... | |
A base class to be inherited by objects that define residuals.
Definition at line 15 of file Residual.h.
CppNoddy::Residual< _Type >::Residual | ( | const unsigned & | order | ) |
Constructor for a 'square' residual object that is, N residuals for N unknowns.
order | The order of the residual vector |
Definition at line 9 of file Residual.cpp.
References CppNoddy::Residual< _Type >::FN_AT_LAST_STATE, CppNoddy::Residual< _Type >::JAC_AT_LAST_STATE, CppNoddy::Residual< _Type >::LAST_STATE, CppNoddy::Residual< _Type >::NUMBER_OF_VARS, and CppNoddy::Residual< _Type >::ORDER_OF_SYSTEM.
CppNoddy::Residual< _Type >::Residual | ( | const unsigned & | order, |
const unsigned & | nvars | ||
) |
Constructor for a 'non-square' residual object that is, there are less residual constraints than unknowns.
order | The number of residuals |
nvars | The number of unknowns/variables |
Definition at line 23 of file Residual.cpp.
References CppNoddy::Residual< _Type >::ORDER_OF_SYSTEM.
|
virtual |
An empty destructor, virtual since we have virtual methods.
Definition at line 37 of file Residual.cpp.
|
inline |
Definition at line 133 of file Residual.h.
|
inline |
Definition at line 138 of file Residual.h.
|
inline |
Get the number of variables that this residual condition is defined for.
Definition at line 128 of file Residual.h.
|
inline |
Get the order of the residual vector.
Definition at line 123 of file Residual.h.
|
inline |
Retrun a handle to the Jacobian of the residual corresponding to the last update state.
Definition at line 118 of file Residual.h.
|
protectedvirtual |
Because the residual evaluation at the current state is assumed to have already been done by the 'update' method, this routine is protected.
This default uses a finite-differenced Jacobian. You can overload this to provide an analytic Jacobian if you wish
state | Dummy state vector ... this is only here to make overloading easier, the 'last_x' member data is assumed in the default FD method. |
jac | The NxN matrix Jacobian where the equation_fn is a vector function of length N. |
Definition at line 46 of file Residual.cpp.
References CppNoddy::DenseMatrix< _Type >::set_col().
|
inline |
Return a handle to the residuals corresponding to the last update state.
Definition at line 113 of file Residual.h.
|
inlinevirtual |
A blank virtual residual function method.
state | The unknown variable. |
f | The residual function f(x). |
Reimplemented in CppNoddy::Example::Harmonic_left_BC< _Type >, CppNoddy::Example::Harmonic_right_BC< _Type >, CppNoddy::Example::Nonidentity_left_BC< _Type >, CppNoddy::Example::Nonidentity_right_BC< _Type >, CppNoddy::Example::Troesch_left_BC< _Type >, CppNoddy::Example::Troesch_right_BC< _Type >, CppNoddy::Example::Harmonic_equation< _Type, _Xtype >, CppNoddy::Example::Nonidentity_equation< _Type, _Xtype >, CppNoddy::Example::Troesch_equation< _Type, _Xtype >, CppNoddy::Example::Biharmonic_residual, CppNoddy::Example::Harmonic_left_BC< _Type >, CppNoddy::Example::Harmonic_right_BC< _Type >, CppNoddy::Example::OS_evp_both_BC, CppNoddy::Example::OS_bvp_left_BC, CppNoddy::Example::OS_bvp_right_BC, CppNoddy::Example::OS_evp_both_BC, CppNoddy::Example::OS_bvp_left_BC, CppNoddy::Example::OS_bvp_right_BC, CppNoddy::Example::Cube_root_problem, CppNoddy::Example::Berman_residual, CppNoddy::Example::Blasius_residual, CppNoddy::Example::Berman_left_BC, CppNoddy::Example::Berman_right_BC, CppNoddy::Example::Blasius_left_BC, CppNoddy::Example::Blasius_right_BC, CppNoddy::Example::Karman_left_BC, CppNoddy::Example::Karman_right_BC, CppNoddy::Example::Karman_left_BC, CppNoddy::Example::Karman_right_BC, CppNoddy::Example::Karman_left_BC, CppNoddy::Example::Karman_right_BC, CppNoddy::Example::Karman_left_BC, CppNoddy::Example::Karman_right_BC, CppNoddy::Example::harmonic_both_BC, CppNoddy::Example::Karman_left_BC, CppNoddy::Example::Karman_right_BC, CppNoddy::Example::Arc_problem, CppNoddy::Example::Arc_problem, CppNoddy::Example::FS_residual, CppNoddy::Example::Arc_problem, CppNoddy::Example::Neutral_residual, and CppNoddy::Example::VCube_root_problem.
Definition at line 63 of file Residual.h.
|
inline |
Update the Residual object for the current set of state variables.
state | The state at which to set the residual object |
Definition at line 100 of file Residual.h.
Referenced by CppNoddy::Equation_1matrix< _Type, _Xtype >::update().
|
protected |
A default step for FD computation of the Jacobian.
Definition at line 88 of file Residual.h.
|
protected |
Residual for the last state vector.
Definition at line 84 of file Residual.h.
Referenced by CppNoddy::Residual< _Type >::Residual().
|
protected |
Jacobian for the last state vector.
Definition at line 82 of file Residual.h.
Referenced by CppNoddy::Residual< _Type >::Residual().
|
protected |
The last state vector.
Definition at line 86 of file Residual.h.
Referenced by CppNoddy::Residual< _Type >::Residual().
|
protected |
The number of elements in the state vector.
Definition at line 92 of file Residual.h.
Referenced by CppNoddy::Residual< _Type >::Residual().
|
protected |
The order of the system of equations.
Definition at line 90 of file Residual.h.
Referenced by CppNoddy::Equation_1matrix< _Type, _Xtype >::Equation_1matrix(), and CppNoddy::Residual< _Type >::Residual().
© 2012
R.E. Hewitt