//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// More...
#include <iterative_linear_solver.h>
Public Member Functions | |
BiCGStab () | |
Constructor. More... | |
virtual | ~BiCGStab () |
Destructor (cleanup storage) More... | |
BiCGStab (const BiCGStab &)=delete | |
Broken copy constructor. More... | |
void | operator= (const BiCGStab &)=delete |
Broken assignment operator. 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 &solution) |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. 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) |
Re-solve the system defined by the last assembled Jacobian and the rhs vector specified here. Solution is returned in the vector result. More... | |
unsigned | iterations () const |
Number of iterations taken. More... | |
Public Member Functions inherited from oomph::IterativeLinearSolver | |
IterativeLinearSolver () | |
Constructor: Set (default) trivial preconditioner and set defaults for tolerance and max. number of iterations. More... | |
IterativeLinearSolver (const IterativeLinearSolver &)=delete | |
Broken copy constructor. More... | |
void | operator= (const IterativeLinearSolver &)=delete |
Broken assignment operator. More... | |
virtual | ~IterativeLinearSolver () |
Destructor (empty) More... | |
Preconditioner *& | preconditioner_pt () |
Access function to preconditioner. More... | |
Preconditioner *const & | preconditioner_pt () const |
Access function to preconditioner (const version) More... | |
double & | tolerance () |
Access to convergence tolerance. More... | |
unsigned & | max_iter () |
Access to max. number of iterations. More... | |
void | enable_doc_convergence_history () |
Enable documentation of the convergence history. More... | |
void | disable_doc_convergence_history () |
Disable documentation of the convergence history. More... | |
void | open_convergence_history_file_stream (const std::string &file_name, const std::string &zone_title="") |
Write convergence history into file with specified filename (automatically switches on doc). Optional second argument is a string that can be used (as a zone title) to identify what case we're running (e.g. what combination of linear solver and preconditioner or parameter values are used). More... | |
void | close_convergence_history_file_stream () |
Close convergence history output stream. More... | |
double | jacobian_setup_time () const |
returns the time taken to assemble the jacobian matrix and residual vector More... | |
double | linear_solver_solution_time () const |
return the time taken to solve the linear system More... | |
virtual double | preconditioner_setup_time () const |
returns the the time taken to setup the preconditioner More... | |
void | enable_setup_preconditioner_before_solve () |
Setup the preconditioner before the solve. More... | |
void | disable_setup_preconditioner_before_solve () |
Don't set up the preconditioner before the solve. More... | |
void | enable_error_after_max_iter () |
Throw an error if we don't converge within max_iter. More... | |
void | disable_error_after_max_iter () |
Don't throw an error if we don't converge within max_iter (default). More... | |
void | enable_iterative_solver_as_preconditioner () |
Enables the iterative solver be used as preconditioner (when calling the solve method it bypass the setup solver method – currently only used by Trilinos solver —) More... | |
void | disable_iterative_solver_as_preconditioner () |
Disables the iterative solver be used as preconditioner (when calling the solve method it bypass the setup solver method – currently only used by Trilinos solver —) 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 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_helper (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &solution) |
General interface to solve function. More... | |
void | clean_up_memory () |
Cleanup data that's stored for resolve (if any has been stored) More... | |
Private Attributes | |
unsigned | Iterations |
Number of iterations taken. More... | |
MATRIX * | Matrix_pt |
Pointer to matrix. More... | |
bool | Resolving |
Boolean flag to indicate if the solve is done in re-solve mode, bypassing setup of matrix and preconditioner. More... | |
bool | Matrix_can_be_deleted |
Boolean flag to indicate if the matrix pointed to be Matrix_pt can be deleted. 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::IterativeLinearSolver | |
bool | Doc_convergence_history |
Flag indicating if the convergence history is to be documented. More... | |
std::ofstream | Output_file_stream |
Output file stream for convergence history. More... | |
double | Tolerance |
Convergence tolerance. More... | |
unsigned | Max_iter |
Maximum number of iterations. More... | |
Preconditioner * | Preconditioner_pt |
Pointer to the preconditioner. More... | |
double | Jacobian_setup_time |
Jacobian setup time. More... | |
double | Solution_time |
linear solver solution time More... | |
double | Preconditioner_setup_time |
Preconditioner setup time. More... | |
bool | Setup_preconditioner_before_solve |
indicates whether the preconditioner should be setup before solve. Default = true; More... | |
bool | Throw_error_after_max_iter |
Should we throw an error instead of just returning when we hit the max iterations? More... | |
bool | Use_iterative_solver_as_preconditioner |
Use the iterative solver as preconditioner. More... | |
bool | First_time_solve_when_used_as_preconditioner |
When the iterative solver is used a preconditioner then we call the setup of solver method only once (the first time the solve method is called) 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... | |
Static Protected Attributes inherited from oomph::IterativeLinearSolver | |
static IdentityPreconditioner | Default_preconditioner |
Default preconditioner: The base class for preconditioners is a fully functional (if trivial!) preconditioner. More... | |
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
The conjugate gradient method.
Definition at line 409 of file iterative_linear_solver.h.
|
inline |
Constructor.
Definition at line 413 of file iterative_linear_solver.h.
|
inlinevirtual |
Destructor (cleanup storage)
Definition at line 423 of file iterative_linear_solver.h.
References oomph::BiCGStab< MATRIX >::clean_up_memory().
|
delete |
Broken copy constructor.
|
inlineprivatevirtual |
Cleanup data that's stored for resolve (if any has been stored)
Reimplemented from oomph::LinearSolver.
Definition at line 512 of file iterative_linear_solver.h.
References oomph::BiCGStab< MATRIX >::Matrix_can_be_deleted, and oomph::BiCGStab< MATRIX >::Matrix_pt.
Referenced by oomph::BiCGStab< MATRIX >::disable_resolve(), and oomph::BiCGStab< MATRIX >::~BiCGStab().
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
Definition at line 435 of file iterative_linear_solver.h.
References oomph::BiCGStab< MATRIX >::clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inlinevirtual |
Number of iterations taken.
Implements oomph::IterativeLinearSolver.
Definition at line 499 of file iterative_linear_solver.h.
References oomph::BiCGStab< MATRIX >::Iterations.
|
delete |
Broken assignment operator.
|
virtual |
Re-solve the system defined by the last assembled Jacobian and the rhs vector specified here. Solution is returned in the vector result.
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
Re-solve the system defined by the last assembled Jacobian and the rhs vector specified here. Solution is returned in the vector result.
Reimplemented from oomph::LinearSolver.
Definition at line 63 of file iterative_linear_solver.cc.
|
inlinevirtual |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system.
Reimplemented from oomph::LinearSolver.
Definition at line 448 of file iterative_linear_solver.h.
References oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Enable_resolve, oomph::BiCGStab< MATRIX >::Matrix_can_be_deleted, oomph::BiCGStab< MATRIX >::Matrix_pt, oomph::BiCGStab< MATRIX >::Resolving, and oomph::BiCGStab< MATRIX >::solve_helper().
|
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 484 of file iterative_linear_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.
Implements oomph::LinearSolver.
Definition at line 90 of file iterative_linear_solver.cc.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), oomph::TerminateHelper::clean_up_memory(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::Problem::get_jacobian(), oomph::oomph_info, oomph::DoubleVector::redistribute(), and oomph::TimingHelpers::timer().
|
private |
General interface to solve function.
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. Algorithm and variable names based on "Numerical Linear Algebra for High-Performance Computers" by Dongarra, Duff, Sorensen & van der Vorst. SIAM (1998), page 185.
Definition at line 171 of file iterative_linear_solver.cc.
References oomph::DoubleVector::build(), oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::built(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::DoubleVector::dot(), i, oomph::DoubleVector::initialise(), oomph::BlackBoxFDNewtonSolver::Max_iter, oomph::DoubleMatrixBase::multiply(), oomph::DoubleMatrixBase::ncol(), oomph::DoubleVector::norm(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::DoubleMatrixBase::nrow(), oomph::oomph_info, s, oomph::Global_string_for_annotation::string(), t, and oomph::TimingHelpers::timer().
Referenced by oomph::BiCGStab< MATRIX >::solve().
|
private |
Number of iterations taken.
Definition at line 522 of file iterative_linear_solver.h.
Referenced by oomph::BiCGStab< MATRIX >::iterations().
|
private |
Boolean flag to indicate if the matrix pointed to be Matrix_pt can be deleted.
Definition at line 533 of file iterative_linear_solver.h.
Referenced by oomph::BiCGStab< MATRIX >::clean_up_memory(), and oomph::BiCGStab< MATRIX >::solve().
|
private |
Pointer to matrix.
Definition at line 525 of file iterative_linear_solver.h.
Referenced by oomph::BiCGStab< MATRIX >::clean_up_memory(), and oomph::BiCGStab< MATRIX >::solve().
|
private |
Boolean flag to indicate if the solve is done in re-solve mode, bypassing setup of matrix and preconditioner.
Definition at line 529 of file iterative_linear_solver.h.
Referenced by oomph::BiCGStab< MATRIX >::solve().