![]() |
|
#include <linear_solver.h>
Public Types | |
enum | Type { Default , Serial , Distributed } |
Public Member Functions | |
SuperLUSolver () | |
Constructor. Set the defaults. More... | |
SuperLUSolver (const SuperLUSolver &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const SuperLUSolver &)=delete |
Broken assignment operator. More... | |
~SuperLUSolver () | |
Destructor, clean up the stored matrices. More... | |
void | enable_computation_of_gradient () |
function to enable the computation of the gradient More... | |
void | disable_resolve () |
Overload disable resolve so that it cleans up memory too. More... | |
void | solve (Problem *const &problem_pt, DoubleVector &result) |
void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
void | solve_transpose (Problem *const &problem_pt, DoubleVector &result) |
void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
void | resolve (const DoubleVector &rhs, DoubleVector &result) |
Resolve the system for a given RHS. More... | |
void | resolve_transpose (const DoubleVector &rhs, DoubleVector &result) |
Resolve the (transposed) system for a given RHS. More... | |
void | enable_doc_stats () |
Enable documentation of solver statistics. More... | |
void | disable_doc_stats () |
Disable documentation of solver statistics. More... | |
double | jacobian_setup_time () const |
virtual double | linear_solver_solution_time () const |
void | factorise (DoubleMatrixBase *const &matrix_pt) |
void | backsub (const DoubleVector &rhs, DoubleVector &result) |
void | backsub_transpose (const DoubleVector &rhs, DoubleVector &result) |
void | clean_up_memory () |
Clean up the memory allocated by the solver. More... | |
void | set_solver_type (const Type &t) |
void | use_compressed_row_for_superlu_serial () |
Use the compressed row format in superlu serial. More... | |
void | use_compressed_column_for_superlu_serial () |
Use the compressed column format in superlu serial. More... | |
double | get_memory_usage_for_lu_factors () |
How much memory do the LU factors take up? In bytes. More... | |
double | get_total_needed_memory () |
How much memory was allocated by SuperLU? In bytes. More... | |
![]() | |
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 (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
virtual void | solve_transpose (DoubleMatrixBase *const &matrix_pt, const Vector< double > &rhs, Vector< double > &result) |
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 | factorise_serial (DoubleMatrixBase *const &matrix_pt) |
factorise method for SuperLU (serial) More... | |
void | backsub_serial (const DoubleVector &rhs, DoubleVector &result) |
backsub method for SuperLU (serial) More... | |
void | backsub_transpose_serial (const DoubleVector &rhs, DoubleVector &result) |
backsub method for SuperLU (serial) More... | |
Private Attributes | |
double | Jacobian_setup_time |
Jacobian setup time. More... | |
double | Solution_time |
Solution time. More... | |
bool | Suppress_solve |
Suppress solve? More... | |
bool | Doc_stats |
Set to true to output statistics (false by default). More... | |
Type | Solver_type |
the solver type. see SuperLU_solver_type for details. More... | |
bool | Using_dist |
boolean flag indicating whether superlu dist is being used More... | |
void * | Serial_f_factors |
Storage for the LU factors as required by SuperLU. More... | |
int | Serial_info |
Info flag for the SuperLU solver. More... | |
unsigned long | Serial_n_dof |
The number of unknowns in the linear system. More... | |
int | Serial_sign_of_determinant_of_matrix |
Sign of the determinant of the matrix. More... | |
bool | Serial_compressed_row_flag |
Use compressed row version? More... | |
Additional Inherited Members | |
![]() | |
void | clear_distribution () |
![]() | |
bool | Enable_resolve |
bool | Doc_time |
Boolean flag that indicates whether the time taken. More... | |
bool | Compute_gradient |
bool | Gradient_has_been_computed |
flag that indicates whether the gradient was computed or not More... | |
DoubleVector | Gradient_for_glob_conv_newton_solve |
//////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////// SuperLU Project Solver class. This is a combined wrapper for both SuperLU and SuperLU Dist. See http://crd.lbl.gov/~xiaoye/SuperLU/ Default Behaviour: If this solver is distributed over more than one processor then SuperLU Dist is used. Member data naming convention: member data associated with the SuperLU Dist solver begins Dist_... and member data associated with the serial SuperLU solver begins Serial_... .
|
inline |
Constructor. Set the defaults.
References Default, Doc_stats, Serial_compressed_row_flag, Serial_n_dof, Serial_sign_of_determinant_of_matrix, Solver_type, Suppress_solve, and Using_dist.
|
delete |
Broken copy constructor.
|
inline |
Destructor, clean up the stored matrices.
References clean_up_memory().
void oomph::SuperLUSolver::backsub | ( | const DoubleVector & | rhs, |
DoubleVector & | result | ||
) |
Do the backsubstitution for SuperLU solver Note: returns the global result Vector.
Do the backsubstitution for SuperLUSolver. Note - this method performs no paranoid checks - these are all performed in solve(...) and resolve(...)
References backsub_serial(), and Using_dist.
|
private |
backsub method for SuperLU (serial)
Do the backsubstitution for SuperLU.
References oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, i, n, oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Serial_compressed_row_flag, Serial_f_factors, Serial_info, Serial_n_dof, oomph::superlu(), anonymous_namespace{skew_symmetric_matrix3.cpp}::transpose(), and oomph::DoubleVector::values_pt().
Referenced by backsub().
void oomph::SuperLUSolver::backsub_transpose | ( | const DoubleVector & | rhs, |
DoubleVector & | result | ||
) |
Do the back-substitution for transposed system of the SuperLU solver Note: Returns the global result Vector.
Do the backsubstitution of the transposed system for SuperLUSolver. Note - this method performs no paranoid checks - these are all performed in solve(...) and resolve(...)
References backsub_transpose_serial(), and Using_dist.
Referenced by resolve_transpose(), and solve_transpose().
|
private |
backsub method for SuperLU (serial)
Do the backsubstitution for SuperLU.
References oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, i, n, oomph::DistributableLinearAlgebraObject::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, Serial_compressed_row_flag, Serial_f_factors, Serial_info, Serial_n_dof, oomph::superlu(), anonymous_namespace{skew_symmetric_matrix3.cpp}::transpose(), and oomph::DoubleVector::values_pt().
Referenced by backsub_transpose().
|
virtual |
Clean up the memory allocated by the solver.
Clean up the memory.
Reimplemented from oomph::LinearSolver.
References oomph::DistributableLinearAlgebraObject::clear_distribution(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, i, oomph::LinearAlgebraDistribution::nrow(), Serial_compressed_row_flag, Serial_f_factors, Serial_info, Serial_n_dof, oomph::superlu(), and anonymous_namespace{skew_symmetric_matrix3.cpp}::transpose().
Referenced by oomph::SuperLUPreconditioner::clean_up_memory(), disable_resolve(), factorise(), factorise_serial(), set_solver_type(), solve(), solve_transpose(), and ~SuperLUSolver().
|
inline |
Disable documentation of solver statistics.
References Doc_stats.
Referenced by oomph::SuperLUPreconditioner::disable_doc_stats(), and oomph::SuperLUPreconditioner::SuperLUPreconditioner().
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
References clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inlinevirtual |
function to enable the computation of the gradient
Reimplemented from oomph::LinearSolver.
References oomph::LinearSolver::Compute_gradient.
|
inline |
Enable documentation of solver statistics.
References Doc_stats.
Referenced by oomph::SuperLUPreconditioner::enable_doc_stats().
void oomph::SuperLUSolver::factorise | ( | DoubleMatrixBase *const & | matrix_pt | ) |
Do the factorisation stage Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memory() will be used to wipe the matrix data.
LU decompose the matrix addressed by matrix_pt by using the SuperLU solver. The resulting matrix factors are stored internally.
References clean_up_memory(), oomph::LinearAlgebraDistribution::communicator_pt(), Default, Distributed, oomph::DistributableLinearAlgebraObject::distribution_pt(), factorise_serial(), oomph::MPI_Helpers::mpi_has_been_initialised(), oomph::OomphCommunicator::nproc(), Solver_type, and Using_dist.
Referenced by oomph::SuperLUPreconditioner::setup(), solve(), and solve_transpose().
|
private |
factorise method for SuperLU (serial)
LU decompose the matrix addressed by matrix_pt by using the SuperLU solver. The resulting matrix factors are stored internally.
References clean_up_memory(), oomph::CRDoubleMatrix::column_index(), oomph::CCMatrix< T >::column_start(), oomph::DistributableLinearAlgebraObject::distributed(), Doc_stats, i, m, n, oomph::DoubleMatrixBase::ncol(), oomph::SparseMatrix< T, MATRIX_TYPE >::nnz(), oomph::CRDoubleMatrix::nnz(), oomph::DoubleMatrixBase::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::CCMatrix< T >::row_index(), oomph::CRDoubleMatrix::row_start(), Serial_compressed_row_flag, Serial_f_factors, Serial_info, Serial_n_dof, Serial_sign_of_determinant_of_matrix, oomph::CumulativeTimings::start(), oomph::superlu(), anonymous_namespace{skew_symmetric_matrix3.cpp}::transpose(), Eigen::value, oomph::SparseMatrix< T, MATRIX_TYPE >::value(), and oomph::CRDoubleMatrix::value().
Referenced by factorise().
double oomph::SuperLUSolver::get_memory_usage_for_lu_factors | ( | ) |
How much memory do the LU factors take up? In bytes.
How much memory do the LU factors take up? In bytes NOTE: This has been scraped from dQuerySpace(...) in dmemory.c in external_src/oomph_superlu_4.3
References Distributed, oomph::get_lu_factor_memory_usage_in_bytes(), Serial_f_factors, and Solver_type.
Referenced by oomph::SuperLUPreconditioner::get_memory_usage_for_lu_factors(), and oomph::SuperLUPreconditioner::get_memory_usage_for_superlu().
double oomph::SuperLUSolver::get_total_needed_memory | ( | ) |
How much memory was allocated by SuperLU? In bytes.
How much memory was used in total? In bytes NOTE: This has been scraped from dQuerySpace(...) in dmemory.c in external_src/oomph_superlu_4.3
References Distributed, oomph::get_total_memory_usage_in_bytes(), Serial_f_factors, and Solver_type.
Referenced by oomph::SuperLUPreconditioner::get_memory_usage_for_superlu(), oomph::SuperLUPreconditioner::get_total_memory_needed_for_superlu(), solve(), and solve_transpose().
|
inlinevirtual |
returns the time taken to assemble the jacobian matrix and residual vector
Reimplemented from oomph::LinearSolver.
References Jacobian_setup_time.
|
inlinevirtual |
return the time taken to solve the linear system (needs to be overloaded for each linear solver)
Reimplemented from oomph::LinearSolver.
References Solution_time.
|
delete |
Broken assignment operator.
|
virtual |
Resolve the system for a given RHS.
Resolve the system defined by the last assembled jacobian and the specified rhs vector if resolve has been enabled. Note: returns the global result Vector.
Reimplemented from oomph::LinearSolver.
References backsub(), oomph::TimingHelpers::convert_secs_to_formatted_string(), oomph::LinearSolver::Doc_time, oomph::DistributableLinearAlgebraObject::nrow(), oomph::oomph_info, Solution_time, and oomph::TimingHelpers::timer().
Referenced by oomph::SuperLUPreconditioner::preconditioner_solve().
|
virtual |
Resolve the (transposed) system for a given RHS.
Resolve the (transposed) system defined by the last assembled Jacobian and the specified rhs vector if resolve has been enabled.
Reimplemented from oomph::LinearSolver.
References backsub_transpose(), oomph::TimingHelpers::convert_secs_to_formatted_string(), oomph::LinearSolver::Doc_time, oomph::DistributableLinearAlgebraObject::nrow(), oomph::oomph_info, Solution_time, and oomph::TimingHelpers::timer().
Referenced by oomph::SuperLUPreconditioner::preconditioner_solve_transpose().
|
inline |
Specify the solve type. Either default, serial or distributed. See enum SuperLU_solver_type for more details.
References clean_up_memory(), Solver_type, and plotPSD::t.
|
virtual |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. The function returns the global result Vector. Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memory() will be used to wipe the matrix data.
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. Problem pointer defaults to NULL and can be omitted. The function returns the global result Vector. Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memory() will be used to wipe the matrix data.
Reimplemented from oomph::LinearSolver.
References backsub(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), clean_up_memory(), oomph::TimingHelpers::convert_secs_to_formatted_string(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::LinearSolver::Enable_resolve, factorise(), get_total_needed_memory(), int(), oomph::DoubleMatrixBase::ncol(), oomph::CRDoubleMatrix::nnz(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::CRDoubleMatrix::nrow(), oomph::DoubleMatrixBase::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Solution_time, and oomph::TimingHelpers::timer().
|
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.
References oomph::DoubleVector::build(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), clean_up_memory(), oomph::Problem::communicator_pt(), oomph::LinearSolver::Compute_gradient, oomph::TimingHelpers::convert_secs_to_formatted_string(), Default, Distributed, oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::Problem::get_jacobian(), oomph::LinearSolver::Gradient_for_glob_conv_newton_solve, oomph::LinearSolver::Gradient_has_been_computed, Jacobian_setup_time, oomph::CRDoubleMatrix::multiply_transpose(), oomph::CCDoubleMatrix::multiply_transpose(), oomph::Problem::ndof(), oomph::OomphCommunicator::nproc(), oomph::oomph_info, oomph::DoubleVector::redistribute(), Serial_compressed_row_flag, Serial_sign_of_determinant_of_matrix, oomph::Problem::sign_of_jacobian(), Solver_type, Suppress_solve, and oomph::TimingHelpers::timer().
|
virtual |
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. The function returns the global result Vector. Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memory() will be used to wipe the matrix data.
Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system. Problem pointer defaults to NULL and can be omitted. The function returns the global result Vector. Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memory() will be used to wipe the matrix data.
Reimplemented from oomph::LinearSolver.
References backsub_transpose(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), clean_up_memory(), oomph::TimingHelpers::convert_secs_to_formatted_string(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::LinearSolver::Enable_resolve, factorise(), get_total_needed_memory(), int(), oomph::DoubleMatrixBase::ncol(), oomph::CRDoubleMatrix::nnz(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::CRDoubleMatrix::nrow(), oomph::DoubleMatrixBase::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Solution_time, and oomph::TimingHelpers::timer().
|
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.
Reimplemented from oomph::LinearSolver.
References oomph::DoubleVector::build(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), clean_up_memory(), oomph::Problem::communicator_pt(), oomph::LinearSolver::Compute_gradient, oomph::TimingHelpers::convert_secs_to_formatted_string(), Default, Distributed, oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::Problem::get_jacobian(), oomph::LinearSolver::Gradient_for_glob_conv_newton_solve, oomph::LinearSolver::Gradient_has_been_computed, Jacobian_setup_time, oomph::CRDoubleMatrix::multiply_transpose(), oomph::CCDoubleMatrix::multiply_transpose(), oomph::Problem::ndof(), oomph::OomphCommunicator::nproc(), oomph::oomph_info, oomph::DoubleVector::redistribute(), Serial_compressed_row_flag, Serial_sign_of_determinant_of_matrix, oomph::Problem::sign_of_jacobian(), Solver_type, Suppress_solve, and oomph::TimingHelpers::timer().
|
inline |
Use the compressed column format in superlu serial.
References Serial_compressed_row_flag.
|
inline |
Use the compressed row format in superlu serial.
References Serial_compressed_row_flag.
|
private |
Set to true to output statistics (false by default).
Referenced by backsub_serial(), backsub_transpose_serial(), clean_up_memory(), disable_doc_stats(), enable_doc_stats(), factorise_serial(), and SuperLUSolver().
|
private |
Jacobian setup time.
Referenced by jacobian_setup_time(), solve(), and solve_transpose().
|
private |
Use compressed row version?
Referenced by backsub_serial(), backsub_transpose_serial(), clean_up_memory(), factorise_serial(), solve(), solve_transpose(), SuperLUSolver(), use_compressed_column_for_superlu_serial(), and use_compressed_row_for_superlu_serial().
|
private |
Storage for the LU factors as required by SuperLU.
Referenced by backsub_serial(), backsub_transpose_serial(), clean_up_memory(), factorise_serial(), get_memory_usage_for_lu_factors(), and get_total_needed_memory().
|
private |
Info flag for the SuperLU solver.
Referenced by backsub_serial(), backsub_transpose_serial(), clean_up_memory(), and factorise_serial().
|
private |
The number of unknowns in the linear system.
Referenced by backsub_serial(), backsub_transpose_serial(), clean_up_memory(), factorise_serial(), and SuperLUSolver().
|
private |
Sign of the determinant of the matrix.
Referenced by factorise_serial(), solve(), solve_transpose(), and SuperLUSolver().
|
private |
Solution time.
Referenced by linear_solver_solution_time(), resolve(), resolve_transpose(), solve(), and solve_transpose().
|
private |
the solver type. see SuperLU_solver_type for details.
Referenced by factorise(), get_memory_usage_for_lu_factors(), get_total_needed_memory(), set_solver_type(), solve(), solve_transpose(), and SuperLUSolver().
|
private |
Suppress solve?
Referenced by solve(), solve_transpose(), and SuperLUSolver().
|
private |
boolean flag indicating whether superlu dist is being used
Referenced by backsub(), backsub_transpose(), factorise(), and SuperLUSolver().