Public Member Functions | Protected Attributes | List of all members
oomph::LinearSolver Class Referenceabstract

#include <linear_solver.h>

+ Inheritance diagram for oomph::LinearSolver:

Public Member Functions

 LinearSolver ()
 Empty constructor, initialise the member data. More...
 
 LinearSolver (const LinearSolver &dummy)
 Broken copy constructor. More...
 
void operator= (const LinearSolver &)
 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 disable_resolve ()
 Disable resolve (i.e. store matrix and/or LU decomposition, say) This function simply resets an internal flag. It's virtual so it can be overloaded to perform additional tasks such as cleaning up memory that is only required for the resolve. More...
 
virtual void solve (Problem *const &problem_pt, DoubleVector &result)=0
 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...
 
virtual 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. More...
 
virtual 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. More...
 
virtual void resolve (const DoubleVector &rhs, DoubleVector &result)
 Resolve the system defined by the last assembled jacobian and the rhs vector. Solution is returned in the vector result. (broken virtual) More...
 
virtual void clean_up_memory ()
 Empty virtual function that can be overloaded in specific linear solvers to clean up any memory that may have been allocated (e.g. when preparing for a re-solve). 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)
 Broken copy constructor. More...
 
void operator= (const DistributableLinearAlgebraObject &)
 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
 
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...
 

Protected Attributes

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

Additional Inherited Members

- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 clear the distribution of this distributable linear algebra object More...
 

Detailed Description

Base class for all linear solvers. This merely defines standard interfaces for linear solvers, so that different solvers can be used in a clean and transparent manner. Note that LinearSolvers are primarily used to solve the linear systems arising in oomph-lib's Newton iteration. Their primary solve function therefore takes a pointer to the associated problem, construct its Jacobian matrix and residual vector, and return the solution of the linear system formed by the Jacobian and the residual vector. We also provide broken virtual interfaces to a linear-algebra-type solve function in which the matrix and the rhs can be specified, but this are not guaranteed to implemented for all linear solvers (e.g. for frontal solvers).

Definition at line 73 of file linear_solver.h.

Constructor & Destructor Documentation

oomph::LinearSolver::LinearSolver ( )
inline

Empty constructor, initialise the member data.

Definition at line 100 of file linear_solver.h.

oomph::LinearSolver::LinearSolver ( const LinearSolver dummy)
inline

Broken copy constructor.

Definition at line 104 of file linear_solver.h.

References oomph::BrokenCopy::broken_copy().

virtual oomph::LinearSolver::~LinearSolver ( )
inlinevirtual

Empty virtual destructor.

Definition at line 116 of file linear_solver.h.

Member Function Documentation

virtual void oomph::LinearSolver::clean_up_memory ( )
inlinevirtual
void oomph::LinearSolver::disable_computation_of_gradient ( )
inline

function to disable the computation of the gradient required for the globally convergent Newton method

Definition at line 220 of file linear_solver.h.

References Compute_gradient.

void oomph::LinearSolver::disable_doc_time ( )
inline
virtual void oomph::LinearSolver::disable_resolve ( )
inlinevirtual

Disable resolve (i.e. store matrix and/or LU decomposition, say) This function simply resets an internal flag. It's virtual so it can be overloaded to perform additional tasks such as cleaning up memory that is only required for the resolve.

Reimplemented in oomph::HelmholtzGMRESMG< MATRIX >, oomph::GMRES< MATRIX >, oomph::ComplexGMRES< MATRIX >, oomph::GS< CRDoubleMatrix >, oomph::GS< MATRIX >, oomph::HypreSolver, oomph::SuperLUSolver, oomph::TrilinosAztecOOSolver, oomph::BiCGStab< MATRIX >, oomph::CG< MATRIX >, oomph::HSL_MA42, and oomph::MumpsSolver.

Definition at line 138 of file linear_solver.h.

References Enable_resolve.

