![]() |
|
#include <iterative_linear_solver.h>
Public Member Functions | |
GS () | |
Constructor. More... | |
virtual | ~GS () |
Destructor (cleanup storage) More... | |
GS (const GS &)=delete | |
Broken copy constructor. More... | |
void | operator= (const GS &)=delete |
Broken assignment operator. More... | |
void | smoother_solve (const DoubleVector &rhs, DoubleVector &result) |
void | disable_resolve () |
Overload disable resolve so that it cleans up memory too. More... | |
void | smoother_setup (DoubleMatrixBase *matrix_pt) |
Set up the smoother for the matrix specified by the pointer. More... | |
void | setup_helper (DoubleMatrixBase *matrix_pt) |
void | solve (Problem *const &problem_pt, DoubleVector &result) |
void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &solution) |
void | solve (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
void | resolve (const DoubleVector &rhs, DoubleVector &result) |
double | preconditioner_setup_time () const |
Returns the time taken to set up the preconditioner. More... | |
unsigned | iterations () const |
Number of iterations taken. More... | |
![]() | |
Smoother () | |
Empty constructor. More... | |
virtual | ~Smoother () |
Virtual empty destructor. More... | |
template<typename MATRIX > | |
void | check_validity_of_solve_helper_inputs (MATRIX *const &matrix_pt, const DoubleVector &rhs, DoubleVector &solution, const double &n_dof) |
![]() | |
IterativeLinearSolver () | |
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="") |
void | close_convergence_history_file_stream () |
Close convergence history output stream. More... | |
double | jacobian_setup_time () const |
double | linear_solver_solution_time () const |
return the time taken to solve the linear system 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 () |
void | disable_iterative_solver_as_preconditioner () |
![]() | |
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 () |
virtual void | solve_transpose (Problem *const &problem_pt, DoubleVector &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
virtual void | resolve_transpose (const DoubleVector &rhs, DoubleVector &result) |
virtual void | enable_computation_of_gradient () |
void | disable_computation_of_gradient () |
void | reset_gradient () |
void | get_gradient (DoubleVector &gradient) |
function to access the gradient, provided it has been computed More... | |
![]() | |
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 |
void | build_distribution (const LinearAlgebraDistribution *const dist_pt) |
void | build_distribution (const LinearAlgebraDistribution &dist) |
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 () |
Clean up data that's stored for resolve (if any has been stored) More... | |
Private Attributes | |
CRDoubleMatrix * | Matrix_pt |
System matrix pointer in the format specified by the template argument. More... | |
unsigned | Iterations |
Number of iterations taken. More... | |
bool | Resolving |
bool | Matrix_can_be_deleted |
Vector< int > | Index_of_diagonal_entries |
//////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// Explicit template specialisation of the Gauss Seidel method for compressed row format matrices
|
inline |
Constructor.
|
inlinevirtual |
Destructor (cleanup storage)
References oomph::GS< MATRIX >::clean_up_memory().
|
delete |
Broken copy constructor.
|
inlineprivatevirtual |
Clean up data that's stored for resolve (if any has been stored)
Reimplemented from oomph::LinearSolver.
References oomph::GS< MATRIX >::Matrix_can_be_deleted, and oomph::GS< MATRIX >::Matrix_pt.
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
References oomph::GS< MATRIX >::clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inlinevirtual |
Number of iterations taken.
Implements oomph::IterativeLinearSolver.
References oomph::GS< MATRIX >::Iterations.
|
delete |
Broken assignment operator.
|
inlinevirtual |
Returns the time taken to set up the preconditioner.
Reimplemented from oomph::IterativeLinearSolver.
References OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, and oomph::Global_string_for_annotation::string().
|
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.
References oomph::GS< MATRIX >::Matrix_pt, OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::GS< MATRIX >::Resolving, and oomph::GS< MATRIX >::solve().
void oomph::GS< CRDoubleMatrix >::setup_helper | ( | DoubleMatrixBase * | matrix_pt | ) |
Generic setup function to sort out everything that needs to be set up with regards to the input matrix
Explicit template specialisation of the smoother_setup function for CR matrices. Set up the smoother for the matrix specified by the pointer. This definition of the smoother_setup has the added functionality that it sorts the entries in the given matrix so that the CRDoubleMatrix implementation of the solver can be used.
References oomph::GS< MATRIX >::Matrix_can_be_deleted, oomph::GS< MATRIX >::Matrix_pt, OOMPH_CURRENT_FUNCTION, and OOMPH_EXCEPTION_LOCATION.
|
inlinevirtual |
Set up the smoother for the matrix specified by the pointer.
Implements oomph::Smoother.
References oomph::GS< MATRIX >::Matrix_can_be_deleted.
|
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.
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.
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, BiharmonicTestFunctions1::solution(), 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.
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.
//////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// Explicit template specialisation of the solver for CR matrices: 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.
References oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::GS< MATRIX >::clean_up_memory(), oomph::Problem::communicator_pt(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::LinearSolver::Enable_resolve, f(), oomph::Problem::get_jacobian(), oomph::IterativeLinearSolver::Jacobian_setup_time, oomph::GS< MATRIX >::Matrix_can_be_deleted, oomph::GS< MATRIX >::Matrix_pt, oomph::Problem::ndof(), oomph::oomph_info, oomph::GS< MATRIX >::Resolving, oomph::GS< MATRIX >::solve_helper(), oomph::TimingHelpers::timer(), and oomph::Smoother::Use_as_smoother.
|
private |
General interface to solve function.
Explicit template specialisation of the solve_helper function for CR matrices. Exploiting the sparsity of the given matrix allows for a much faster iterative solver.
References oomph::DoubleVector::build(), oomph::CRDoubleMatrix::column_index(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::IterativeLinearSolver::Doc_convergence_history, oomph::LinearSolver::Doc_time, i, oomph::DoubleVector::initialise(), oomph::GS< MATRIX >::Iterations, j, oomph::IterativeLinearSolver::Max_iter, oomph::DoubleVector::norm(), oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::IterativeLinearSolver::Output_file_stream, oomph::DoubleMatrixBase::residual(), oomph::CRDoubleMatrix::row_start(), BiharmonicTestFunctions1::solution(), oomph::IterativeLinearSolver::Solution_time, oomph::Global_string_for_annotation::string(), oomph::IterativeLinearSolver::Throw_error_after_max_iter, oomph::TimingHelpers::timer(), oomph::IterativeLinearSolver::Tolerance, oomph::Smoother::Use_as_smoother, oomph::CRDoubleMatrix::value(), and plotDoE::x.
|
private |
Vector whose i'th entry contains the index of the last entry below or on the diagonal of the i'th row of the matrix
|
private |
Number of iterations taken.
|
private |
Boolean flag to indicate if the matrix pointed to be Matrix_pt can be deleted.
|
private |
System matrix pointer in the format specified by the template argument.
|
private |
Boolean flag to indicate if the solve is done in re-solve mode, bypassing setup of matrix and preconditioner