Linear solver class that provides a wrapper to the frontal solver MA42 from the HSL library; see http://www.hsl.rl.ac.uk/. More...
#include <frontal_solver.h>
Public Member Functions | |
HSL_MA42 () | |
Constructor: By default suppress verbose output (stats), don't reorder elements and don't use direct access files. More... | |
~HSL_MA42 () | |
Destructor, clean up the allocated memory. More... | |
HSL_MA42 (const HSL_MA42 &)=delete | |
Broken copy constructor. More... | |
void | operator= (const HSL_MA42 &)=delete |
Broken assignment operator. More... | |
void | clean_up_memory () |
Clean up memory. More... | |
void | disable_resolve () |
Overload disable resolve so that it cleans up memory too. More... | |
void | solve (Problem *const &problem_pt, DoubleVector &result) |
Solver: Takes pointer to problem and returns the results Vector which contains the solution of the linear system defined by the problem's fully assembled Jacobian and residual Vector. More... | |
void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. Call the broken base-class version. If you want this, please implement it. More... | |
void | solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system Call the broken base-class version. If you want this, please implement it. More... | |
void | resolve (const DoubleVector &rhs, DoubleVector &result) |
Return the solution to the linear system Ax = result, where A is the most recently factorised jacobian matrix of the problem problem_pt. The solution is returned in the result vector. More... | |
void | reorder_elements (Problem *const &problem_pt) |
Function to reorder the elements based on Sloan's algorithm. More... | |
void | enable_doc_stats () |
Enable documentation of statistics. More... | |
void | disable_doc_stats () |
Disable documentation of statistics. More... | |
void | enable_reordering () |
Enable reordering using Sloan's algorithm. More... | |
void | disable_reordering () |
Disable reordering. More... | |
void | enable_direct_access_files () |
Enable use of direct access files. More... | |
void | disable_direct_access_files () |
Disable use of direct access files. More... | |
double & | lenbuf_factor0 () |
Factor to increase storage for lenbuf[0]; see MA42 documentation for details. More... | |
double & | lenbuf_factor1 () |
Factor to increase storage for lenbuf[1]; see MA42 documentation for details. More... | |
double & | lenbuf_factor2 () |
Factor to increase storage for lenbuf[2]; see MA42 documentation for details. More... | |
double & | front_factor () |
Factor to increase storage for front size; see MA42 documentation for details. More... | |
double & | lenfle_factor () |
Factor to increase the size of the direct access files; see MA42 documentation for details. More... | |
Public Member Functions inherited from oomph::LinearSolver | |
LinearSolver () | |
Empty constructor, initialise the member data. More... | |
LinearSolver (const LinearSolver &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const LinearSolver &)=delete |
Broken assignment operator. More... | |
virtual | ~LinearSolver () |
Empty virtual destructor. More... | |
void | enable_doc_time () |
Enable documentation of solve times. More... | |
void | disable_doc_time () |
Disable documentation of solve times. More... | |
bool | is_doc_time_enabled () const |
Is documentation of solve times enabled? More... | |
bool | is_resolve_enabled () const |
Boolean flag indicating if resolves are enabled. More... | |
virtual void | enable_resolve () |
Enable resolve (i.e. store matrix and/or LU decomposition, say) Virtual so it can be overloaded to perform additional tasks. More... | |
virtual void | solve_transpose (Problem *const &problem_pt, DoubleVector &result) |
Solver: Takes pointer to problem and returns the results vector which contains the solution of the linear system defined by the problem's fully assembled Jacobian and residual vector (broken virtual). More... | |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. More... | |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. More... | |
virtual void | resolve_transpose (const DoubleVector &rhs, DoubleVector &result) |
Solver: Resolve the system defined by the last assembled jacobian and the rhs vector. Solution is returned in the vector result. (broken virtual) More... | |
virtual double | jacobian_setup_time () const |
returns the time taken to assemble the Jacobian matrix and residual vector (needs to be overloaded for each solver) More... | |
virtual double | linear_solver_solution_time () const |
return the time taken to solve the linear system (needs to be overloaded for each linear solver) More... | |
virtual void | enable_computation_of_gradient () |
function to enable the computation of the gradient required for the globally convergent Newton method More... | |
void | disable_computation_of_gradient () |
function to disable the computation of the gradient required for the globally convergent Newton method More... | |
void | reset_gradient () |
function to reset the size of the gradient before each Newton solve More... | |
void | get_gradient (DoubleVector &gradient) |
function to access the gradient, provided it has been computed More... | |
Public Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
DistributableLinearAlgebraObject () | |
Default constructor - create a distribution. More... | |
DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
Broken copy constructor. More... | |
void | operator= (const DistributableLinearAlgebraObject &)=delete |
Broken assignment operator. More... | |
virtual | ~DistributableLinearAlgebraObject () |
Destructor. More... | |
LinearAlgebraDistribution * | distribution_pt () const |
access to the LinearAlgebraDistribution More... | |
unsigned | nrow () const |
access function to the number of global rows. More... | |
unsigned | nrow_local () const |
access function for the num of local rows on this processor. More... | |
unsigned | nrow_local (const unsigned &p) const |
access function for the num of local rows on this processor. More... | |
unsigned | first_row () const |
access function for the first row on this processor More... | |
unsigned | first_row (const unsigned &p) const |
access function for the first row on this processor More... | |
bool | distributed () const |
distribution is serial or distributed More... | |
bool | distribution_built () const |
if the communicator_pt is null then the distribution is not setup then false is returned, otherwise return true More... | |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
setup the distribution of this distributable linear algebra object More... | |
void | build_distribution (const LinearAlgebraDistribution &dist) |
setup the distribution of this distributable linear algebra object More... | |
Private Member Functions | |
void | solve_for_one_dof (Problem *const &problem_pt, DoubleVector &result) |
Special solver for problems with 1 dof (MA42 can't handle this case so solve() forwards the "solve" to this function. More... | |
Private Attributes | |
bool | Doc_stats |
Doc the solver stats or stay quiet? More... | |
bool | Reorder_flag |
Reorder elements with Sloan's algorithm? More... | |
bool | Use_direct_access_files |
Use direct access files? More... | |
double | Lenbuf_factor0 |
Factor to increase storage for lenbuf[0]; see MA42 documentation for details. More... | |
double | Lenbuf_factor1 |
Factor to increase storage for lenbuf[1]; see MA42 documentation for details. More... | |
double | Lenbuf_factor2 |
Factor to increase storage for lenbuf[2]; see MA42 documentation for details. More... | |
double | Front_factor |
Factor to increase storage for front size; see MA42 documentation for details. More... | |
double | Lenfle_factor |
Factor to increase size of direct access files; see MA42 documentation for details. More... | |
int | Icntl [8] |
Control flag for MA42; see MA42 documentation for details. More... | |
int | Isave [45] |
Control flag for MA42; see MA42 documentation for details. More... | |
int | Info [23] |
Control flag for MA42; see MA42 documentation for details. More... | |
double * | W |
Workspace storage for MA42. More... | |
int | Lw |
Size of the workspace array, W. More... | |
int * | IW |
Integer workspace storage for MA42. More... | |
int | Liw |
Size of the integer workspace array. More... | |
unsigned long | N_dof |
Size of the linear system. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
void | clear_distribution () |
clear the distribution of this distributable linear algebra object More... | |
Protected Attributes inherited from oomph::LinearSolver | |
bool | Enable_resolve |
Boolean that indicates whether the matrix (or its factors, in the case of direct solver) should be stored so that the resolve function can be used. More... | |
bool | Doc_time |
Boolean flag that indicates whether the time taken. More... | |
bool | Compute_gradient |
flag that indicates whether the gradient required for the globally convergent Newton method should be computed or not More... | |
bool | Gradient_has_been_computed |
flag that indicates whether the gradient was computed or not More... | |
DoubleVector | Gradient_for_glob_conv_newton_solve |
DoubleVector storing the gradient for the globally convergent Newton method. More... | |
Linear solver class that provides a wrapper to the frontal solver MA42 from the HSL library; see http://www.hsl.rl.ac.uk/.
Definition at line 55 of file frontal_solver.h.
|
inline |
Constructor: By default suppress verbose output (stats), don't reorder elements and don't use direct access files.
Definition at line 119 of file frontal_solver.h.
References Doc_stats, Front_factor, Lenbuf_factor0, Lenbuf_factor1, Lenbuf_factor2, Lenfle_factor, Reorder_flag, and Use_direct_access_files.
|
inline |
Destructor, clean up the allocated memory.
Definition at line 134 of file frontal_solver.h.
References clean_up_memory().
|
delete |
Broken copy constructor.
|
inlinevirtual |
Clean up memory.
Reimplemented from oomph::LinearSolver.
Definition at line 146 of file frontal_solver.h.
References IW, Liw, Lw, and W.
Referenced by disable_resolve(), and ~HSL_MA42().
|
inline |
Disable use of direct access files.
Definition at line 237 of file frontal_solver.h.
References Use_direct_access_files.
|
inline |
Disable documentation of statistics.
Definition at line 213 of file frontal_solver.h.
References Doc_stats.
|
inline |
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
Definition at line 163 of file frontal_solver.h.
References clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inline |
Enable use of direct access files.
Definition at line 231 of file frontal_solver.h.
References Use_direct_access_files.
|
inline |
Enable documentation of statistics.
Definition at line 207 of file frontal_solver.h.
References Doc_stats.
|
inline |
Enable reordering using Sloan's algorithm.
Definition at line 219 of file frontal_solver.h.
References Reorder_flag.
|
inline |
Factor to increase storage for front size; see MA42 documentation for details.
Definition at line 265 of file frontal_solver.h.
References Front_factor.
|
inline |
Factor to increase storage for lenbuf[0]; see MA42 documentation for details.
Definition at line 244 of file frontal_solver.h.
References Lenbuf_factor0.
|
inline |
Factor to increase storage for lenbuf[1]; see MA42 documentation for details.
Definition at line 251 of file frontal_solver.h.
References Lenbuf_factor1.
|
inline |
Factor to increase storage for lenbuf[2]; see MA42 documentation for details.
Definition at line 258 of file frontal_solver.h.
References Lenbuf_factor2.
|
inline |
Factor to increase the size of the direct access files; see MA42 documentation for details.
Definition at line 272 of file frontal_solver.h.
References Lenfle_factor.
|
delete |
Broken assignment operator.
void oomph::HSL_MA42::reorder_elements | ( | Problem *const & | problem_pt | ) |
Function to reorder the elements based on Sloan's algorithm.
Function to reorder the elements according to Sloan's algorithm.
Definition at line 969 of file frontal_solver.cc.
References oomph::Problem::assembly_handler_pt(), Doc_stats, e, oomph::Mesh::element_pt(), oomph::AssemblyHandler::eqn_number(), i, oomph::Problem::mesh_pt(), oomph::Problem::ndof(), oomph::AssemblyHandler::ndof(), oomph::Mesh::nelement(), and oomph::oomph_info.
Referenced by solve().
|
virtual |
Return the solution to the linear system Ax = result, where A is the most recently factorised jacobian matrix of the problem problem_pt. The solution is returned in the result vector.
Wrapper for HSL MA42 frontal solver.
Reimplemented from oomph::LinearSolver.
Definition at line 888 of file frontal_solver.cc.
References oomph::DoubleVector::build(), oomph::DistributableLinearAlgebraObject::distribution_pt(), i, Icntl, Info, Isave, IW, Liw, Lw, N_dof, oomph::DistributableLinearAlgebraObject::nrow(), and W.
|
inlinevirtual |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. Call the broken base-class version. If you want this, please implement it.
Reimplemented from oomph::LinearSolver.
Definition at line 178 of file frontal_solver.h.
References oomph::LinearSolver::solve().
|
inlinevirtual |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system Call the broken base-class version. If you want this, please implement it.
Reimplemented from oomph::LinearSolver.
Definition at line 190 of file frontal_solver.h.
References oomph::LinearSolver::solve().
|
virtual |
Solver: Takes pointer to problem and returns the results Vector which contains the solution of the linear system defined by the problem's fully assembled Jacobian and residual Vector.
Wrapper for HSL MA42 frontal solver.
Implements oomph::LinearSolver.
Definition at line 127 of file frontal_solver.cc.
References oomph::Problem::assembly_handler_pt(), oomph::DoubleVector::build(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::Problem::communicator_pt(), Doc_stats, e, oomph::Mesh::element_pt(), oomph::LinearSolver::Enable_resolve, oomph::AssemblyHandler::eqn_number(), Front_factor, oomph::AssemblyHandler::get_jacobian(), i, Icntl, Info, Isave, IW, Lenbuf_factor0, Lenbuf_factor1, Lenbuf_factor2, Lenfle_factor, Liw, Lw, oomph::Problem::mesh_pt(), N_dof, oomph::Problem::ndof(), oomph::AssemblyHandler::ndof(), oomph::Mesh::nelement(), oomph::oomph_info, reorder_elements(), Reorder_flag, oomph::DenseMatrix< T >::resize(), oomph::Problem::sign_of_jacobian(), solve_for_one_dof(), Use_direct_access_files, and W.
|
private |
Special solver for problems with 1 dof (MA42 can't handle this case so solve() forwards the "solve" to this function.
Special solver for problems with one DOF – HSL_MA42 can't handle that!
Definition at line 48 of file frontal_solver.cc.
References oomph::Problem::assembly_handler_pt(), e, oomph::Mesh::element_pt(), oomph::LinearSolver::Enable_resolve, oomph::AssemblyHandler::get_jacobian(), oomph::Problem::mesh_pt(), N_dof, oomph::Problem::ndof(), oomph::AssemblyHandler::ndof(), oomph::Mesh::nelement(), oomph::Problem::sign_of_jacobian(), and W.
Referenced by solve().
|
private |
Doc the solver stats or stay quiet?
Definition at line 64 of file frontal_solver.h.
Referenced by disable_doc_stats(), enable_doc_stats(), HSL_MA42(), reorder_elements(), and solve().
|
private |
Factor to increase storage for front size; see MA42 documentation for details.
Definition at line 86 of file frontal_solver.h.
Referenced by front_factor(), HSL_MA42(), and solve().
|
private |
Control flag for MA42; see MA42 documentation for details.
Definition at line 93 of file frontal_solver.h.
|
private |
Control flag for MA42; see MA42 documentation for details.
Definition at line 99 of file frontal_solver.h.
|
private |
Control flag for MA42; see MA42 documentation for details.
Definition at line 96 of file frontal_solver.h.
|
private |
Integer workspace storage for MA42.
Definition at line 108 of file frontal_solver.h.
Referenced by clean_up_memory(), resolve(), and solve().
|
private |
Factor to increase storage for lenbuf[0]; see MA42 documentation for details.
Definition at line 74 of file frontal_solver.h.
Referenced by HSL_MA42(), lenbuf_factor0(), and solve().
|
private |
Factor to increase storage for lenbuf[1]; see MA42 documentation for details.
Definition at line 78 of file frontal_solver.h.
Referenced by HSL_MA42(), lenbuf_factor1(), and solve().
|
private |
Factor to increase storage for lenbuf[2]; see MA42 documentation for details.
Definition at line 82 of file frontal_solver.h.
Referenced by HSL_MA42(), lenbuf_factor2(), and solve().
|
private |
Factor to increase size of direct access files; see MA42 documentation for details.
Definition at line 90 of file frontal_solver.h.
Referenced by HSL_MA42(), lenfle_factor(), and solve().
|
private |
Size of the integer workspace array.
Definition at line 111 of file frontal_solver.h.
Referenced by clean_up_memory(), resolve(), and solve().
|
private |
Size of the workspace array, W.
Definition at line 105 of file frontal_solver.h.
Referenced by clean_up_memory(), resolve(), and solve().
|
private |
Size of the linear system.
Definition at line 114 of file frontal_solver.h.
Referenced by resolve(), solve(), and solve_for_one_dof().
|
private |
Reorder elements with Sloan's algorithm?
Definition at line 67 of file frontal_solver.h.
Referenced by disable_reordering(), enable_reordering(), HSL_MA42(), and solve().
|
private |
Use direct access files?
Definition at line 70 of file frontal_solver.h.
Referenced by disable_direct_access_files(), enable_direct_access_files(), HSL_MA42(), and solve().
|
private |
Workspace storage for MA42.
Definition at line 102 of file frontal_solver.h.
Referenced by clean_up_memory(), resolve(), solve(), and solve_for_one_dof().