Referenced by oomph::Problem::calculate_continuation_derivatives(), oomph::MumpsSolver::disable_resolve(), oomph::HSL_MA42::disable_resolve(), oomph::CG< MATRIX >::disable_resolve(), oomph::BiCGStab< MATRIX >::disable_resolve(), oomph::SuperLUSolver::disable_resolve(), oomph::GS< MATRIX >::disable_resolve(), oomph::GS< CRDoubleMatrix >::disable_resolve(), oomph::ComplexGMRES< MATRIX >::disable_resolve(), oomph::GMRES< MATRIX >::disable_resolve(), oomph::HelmholtzGMRESMG< MATRIX >::disable_resolve(), oomph::FoldHandler::FoldHandler(), oomph::HopfHandler::HopfHandler(), oomph::Problem::newton_solve_continuation(), oomph::AugmentedBlockFoldLinearSolver::resolve(), oomph::BlockPitchForkLinearSolver::resolve(), oomph::AugmentedBlockPitchForkLinearSolver::resolve(), oomph::AugmentedBlockFoldLinearSolver::solve(), oomph::BlockPitchForkLinearSolver::solve(), oomph::AugmentedBlockPitchForkLinearSolver::solve(), oomph::BlockHopfLinearSolver::solve(), oomph::ARPACK::solve_eigenproblem(), and oomph::BlockHopfLinearSolver::solve_for_two_rhs().

virtual void oomph::LinearSolver::enable_computation_of_gradient ( )
inlinevirtual

function to enable the computation of the gradient required for the globally convergent Newton method

Reimplemented in oomph::SuperLUSolver.

Definition at line 209 of file linear_solver.h.

Referenced by oomph::Problem::newton_solve().

void oomph::LinearSolver::enable_doc_time ( )
inline

Enable documentation of solve times.

Definition at line 119 of file linear_solver.h.

References Doc_time.

Referenced by oomph::NewMumpsPreconditioner::enable_doc_time(), and oomph::ProjectionProblem< PROJECTABLE_ELEMENT >::project().

virtual void oomph::LinearSolver::enable_resolve ( )
inlinevirtual
void oomph::LinearSolver::get_gradient ( DoubleVector gradient)
inline

function to access the gradient, provided it has been computed

Definition at line 233 of file linear_solver.h.

References Gradient_for_glob_conv_newton_solve, and Gradient_has_been_computed.

Referenced by oomph::Problem::newton_solve().

bool oomph::LinearSolver::is_doc_time_enabled ( ) const
inline

Is documentation of solve times enabled?

Definition at line 125 of file linear_solver.h.

References Doc_time.

Referenced by oomph::ProjectionProblem< PROJECTABLE_ELEMENT >::project().

bool oomph::LinearSolver::is_resolve_enabled ( ) const
inline
virtual double oomph::LinearSolver::jacobian_setup_time ( ) const
inlinevirtual

returns the time taken to assemble the Jacobian matrix and residual vector (needs to be overloaded for each solver)

Reimplemented in oomph::SuperLUSolver, oomph::DenseLU, and oomph::IterativeLinearSolver.

Definition at line 187 of file linear_solver.h.

virtual double oomph::LinearSolver::linear_solver_solution_time ( ) const
inlinevirtual

return the time taken to solve the linear system (needs to be overloaded for each linear solver)

Reimplemented in oomph::SuperLUSolver, oomph::DenseLU, and oomph::IterativeLinearSolver.

Definition at line 198 of file linear_solver.h.

void oomph::LinearSolver::operator= ( const LinearSolver )
inline

Broken assignment operator.

Definition at line 110 of file linear_solver.h.

References oomph::BrokenCopy::broken_assign().

void oomph::LinearSolver::reset_gradient ( )
inline

function to reset the size of the gradient before each Newton solve

Definition at line 227 of file linear_solver.h.

References oomph::DoubleVector::clear(), and Gradient_for_glob_conv_newton_solve.

Referenced by oomph::Problem::newton_solve().

