//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// More...
#include <iterative_linear_solver.h>
Inheritance diagram for oomph::GS< MATRIX >:Public Member Functions | |
| GS () | |
| Constructor. | |
| virtual | ~GS () |
| Destructor (cleanup storage) | |
| GS (const GS &)=delete | |
| Broken copy constructor. | |
| void | operator= (const GS &)=delete |
| Broken assignment operator. | |
| void | disable_resolve () |
| Overload disable resolve so that it cleans up memory too. | |
| void | smoother_setup (DoubleMatrixBase *matrix_pt) |
| Set up the smoother for the matrix specified by the pointer. | |
| void | smoother_solve (const DoubleVector &rhs, DoubleVector &result) |
| The smoother_solve function performs fixed number of iterations on the system A*result=rhs. The number of (smoothing) iterations is the same as the max. number of iterations in the underlying IterativeLinearSolver class. | |
| 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. | |
| 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. | |
| 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. | |
| 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. | |
| double | preconditioner_setup_time () const |
| Returns the time taken to set up the preconditioner. | |
| unsigned | iterations () const |
| Number of iterations taken. | |
Public Member Functions inherited from oomph::Smoother | |
| Smoother () | |
| Empty constructor. | |
| virtual | ~Smoother () |
| Virtual empty destructor. | |
| template<typename MATRIX > | |
| void | check_validity_of_solve_helper_inputs (MATRIX *const &matrix_pt, const DoubleVector &rhs, DoubleVector &solution, const double &n_dof) |
| Self-test to check that all the dimensions of the inputs to solve helper are consistent and everything that needs to be built, is. | |
Public Member Functions inherited from oomph::IterativeLinearSolver | |
| IterativeLinearSolver () | |
| Constructor: Set (default) trivial preconditioner and set defaults for tolerance and max. number of iterations. | |
| IterativeLinearSolver (const IterativeLinearSolver &)=delete | |
| Broken copy constructor. | |
| void | operator= (const IterativeLinearSolver &)=delete |
| Broken assignment operator. | |
| virtual | ~IterativeLinearSolver () |
| Destructor (empty) | |
| Preconditioner *& | preconditioner_pt () |
| Access function to preconditioner. | |
| Preconditioner *const & | preconditioner_pt () const |
| Access function to preconditioner (const version) | |
| double & | tolerance () |
| Access to convergence tolerance. | |
| unsigned & | max_iter () |
| Access to max. number of iterations. | |
| void | enable_doc_convergence_history () |
| Enable documentation of the convergence history. | |
| void | disable_doc_convergence_history () |
| Disable documentation of the convergence history. | |
| 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). | |
| void | close_convergence_history_file_stream () |
| Close convergence history output stream. | |
| double | jacobian_setup_time () const |
| returns the time taken to assemble the jacobian matrix and residual vector | |
| double | linear_solver_solution_time () const |
| return the time taken to solve the linear system | |
| void | enable_setup_preconditioner_before_solve () |
| Setup the preconditioner before the solve. | |
| void | disable_setup_preconditioner_before_solve () |
| Don't set up the preconditioner before the solve. | |
| void | enable_error_after_max_iter () |
| Throw an error if we don't converge within max_iter. | |
| void | disable_error_after_max_iter () |
| Don't throw an error if we don't converge within max_iter (default). | |
| 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 —) | |
| 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 —) | |
Public Member Functions inherited from oomph::LinearSolver | |
| LinearSolver () | |
| Empty constructor, initialise the member data. | |
| LinearSolver (const LinearSolver &dummy)=delete | |
| Broken copy constructor. | |
| void | operator= (const LinearSolver &)=delete |
| Broken assignment operator. | |
| virtual | ~LinearSolver () |
| Empty virtual destructor. | |
| void | enable_doc_time () |
| Enable documentation of solve times. | |
| void | disable_doc_time () |
| Disable documentation of solve times. | |
| bool | is_doc_time_enabled () const |
| Is documentation of solve times enabled? | |
| bool | is_resolve_enabled () const |
| Boolean flag indicating if resolves are enabled. | |
| 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. | |
| 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). | |
| 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. | |
| 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. | |
| 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) | |
| virtual void | enable_computation_of_gradient () |
| function to enable the computation of the gradient required for the globally convergent Newton method | |
| void | disable_computation_of_gradient () |
| function to disable the computation of the gradient required for the globally convergent Newton method | |
| void | reset_gradient () |
| function to reset the size of the gradient before each Newton solve | |
| void | get_gradient (DoubleVector &gradient) |
| function to access the gradient, provided it has been computed | |
Public Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
| DistributableLinearAlgebraObject () | |
| Default constructor - create a distribution. | |
| DistributableLinearAlgebraObject (const DistributableLinearAlgebraObject &matrix)=delete | |
| Broken copy constructor. | |
| void | operator= (const DistributableLinearAlgebraObject &)=delete |
| Broken assignment operator. | |
| virtual | ~DistributableLinearAlgebraObject () |
| Destructor. | |
| LinearAlgebraDistribution * | distribution_pt () const |
| access to the LinearAlgebraDistribution | |
| unsigned | nrow () const |
| access function to the number of global rows. | |
| unsigned | nrow_local () const |
| access function for the num of local rows on this processor. | |
| unsigned | nrow_local (const unsigned &p) const |
| access function for the num of local rows on this processor. | |
| unsigned | first_row () const |
| access function for the first row on this processor | |
| unsigned | first_row (const unsigned &p) const |
| access function for the first row on this processor | |
| bool | distributed () const |
| distribution is serial or distributed | |
| bool | distribution_built () const |
| if the communicator_pt is null then the distribution is not setup then false is returned, otherwise return true | |
| void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
| setup the distribution of this distributable linear algebra object | |
| void | build_distribution (const LinearAlgebraDistribution &dist) |
| setup the distribution of this distributable linear algebra object | |
Private Member Functions | |
| void | solve_helper (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &solution) |
| General interface to solve function. | |
| void | clean_up_memory () |
| Cleanup data that's stored for resolve (if any has been stored) | |
Private Attributes | |
| MATRIX * | Matrix_pt |
| System matrix pointer in the format specified by the template argument. | |
| unsigned | Iterations |
| Number of iterations taken. | |
| bool | Resolving |
| Boolean flag to indicate if the solve is done in re-solve mode, bypassing setup of matrix and preconditioner. | |
| bool | Matrix_can_be_deleted |
| Boolean flag to indicate if the matrix pointed to be Matrix_pt can be deleted. | |
Additional Inherited Members | |
Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject | |
| void | clear_distribution () |
| clear the distribution of this distributable linear algebra object | |
Protected Attributes inherited from oomph::Smoother | |
| bool | Use_as_smoother |
| When a derived class object is being used as a smoother in the MG solver (or elsewhere) the residual norm does not need to be calculated because we're simply performing a fixed number of (smoothing) iterations. This boolean is used as a flag to indicate that the IterativeLinearSolver (which this class is by inheritance) is supposed to act in this way. | |
Protected Attributes inherited from oomph::IterativeLinearSolver | |
| bool | Doc_convergence_history |
| Flag indicating if the convergence history is to be documented. | |
| std::ofstream | Output_file_stream |
| Output file stream for convergence history. | |
| double | Tolerance |
| Convergence tolerance. | |
| unsigned | Max_iter |
| Maximum number of iterations. | |
| Preconditioner * | Preconditioner_pt |
| Pointer to the preconditioner. | |
| double | Jacobian_setup_time |
| Jacobian setup time. | |
| double | Solution_time |
| linear solver solution time | |
| double | Preconditioner_setup_time |
| Preconditioner setup time. | |
| bool | Setup_preconditioner_before_solve |
| indicates whether the preconditioner should be setup before solve. Default = true; | |
| bool | Throw_error_after_max_iter |
| Should we throw an error instead of just returning when we hit the max iterations? | |
| bool | Use_iterative_solver_as_preconditioner |
| Use the iterative solver as preconditioner. | |
| 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) | |
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. | |
| bool | Doc_time |
| Boolean flag that indicates whether the time taken. | |
| bool | Compute_gradient |
| flag that indicates whether the gradient required for the globally convergent Newton method should be computed or not | |
| bool | Gradient_has_been_computed |
| flag that indicates whether the gradient was computed or not | |
| DoubleVector | Gradient_for_glob_conv_newton_solve |
| DoubleVector storing the gradient for the globally convergent Newton method. | |
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. | |
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
The Gauss Seidel method
Definition at line 598 of file iterative_linear_solver.h.
Constructor.
Definition at line 602 of file iterative_linear_solver.h.
Destructor (cleanup storage)
Definition at line 611 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::clean_up_memory().
Broken copy constructor.
Cleanup data that's stored for resolve (if any has been stored)
Reimplemented from oomph::LinearSolver.
Definition at line 746 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::Matrix_can_be_deleted, and oomph::GS< MATRIX >::Matrix_pt.
Referenced by oomph::GS< MATRIX >::disable_resolve(), oomph::GS< CRDoubleMatrix >::disable_resolve(), oomph::GS< MATRIX >::~GS(), and oomph::GS< CRDoubleMatrix >::~GS().
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
Definition at line 623 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::clean_up_memory(), and oomph::LinearSolver::disable_resolve().
Number of iterations taken.
Implements oomph::IterativeLinearSolver.
Definition at line 734 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::Iterations.
Broken assignment operator.
Returns the time taken to set up the preconditioner.
Reimplemented from oomph::IterativeLinearSolver.
Definition at line 724 of file iterative_linear_solver.h.
|
inlinevirtual |
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 702 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::Matrix_pt, oomph::GS< MATRIX >::Resolving, and oomph::GS< MATRIX >::solve().
|
inlinevirtual |
Set up the smoother for the matrix specified by the pointer.
Implements oomph::Smoother.
Definition at line 630 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::Matrix_can_be_deleted, and oomph::GS< MATRIX >::Matrix_pt.
|
inlinevirtual |
The smoother_solve function performs fixed number of iterations on the system A*result=rhs. The number of (smoothing) iterations is the same as the max. number of iterations in the underlying IterativeLinearSolver class.
Implements oomph::Smoother.
Definition at line 647 of file iterative_linear_solver.h.
References oomph::GS< MATRIX >::Matrix_pt, oomph::GS< MATRIX >::solve_helper(), and oomph::Smoother::Use_as_smoother.
|
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 663 of file iterative_linear_solver.h.
References oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Enable_resolve, oomph::GS< MATRIX >::Matrix_can_be_deleted, oomph::GS< MATRIX >::Matrix_pt, oomph::GS< MATRIX >::Resolving, oomph::GS< MATRIX >::solve_helper(), and oomph::Smoother::Use_as_smoother.
|
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 692 of file iterative_linear_solver.h.
References oomph::LinearSolver::solve().
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.
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
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 1104 of file iterative_linear_solver.cc.
References oomph::Problem::communicator_pt(), oomph::Problem::get_jacobian(), oomph::Problem::ndof(), oomph::oomph_info, oomph::TAdvectionDiffusionReactionElement< NREAGENT, DIM, NNODE_1D >::TAdvectionDiffusionReactionElement(), and oomph::TimingHelpers::timer().
Referenced by oomph::GS< MATRIX >::resolve(), and oomph::GS< CRDoubleMatrix >::resolve().
|
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.
Definition at line 1164 of file iterative_linear_solver.cc.
References i, oomph::oomph_info, oomph::DoubleMatrixBase::residual(), oomph::TAdvectionDiffusionReactionElement< NREAGENT, DIM, NNODE_1D >::TAdvectionDiffusionReactionElement(), and oomph::TimingHelpers::timer().
Referenced by oomph::GS< MATRIX >::smoother_solve(), oomph::GS< CRDoubleMatrix >::smoother_solve(), oomph::GS< MATRIX >::solve(), and oomph::GS< CRDoubleMatrix >::solve().
Number of iterations taken.
Definition at line 764 of file iterative_linear_solver.h.
Referenced by oomph::GS< MATRIX >::iterations(), and oomph::GS< CRDoubleMatrix >::iterations().
Boolean flag to indicate if the matrix pointed to be Matrix_pt can be deleted.
Definition at line 772 of file iterative_linear_solver.h.
Referenced by oomph::GS< MATRIX >::clean_up_memory(), oomph::GS< CRDoubleMatrix >::clean_up_memory(), oomph::GS< MATRIX >::smoother_setup(), oomph::GS< CRDoubleMatrix >::smoother_setup(), oomph::GS< MATRIX >::solve(), and oomph::GS< CRDoubleMatrix >::solve().
System matrix pointer in the format specified by the template argument.
Definition at line 761 of file iterative_linear_solver.h.
Referenced by oomph::GS< MATRIX >::clean_up_memory(), oomph::GS< CRDoubleMatrix >::clean_up_memory(), oomph::GS< MATRIX >::resolve(), oomph::GS< CRDoubleMatrix >::resolve(), oomph::GS< MATRIX >::smoother_setup(), oomph::GS< MATRIX >::smoother_solve(), oomph::GS< CRDoubleMatrix >::smoother_solve(), oomph::GS< MATRIX >::solve(), and oomph::GS< CRDoubleMatrix >::solve().
Boolean flag to indicate if the solve is done in re-solve mode, bypassing setup of matrix and preconditioner.
Definition at line 768 of file iterative_linear_solver.h.
Referenced by oomph::GS< MATRIX >::resolve(), oomph::GS< CRDoubleMatrix >::resolve(), oomph::GS< MATRIX >::solve(), and oomph::GS< CRDoubleMatrix >::solve().