CppNoddy  0.92
Loading...
Searching...
No Matches
Equation_3matrix.h
Go to the documentation of this file.
1/// \file Equation_3matrix.h
2/// A templated class for equations that can be inherited from
3/// to allow instantiation of PDE_double_IBVP objects (amongst others).
4
5#ifndef EQUATION_3MATRIX_H
6#define EQUATION_3MATRIX_H
7
8#include <Equation_2matrix.h>
9
10namespace CppNoddy {
11
12 /// An equation object base class used in the PDE_double_IBVP class.
13 /// An equation object is essentially a ('square') residual object (although
14 /// it doesn't currently inherit) with some independent variable
15 /// data members and access methods. By 'square' we mean that it defines
16 /// N residuals and N state variables. In this case the equation also defines
17 /// 2 matrices (amongst other data). This inherits from the Equation_1matrix
18 /// and adds the functionality for the additional matrix.
19
20 template < typename _Type, typename _Xtype = double >
21 class Equation_3matrix : public Equation_2matrix<_Type, _Xtype> {
22 public:
23
24 /// Constructor for equation class.
25 /// \param order The order of the system
26 explicit Equation_3matrix(const unsigned &order);
27
28 /// An empty destructor, virtual since we have virtual methods.
29 virtual ~Equation_3matrix();
30
31 /// Update the Equation object for the current set of state variables
32 /// \param state The state vector at which to set the equation object
33 void update(const DenseVector<_Type> &state);
34
35 /// Return a handle to the matrix member data
37
38 /// Return the product of the Jacobian-of-the-matrix and a vector 'vec'
39 /// when the equation has a given 'state'. The user should overload this
40 /// if concerned about performance of the solver. If not overloaded, the
41 /// default is to finite difference the Jacobian-of-the-matrix.
42 /// \param state The current state variables -- used for clarity when
43 /// overloaded by the user instead of expecting the user to access the member data.
44 /// \param vec The vector that will be multiplied by the Jacobian-of-the-matrix
45 /// \param h The resulting 2D matrix
47
48 protected:
49
50 /// Define the matrix for the current state vector.
51 /// \param state The current state vector.
52 /// \param m The matrix.
53 virtual void matrix2(const DenseVector<_Type> &state, DenseMatrix<_Type> &m) const {
54 std::string problem;
55 problem = "The equation::matrix1 method has not been implemented.\n";
56 problem += "You have to implement this method to define the equation.\n";
57 throw ExceptionRuntime(problem);
58 }
59
60 private:
61
62 /// Matrix for the last state vector
63 DenseMatrix<_Type> MATRIX2_AT_LAST_STATE;
64
65 }
66 ; // end class
67
68 template <typename _Type, typename _Xtype>
70 return MATRIX2_AT_LAST_STATE;
71 }
72
73} // end namespace
74
75#endif
A templated class for equations that can be inherited from to allow instantiation of PDE_double_IBVP ...
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
Definition: DenseMatrix.h:25
An DenseVector class – a dense vector object.
Definition: DenseVector.h:34
An equation object base class used in the PDE_double_IBVP class.
An equation object base class used in the PDE_double_IBVP class.
const DenseMatrix< _Type > & matrix2() const
Return a handle to the matrix member data.
virtual ~Equation_3matrix()
An empty destructor, virtual since we have virtual methods.
virtual void matrix2(const DenseVector< _Type > &state, DenseMatrix< _Type > &m) const
Define the matrix for the current state vector.
void update(const DenseVector< _Type > &state)
Update the Equation object for the current set of state variables.
virtual void get_jacobian_of_matrix2_mult_vector(const DenseVector< _Type > &state, const DenseVector< _Type > &vec, DenseMatrix< _Type > &h) const
Return the product of the Jacobian-of-the-matrix and a vector 'vec' when the equation has a given 'st...
A generic runtime exception.
Definition: Exceptions.h:158
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...

© 2012

R.E. Hewitt