Public Member Functions | Private Member Functions | Private Attributes | List of all members
oomph::HSL_MA42 Class Reference

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>

+ Inheritance diagram for oomph::HSL_MA42:

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...
 
LinearAlgebraDistributiondistribution_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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ HSL_MA42() [1/2]

oomph::HSL_MA42::HSL_MA42 ( )
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.

◆ ~HSL_MA42()

oomph::HSL_MA42::~HSL_MA42 ( )
inline

Destructor, clean up the allocated memory.

Definition at line 134 of file frontal_solver.h.

References clean_up_memory().

◆ HSL_MA42() [2/2]

oomph::HSL_MA42::HSL_MA42 ( const HSL_MA42 )
delete

Broken copy constructor.

Member Function Documentation

◆ clean_up_memory()

void oomph::HSL_MA42::clean_up_memory ( )
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().

◆ disable_direct_access_files()

void oomph::HSL_MA42::disable_direct_access_files ( )
inline

Disable use of direct access files.

Definition at line 237 of file frontal_solver.h.

References Use_direct_access_files.

◆ disable_doc_stats()

void oomph::HSL_MA42::disable_doc_stats ( )
inline

Disable documentation of statistics.

Definition at line 213 of file frontal_solver.h.

References Doc_stats.

◆ disable_reordering()

void oomph::HSL_MA42::disable_reordering ( )
inline

Disable reordering.

Definition at line 225 of file frontal_solver.h.

References Reorder_flag.

◆ disable_resolve()

void oomph::HSL_MA42::disable_resolve ( )
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().

◆ enable_direct_access_files()

void oomph::HSL_MA42::enable_direct_access_files ( )
inline

Enable use of direct access files.

Definition at line 231 of file frontal_solver.h.

References Use_direct_access_files.

◆ enable_doc_stats()

void oomph::HSL_MA42::enable_doc_stats ( )
inline

Enable documentation of statistics.

Definition at line 207 of file frontal_solver.h.

References Doc_stats.

◆ enable_reordering()

void oomph::HSL_MA42::enable_reordering ( )
inline

Enable reordering using Sloan's algorithm.

Definition at line 219 of file frontal_solver.h.

References Reorder_flag.

◆ front_factor()

double& oomph::HSL_MA42::front_factor ( )
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.

◆ lenbuf_factor0()

double& oomph::HSL_MA42::lenbuf_factor0 ( )
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.

◆ lenbuf_factor1()

double& oomph::HSL_MA42::lenbuf_factor1 ( )
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.

◆ lenbuf_factor2()

double& oomph::HSL_MA42::lenbuf_factor2 ( )
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.

◆ lenfle_factor()

double& oomph::HSL_MA42::lenfle_factor ( )
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.

◆ operator=()

void oomph::HSL_MA42::operator= ( const HSL_MA42 )
delete

Broken assignment operator.

◆ reorder_elements()

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().

◆ resolve()

void oomph::HSL_MA42::resolve ( const DoubleVector rhs,
DoubleVector result 
)
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.

◆ solve() [1/3]

void oomph::HSL_MA42::solve ( DoubleMatrixBase *const &  matrix_pt,
const DoubleVector rhs,
DoubleVector result 
)
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().

◆ solve() [2/3]

void oomph::HSL_MA42::solve ( DoubleMatrixBase *const &  matrix_pt,
const Vector< double > &  rhs,
Vector< double > &  result 
)
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().

◆ solve() [3/3]

void oomph::HSL_MA42::solve ( Problem *const &  problem_pt,
DoubleVector result 
)
virtual

◆ solve_for_one_dof()

void oomph::HSL_MA42::solve_for_one_dof ( Problem *const &  problem_pt,
DoubleVector result 
)
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().

Member Data Documentation

◆ Doc_stats

bool oomph::HSL_MA42::Doc_stats
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().

◆ Front_factor

double oomph::HSL_MA42::Front_factor
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().

◆ Icntl

int oomph::HSL_MA42::Icntl[8]
private

Control flag for MA42; see MA42 documentation for details.

Definition at line 93 of file frontal_solver.h.

Referenced by resolve(), and solve().

◆ Info

int oomph::HSL_MA42::Info[23]
private

Control flag for MA42; see MA42 documentation for details.

Definition at line 99 of file frontal_solver.h.

Referenced by resolve(), and solve().

◆ Isave

int oomph::HSL_MA42::Isave[45]
private

Control flag for MA42; see MA42 documentation for details.

Definition at line 96 of file frontal_solver.h.

Referenced by resolve(), and solve().

◆ IW

int* oomph::HSL_MA42::IW
private

Integer workspace storage for MA42.

Definition at line 108 of file frontal_solver.h.

Referenced by clean_up_memory(), resolve(), and solve().

◆ Lenbuf_factor0

double oomph::HSL_MA42::Lenbuf_factor0
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().

◆ Lenbuf_factor1

double oomph::HSL_MA42::Lenbuf_factor1
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().

◆ Lenbuf_factor2

double oomph::HSL_MA42::Lenbuf_factor2
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().

◆ Lenfle_factor

double oomph::HSL_MA42::Lenfle_factor
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().

◆ Liw

int oomph::HSL_MA42::Liw
private

Size of the integer workspace array.

Definition at line 111 of file frontal_solver.h.

Referenced by clean_up_memory(), resolve(), and solve().

◆ Lw

int oomph::HSL_MA42::Lw
private

Size of the workspace array, W.

Definition at line 105 of file frontal_solver.h.

Referenced by clean_up_memory(), resolve(), and solve().

◆ N_dof

unsigned long oomph::HSL_MA42::N_dof
private

Size of the linear system.

Definition at line 114 of file frontal_solver.h.

Referenced by resolve(), solve(), and solve_for_one_dof().

◆ Reorder_flag

bool oomph::HSL_MA42::Reorder_flag
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().

◆ Use_direct_access_files

bool oomph::HSL_MA42::Use_direct_access_files
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().

◆ W

double* oomph::HSL_MA42::W
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().


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