virtual void oomph::LinearSolver::resolve ( const DoubleVector rhs,
DoubleVector result 
)
inlinevirtual
virtual void oomph::LinearSolver::solve ( Problem *const &  problem_pt,
DoubleVector result 
)
pure 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.

Implemented in oomph::HelmholtzFGMRESMG< MATRIX >, oomph::HelmholtzGMRESMG< MATRIX >, oomph::GMRES< MATRIX >, oomph::DampedJacobi< MATRIX >, oomph::BlockHopfLinearSolver, oomph::ComplexGMRES< MATRIX >, oomph::GS< CRDoubleMatrix >, oomph::AugmentedBlockPitchForkLinearSolver, oomph::HypreSolver, oomph::GS< MATRIX >, oomph::BlockPitchForkLinearSolver, oomph::SuperLUSolver, oomph::MGSolver< DIM >, oomph::ComplexDampedJacobi< MATRIX >, oomph::BiCGStab< MATRIX >, oomph::TrilinosAztecOOSolver, oomph::AugmentedBlockFoldLinearSolver, oomph::FD_LU, oomph::CG< MATRIX >, oomph::DenseLU, oomph::HSL_MA42, and oomph::MumpsSolver.

Referenced by oomph::ProblemBasedShiftInvertOperator::apply(), oomph::Problem::calculate_continuation_derivatives(), oomph::FoldHandler::FoldHandler(), oomph::Problem::get_inverse_mass_matrix_times_residuals(), oomph::HopfHandler::HopfHandler(), oomph::Problem::newton_solve(), oomph::Problem::newton_solve_continuation(), oomph::SolidICProblem::set_newmark_initial_condition_consistently(), oomph::HSL_MA42::solve(), oomph::DoubleMatrixBase::solve(), oomph::FD_LU::solve(), oomph::AugmentedBlockFoldLinearSolver::solve(), oomph::BiCGStab< MATRIX >::solve(), oomph::BlockPitchForkLinearSolver::solve(), oomph::AugmentedBlockPitchForkLinearSolver::solve(), oomph::GS< MATRIX >::solve(), oomph::GS< CRDoubleMatrix >::solve(), oomph::ComplexGMRES< MATRIX >::solve(), oomph::BlockHopfLinearSolver::solve(), oomph::GMRES< MATRIX >::solve(), oomph::HelmholtzGMRESMG< MATRIX >::solve(), oomph::ARPACK::solve_eigenproblem(), and oomph::BlockHopfLinearSolver::solve_for_two_rhs().

virtual void oomph::LinearSolver::solve ( DoubleMatrixBase *const &  matrix_pt,
const DoubleVector rhs,
DoubleVector result 
)
inlinevirtual
virtual void oomph::LinearSolver::solve ( DoubleMatrixBase *const &  matrix_pt,
const Vector< double > &  rhs,
Vector< double > &  result 
)
inlinevirtual

Member Data Documentation

bool oomph::LinearSolver::Compute_gradient
protected

flag that indicates whether the gradient required for the globally convergent Newton method should be computed or not

Definition at line 88 of file linear_solver.h.

Referenced by disable_computation_of_gradient(), oomph::SuperLUSolver::enable_computation_of_gradient(), and oomph::SuperLUSolver::solve().

bool oomph::LinearSolver::Doc_time
protected
bool oomph::LinearSolver::Enable_resolve
protected
DoubleVector oomph::LinearSolver::Gradient_for_glob_conv_newton_solve
protected

DoubleVector storing the gradient for the globally convergent Newton method.

Definition at line 95 of file linear_solver.h.

Referenced by get_gradient(), reset_gradient(), and oomph::SuperLUSolver::solve().

bool oomph::LinearSolver::Gradient_has_been_computed
protected

flag that indicates whether the gradient was computed or not

Definition at line 91 of file linear_solver.h.

Referenced by get_gradient(), and oomph::SuperLUSolver::solve().


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