CppNoddy  0.92
All Classes Namespaces Files Functions Variables Typedefs Enumerator Friends Macros Modules Pages
Public Member Functions | Protected Attributes | List of all members
CppNoddy::Residual_with_coords< _Type, _Xtype > Class Template Reference

A base class to be inherited by objects that define residuals. More...

#include <Residual_with_coords.h>

Inheritance diagram for CppNoddy::Residual_with_coords< _Type, _Xtype >:
CppNoddy::Residual< _Type > CppNoddy::Equation< double > CppNoddy::Equation< D_complex > CppNoddy::Equation_1matrix< _Type, double > CppNoddy::Equation_1matrix< double > CppNoddy::Equation_1matrix< double, double > CppNoddy::Equation_1matrix< D_complex > CppNoddy::Equation_1matrix< D_complex, double > CppNoddy::Equation_1matrix< std::complex< double > > CppNoddy::Equation_1matrix< std::complex< double >, _Type > CppNoddy::Equation< _Type, _Xtype > CppNoddy::Equation_1matrix< _Type, _Xtype >

Public Member Functions

 Residual_with_coords (const unsigned &order, const unsigned &ncoords)
 Constructor for a 'square' residual object that is, N residuals for N unknowns. More...
 
 Residual_with_coords (const unsigned &order, const unsigned &nvars, const unsigned &ncoords)
 Constructor for a 'non-square' residual object that is, there are less residual constraints than unknowns. More...
 
virtual ~Residual_with_coords ()
 An empty destructor. More...
 
_Xtype & coord (const unsigned &i)
 General handle access to the coordinates. More...
 
const _Xtype & coord (const unsigned &i) const
 General handle access to the coordinates. More...
 
- Public Member Functions inherited from CppNoddy::Residual< _Type >
 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 Attributes

std::vector< _Xtype > coords
 The coordinates stored for this residual. More...
 
- Protected Attributes inherited from CppNoddy::Residual< _Type >
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...
 

Additional Inherited Members

- Protected Member Functions inherited from CppNoddy::Residual< _Type >
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...
 

Detailed Description

template<typename _Type, typename _Xtype = double>
class CppNoddy::Residual_with_coords< _Type, _Xtype >

A base class to be inherited by objects that define residuals.

Definition at line 19 of file Residual_with_coords.h.

Constructor & Destructor Documentation

◆ Residual_with_coords() [1/2]

template<typename _Type , typename _Xtype >
CppNoddy::Residual_with_coords< _Type, _Xtype >::Residual_with_coords ( const unsigned &  order,
const unsigned &  ncoords 
)

Constructor for a 'square' residual object that is, N residuals for N unknowns.

Parameters
orderThe order of the residual vector
ncoordsThe number of coordinates to store

Definition at line 13 of file Residual_with_coords.cpp.

13 : Residual<_Type>(order) {
14 coords = std::vector<_Xtype>(ncoords, 0.0);
15 }
std::vector< _Xtype > coords
The coordinates stored for this residual.

References CppNoddy::Residual_with_coords< _Type, _Xtype >::coords.

◆ Residual_with_coords() [2/2]

template<typename _Type , typename _Xtype >
CppNoddy::Residual_with_coords< _Type, _Xtype >::Residual_with_coords ( const unsigned &  order,
const unsigned &  nvars,
const unsigned &  ncoords 
)

Constructor for a 'non-square' residual object that is, there are less residual constraints than unknowns.

Parameters
orderThe number of residuals
nvarsThe number of unknowns/variables
ncoordsThe number of coordinates to store

Definition at line 18 of file Residual_with_coords.cpp.

18 : Residual<_Type>(order, nvars) {
19 coords = std::vector<_Xtype>(ncoords, 0.0);
20 }

References CppNoddy::Residual_with_coords< _Type, _Xtype >::coords.

◆ ~Residual_with_coords()

template<typename _Type , typename _Xtype >
CppNoddy::Residual_with_coords< _Type, _Xtype >::~Residual_with_coords
virtual

An empty destructor.

Definition at line 23 of file Residual_with_coords.cpp.

23 {
24 }

Member Function Documentation

◆ coord() [1/2]

template<typename _Type , typename _Xtype >
_Xtype & CppNoddy::Residual_with_coords< _Type, _Xtype >::coord ( const unsigned &  i)
inline

General handle access to the coordinates.

Returns
A handle to the i-th coordinate

Definition at line 54 of file Residual_with_coords.h.

54 {
55#ifdef PARANOID
56 /// \todo check range on coord
57#endif
58 return coords[ i ];
59 }

Referenced by main(), CppNoddy::Example::OS_evp_equation::residual_fn(), CppNoddy::Example::OS_bvp_equation::residual_fn(), CppNoddy::Example::diffusion_double::residual_fn(), CppNoddy::Example::nonlinear::residual_fn(), CppNoddy::Example::Diffusion_equations::residual_fn(), and CppNoddy::Example::Nlin_adv_equation::residual_fn().

◆ coord() [2/2]

template<typename _Type , typename _Xtype >
const _Xtype & CppNoddy::Residual_with_coords< _Type, _Xtype >::coord ( const unsigned &  i) const
inline

General handle access to the coordinates.

Returns
A handle to the i-th coordinate

Definition at line 62 of file Residual_with_coords.h.

62 {
63#ifdef PARANOID
64#endif
65 return coords[ i ];
66 }

Member Data Documentation

◆ coords

template<typename _Type , typename _Xtype = double>
std::vector<_Xtype> CppNoddy::Residual_with_coords< _Type, _Xtype >::coords
protected

The coordinates stored for this residual.

Definition at line 48 of file Residual_with_coords.h.

Referenced by CppNoddy::Residual_with_coords< _Type, _Xtype >::Residual_with_coords().


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

© 2012

R.E. Hewitt