25 template <
typename _Type>
30 p_EQUATION(ptr_to_equation),
31 p_LEFT_RESIDUAL(ptr_to_left_residual),
32 p_RIGHT_RESIDUAL(ptr_to_right_residual),
34 unsigned n(nodes.
size());
35 unsigned order(p_EQUATION -> get_order());
44 template <
typename _Type>
52 template <
typename _Type>
57 template <
typename _Type>
65 assemble_dense_problem();
67 p_SYSTEM -> eigensolve();
71 template <
typename _Type>
75 p_A_DENSE -> assign(0.0);
76 p_B_DENSE -> assign(0.0);
78 unsigned order(p_EQUATION -> get_order());
85 std::size_t num_of_nodes(NODES.size());
90 p_LEFT_RESIDUAL -> update(temp_dummy);
92 for(
unsigned i = 0; i < p_LEFT_RESIDUAL -> get_order(); ++i) {
94 for(
unsigned var = 0; var < order; ++var) {
95 (*p_A_DENSE)(row, var) = p_LEFT_RESIDUAL -> jacobian()(i, var);
96 (*p_B_DENSE)(row, var) = 0.0;
102 for(std::size_t node = 0; node <= num_of_nodes - 2; ++node) {
103 const std::size_t lnode = node;
104 const std::size_t rnode = node + 1;
106 double h = NODES[ rnode ] - NODES[ lnode ];
108 const double invh(1. /
h);
110 double x_midpt = 0.5 * (NODES[ lnode ] + NODES[ rnode ]);
111 p_EQUATION -> coord(0) = x_midpt;
113 p_EQUATION -> update(temp_dummy);
115 for(
unsigned var = 0; var < order; ++var) {
116 std::size_t placement_row(row + var);
118 (*p_A_DENSE)(placement_row, order * rnode + var) = invh;
119 (*p_A_DENSE)(placement_row, order * lnode + var) = -invh;
121 for(
unsigned i = 0; i < order; ++i) {
122 (*p_A_DENSE)(placement_row, order * lnode + i) -= 0.5 * p_EQUATION -> jacobian()(var, i);
123 (*p_A_DENSE)(placement_row, order * rnode + i) -= 0.5 * p_EQUATION -> jacobian()(var, i);
126 for(
unsigned i = 0; i < order; ++i) {
127 (*p_B_DENSE)(placement_row, order * lnode + i) -= 0.5 * p_EQUATION -> matrix1()(var, i);
128 (*p_B_DENSE)(placement_row, order * rnode + i) -= 0.5 * p_EQUATION -> matrix1()(var, i);
136 p_RIGHT_RESIDUAL -> update(temp_dummy);
138 for(
unsigned i = 0; i < p_RIGHT_RESIDUAL -> get_order(); ++i) {
140 for(
unsigned var = 0; var < order; ++var) {
141 (*p_A_DENSE)(row, order * (num_of_nodes - 1) + var) = p_RIGHT_RESIDUAL -> jacobian()(i, var);
142 (*p_B_DENSE)(row, order * (num_of_nodes - 1) + var) = 0.0;
147 if(row != num_of_nodes * order) {
148 std::string problem(
"\n The ODE_BVP has an incorrect number of boundary conditions. \n");
149 throw ExceptionRuntime(problem);
156 template class ODE_EVP<double>
158 template class ODE_EVP<std::complex<double> >
Specification of the dense linear eigensystem class.
A templated class for equations that can be inherited from to allow instantiation of ODE/PDE objects ...
A templated class for equations that can be inherited from to allow instantiation of PDE_double_IBVP ...
The collection of CppNoddy exceptions.
A specification of a class for an -order ODE LINEAR EVP defined by.
A spec for a collection of utility functions.
A linear Nth-order generalised eigensystem class.
A matrix class that constructs a DENSE matrix as a row major std::vector of DenseVectors.
An DenseVector class – a dense vector object.
std::size_t size() const
A pass-thru definition to get the size of the vector.
An equation object base class used in the PDE_double_IBVP class.
A linear Nth-order generalised eigensystem base class.
A templated object for real/complex vector system of first-order ordinary differential equations.
LinearEigenSystem_base * p_eigensystem()
Allow access to the underlying dense linear eigensystem through a pointer to the private member data.
ODE_EVP(Equation_2matrix< _Type > *equation_ptr, const DenseVector< double > &nodes, Residual< _Type > *ptr_to_left_residual, Residual< _Type > *ptr_to_right_residual)
The class is defined by a vector function for the system.
void eigensolve()
Formulate and solve the global eigenvalue problem for a linear system.
A base class to be inherited by objects that define residuals.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...