Wrapper to Mumps solver. More...
#include <mumps_solver.h>
Public Member Functions | |
MumpsSolver () | |
Constructor: Call setup. More... | |
MumpsSolver (const MumpsSolver &dummy) | |
Broken copy constructor. More... | |
void | operator= (const MumpsSolver &) |
Broken assignment operator. More... | |
~MumpsSolver () | |
Destructor: Cleanup. More... | |
void | disable_resolve () |
Overload disable resolve so that it cleans up memory too. More... | |
void | enable_suppress_warning_about_MPI_COMM_WORLD () |
Set boolean to suppress warning about communicator not equal to MPI_COMM_WORLD. More... | |
void | disable_suppress_warning_about_MPI_COMM_WORLD () |
Don't suppress warning about communicator not equal to MPI_COMM_WORLD. More... | |
void | enable_suppress_mumps_info_during_solve () |
Set boolean to suppress info being printed to screen during MUMPS solve. More... | |
void | disable_suppress_mumps_info_during_solve () |
Don't suppress info being printed to screen during MUMPS solve. 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 &result) |
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. More... | |
void | resolve (const DoubleVector &rhs, DoubleVector &result) |
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. More... | |
void | enable_doc_stats () |
Enable documentation of statistics. More... | |
void | disable_doc_stats () |
Disable documentation of statistics. More... | |
double | jacobian_setup_time () |
Returns the time taken to assemble the Jacobian matrix and residual vector. More... | |
virtual double | linear_solver_solution_time () |
Return the time taken to solve the linear system (needs to be overloaded for each linear solver) More... | |
void | enable_suppress_solve () |
Set the flag to avoid solution of the system, so just assemble the Jacobian and the rhs. (Used only for timing runs, obviously) More... | |
void | disable_suppress_solve () |
Unset the flag so that the system is actually solved again This is the default (obviously) More... | |
void | enable_delete_matrix_data () |
Set Delete_matrix_data flag. MumpsSolver needs its own copy of the input matrix, therefore a copy must be made if any matrix used with this solver is to be preserved. If the input matrix can be deleted the flag can be set to true to reduce the amount of memory required, and the matrix data will be wiped using its clean_up_memory() function. Default value is false. More... | |
void | disable_delete_matrix_data () |
Unset Delete_matrix_data flag. MumpsSolver needs its own copy of the input matrix, therefore a copy must be made if any matrix used with this solver is to be preserved. If the input matrix can be deleted the flag can be set to true to reduce the amount of memory required, and the matrix data will be wiped using its clean_up_memory() function. Default value is false. More... | |
void | 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. More... | |
void | backsub (const DoubleVector &rhs, DoubleVector &result) |
Do the backsubstitution for mumps solver Note: returns the global result Vector. More... | |
void | clean_up_memory () |
Clean up the memory allocated by the mumps solver. More... | |
![]() | |
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 | 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 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... | |
![]() | |
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... | |
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) |
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... | |
Static Public Attributes | |
static bool | Suppress_incorrect_rhs_distribution_warning_in_resolve =false |
Static flag that determines whether the warning about incorrect distribution of RHSs will be printed or not. More... | |
static int | Default_workspace_scaling_factor =5 |
Default factor for workspace – static so it can be overwritten globally. More... | |
Private Member Functions | |
void | initialise_mumps () |
Initialise instance of mumps data structure. More... | |
void | shutdown_mumps () |
Shutdown mumps. 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 for MumpsSolver to output statistics (false by default). More... | |
bool | Suppress_warning_about_MPI_COMM_WORLD |
Boolean to suppress warning about communicator not equal to MPI_COMM_WORLD. More... | |
bool | Suppress_mumps_info_during_solve |
Boolean to suppress info being printed to screen during MUMPS solve. More... | |
bool | Mumps_is_initialised |
Has mumps been initialised? More... | |
unsigned | Workspace_scaling_factor |
bool | Delete_matrix_data |
Delete_matrix_data flag. MumpsSolver needs its own copy of the input matrix, therefore a copy must be made if any matrix used with this solver is to be preserved. If the input matrix can be deleted the flag can be set to true to reduce the amount of memory required, and the matrix data will be wiped using its clean_up_memory() function. Default value is false. More... | |
Vector< int > | Irn_loc |
Vector for row numbers. More... | |
Vector< int > | Jcn_loc |
Vector< double > | A_loc |
DMUMPS_STRUC_C * | Mumps_struc_pt |
Pointer to MUMPS struct that contains the solver data. More... | |
Additional Inherited Members | |
![]() | |
void | clear_distribution () |
clear the distribution of this distributable linear algebra object More... | |
![]() | |
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... | |
Wrapper to Mumps solver.
Definition at line 60 of file mumps_solver.h.
oomph::MumpsSolver::MumpsSolver | ( | ) |
Constructor: Call setup.
Definition at line 77 of file mumps_solver.cc.
References Default_workspace_scaling_factor, Delete_matrix_data, Doc_stats, Mumps_is_initialised, Mumps_struc_pt, Suppress_mumps_info_during_solve, Suppress_solve, Suppress_warning_about_MPI_COMM_WORLD, and Workspace_scaling_factor.
|
inline |
Broken copy constructor.
Definition at line 73 of file mumps_solver.h.
References oomph::BrokenCopy::broken_copy().
oomph::MumpsSolver::~MumpsSolver | ( | ) |
Destructor: Cleanup.
Destructor: Shutdown mumps.
Definition at line 174 of file mumps_solver.cc.
References shutdown_mumps().
Referenced by operator=().
void oomph::MumpsSolver::backsub | ( | const DoubleVector & | rhs, |
DoubleVector & | result | ||
) |
Do the backsubstitution for mumps solver Note: returns the global result Vector.
Do the backsubstitution for mumps solver. This does not make any assumption about the distribution of the vectors
Definition at line 487 of file mumps_solver.cc.
References oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::built(), oomph::DistributableLinearAlgebraObject::distribution_built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, oomph::LinearSolver::Doc_time, Mumps_is_initialised, Mumps_struc_pt, oomph::LinearAlgebraDistribution::nrow(), oomph::oomph_info, oomph::DoubleVector::redistribute(), Suppress_incorrect_rhs_distribution_warning_in_resolve, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
Referenced by disable_delete_matrix_data(), resolve(), and solve().
|
virtual |
Clean up the memory allocated by the mumps solver.
Clean up the memory allocated for the MumpsSolver solver.
Reimplemented from oomph::LinearSolver.
Definition at line 663 of file mumps_solver.cc.
References shutdown_mumps().
Referenced by disable_delete_matrix_data(), disable_resolve(), and solve().
|
inline |
Unset Delete_matrix_data flag. MumpsSolver needs its own copy of the input matrix, therefore a copy must be made if any matrix used with this solver is to be preserved. If the input matrix can be deleted the flag can be set to true to reduce the amount of memory required, and the matrix data will be wiped using its clean_up_memory() function. Default value is false.
Definition at line 174 of file mumps_solver.h.
References backsub(), clean_up_memory(), Delete_matrix_data, and factorise().
|
inline |
Disable documentation of statistics.
Definition at line 135 of file mumps_solver.h.
References Doc_stats.
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
Definition at line 88 of file mumps_solver.h.
References clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inline |
Don't suppress info being printed to screen during MUMPS solve.
Definition at line 109 of file mumps_solver.h.
References resolve(), solve(), and Suppress_mumps_info_during_solve.
|
inline |
Unset the flag so that the system is actually solved again This is the default (obviously)
Definition at line 158 of file mumps_solver.h.
References Suppress_solve.
|
inline |
Don't suppress warning about communicator not equal to MPI_COMM_WORLD.
Definition at line 100 of file mumps_solver.h.
References Suppress_warning_about_MPI_COMM_WORLD.
|
inline |
Set Delete_matrix_data flag. MumpsSolver needs its own copy of the input matrix, therefore a copy must be made if any matrix used with this solver is to be preserved. If the input matrix can be deleted the flag can be set to true to reduce the amount of memory required, and the matrix data will be wiped using its clean_up_memory() function. Default value is false.
Definition at line 166 of file mumps_solver.h.
References Delete_matrix_data.
|
inline |
Enable documentation of statistics.
Definition at line 132 of file mumps_solver.h.
References Doc_stats.
|
inline |
Set boolean to suppress info being printed to screen during MUMPS solve.
Definition at line 105 of file mumps_solver.h.
References Suppress_mumps_info_during_solve.
|
inline |
Set the flag to avoid solution of the system, so just assemble the Jacobian and the rhs. (Used only for timing runs, obviously)
Definition at line 154 of file mumps_solver.h.
References Suppress_solve.
|
inline |
Set boolean to suppress warning about communicator not equal to MPI_COMM_WORLD.
Definition at line 96 of file mumps_solver.h.
References Suppress_warning_about_MPI_COMM_WORLD.
void oomph::MumpsSolver::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 using mumps. The resulting matrix factors are stored internally. Note: if Delete_matrix_data is true the function matrix_pt->clean_up_memory() will be used to wipe the matrix data.
Definition at line 186 of file mumps_solver.cc.
References A_loc, oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::CRDoubleMatrix::built(), oomph::CRDoubleMatrix::clear(), oomph::CRDoubleMatrix::column_index(), oomph::LinearAlgebraDistribution::communicator_pt(), Delete_matrix_data, oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, oomph::LinearSolver::Doc_time, oomph::DistributableLinearAlgebraObject::first_row(), initialise_mumps(), Irn_loc, Jcn_loc, Mumps_is_initialised, Mumps_struc_pt, oomph::DoubleMatrixBase::ncol(), oomph::CRDoubleMatrix::nnz(), oomph::DoubleMatrixBase::nrow(), oomph::oomph_info, oomph::CRDoubleMatrix::row_start(), shutdown_mumps(), Suppress_mumps_info_during_solve, Suppress_warning_about_MPI_COMM_WORLD, oomph::TimingHelpers::timer(), oomph::CRDoubleMatrix::value(), and Workspace_scaling_factor.
Referenced by disable_delete_matrix_data(), and solve().
|
private |
Initialise instance of mumps data structure.
Definition at line 93 of file mumps_solver.cc.
References Mumps_is_initialised, and Mumps_struc_pt.
Referenced by factorise().
|
inline |
Returns the time taken to assemble the Jacobian matrix and residual vector.
Definition at line 139 of file mumps_solver.h.
References Jacobian_setup_time.
|
inlinevirtual |
Return the time taken to solve the linear system (needs to be overloaded for each linear solver)
Definition at line 146 of file mumps_solver.h.
References Solution_time.
|
inline |
Broken assignment operator.
Definition at line 79 of file mumps_solver.h.
References oomph::BrokenCopy::broken_assign(), and ~MumpsSolver().
|
virtual |
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.
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.
Definition at line 950 of file mumps_solver.cc.
References backsub(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, oomph::LinearSolver::Doc_time, Mumps_struc_pt, oomph::oomph_info, Solution_time, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
Referenced by disable_suppress_mumps_info_during_solve().
|
private |
Shutdown mumps.
Definition at line 145 of file mumps_solver.cc.
References A_loc, Irn_loc, Jcn_loc, Mumps_is_initialised, and Mumps_struc_pt.
Referenced by clean_up_memory(), factorise(), and ~MumpsSolver().
|
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.
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 845 of file mumps_solver.cc.
References oomph::DoubleVector::build(), oomph::LinearAlgebraDistribution::build(), oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::Problem::communicator_pt(), Delete_matrix_data, oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::Problem::get_jacobian(), Jacobian_setup_time, oomph::Problem::ndof(), oomph::oomph_info, oomph::DoubleVector::redistribute(), Suppress_solve, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
Referenced by disable_suppress_mumps_info_during_solve().
|
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. Matrix must be CRDoubleMatrix. 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.
Definition at line 677 of file mumps_solver.cc.
References backsub(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::built(), clean_up_memory(), oomph::LinearAlgebraDistribution::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::LinearSolver::Enable_resolve, factorise(), Mumps_struc_pt, oomph::DoubleMatrixBase::ncol(), oomph::DoubleMatrixBase::nrow(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::oomph_info, Solution_time, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
|
private |
Definition at line 240 of file mumps_solver.h.
Referenced by factorise(), and shutdown_mumps().
|
static |
Default factor for workspace – static so it can be overwritten globally.
Definition at line 191 of file mumps_solver.h.
Referenced by MumpsSolver().
|
private |
Delete_matrix_data flag. MumpsSolver needs its own copy of the input matrix, therefore a copy must be made if any matrix used with this solver is to be preserved. If the input matrix can be deleted the flag can be set to true to reduce the amount of memory required, and the matrix data will be wiped using its clean_up_memory() function. Default value is false.
Definition at line 231 of file mumps_solver.h.
Referenced by disable_delete_matrix_data(), enable_delete_matrix_data(), factorise(), MumpsSolver(), and solve().
|
private |
Set to true for MumpsSolver to output statistics (false by default).
Definition at line 211 of file mumps_solver.h.
Referenced by backsub(), disable_doc_stats(), enable_doc_stats(), factorise(), MumpsSolver(), and resolve().
|
private |
Vector for row numbers.
Definition at line 234 of file mumps_solver.h.
Referenced by factorise(), and shutdown_mumps().
|
private |
Jacobian setup time.
Definition at line 202 of file mumps_solver.h.
Referenced by jacobian_setup_time(), and solve().
|
private |
Definition at line 237 of file mumps_solver.h.
Referenced by factorise(), and shutdown_mumps().
|
private |
Has mumps been initialised?
Definition at line 220 of file mumps_solver.h.
Referenced by backsub(), factorise(), initialise_mumps(), MumpsSolver(), and shutdown_mumps().
|
private |
Pointer to MUMPS struct that contains the solver data.
Definition at line 243 of file mumps_solver.h.
Referenced by backsub(), factorise(), initialise_mumps(), MumpsSolver(), resolve(), shutdown_mumps(), and solve().
|
private |
Solution time.
Definition at line 205 of file mumps_solver.h.
Referenced by linear_solver_solution_time(), resolve(), and solve().
|
static |
Static flag that determines whether the warning about incorrect distribution of RHSs will be printed or not.
Static warning to suppress warnings about incorrect distribution of RHS vector. Default is false
Definition at line 67 of file mumps_solver.h.
Referenced by backsub().
|
private |
Boolean to suppress info being printed to screen during MUMPS solve.
Definition at line 217 of file mumps_solver.h.
Referenced by disable_suppress_mumps_info_during_solve(), enable_suppress_mumps_info_during_solve(), factorise(), and MumpsSolver().
|
private |
Suppress solve?
Definition at line 208 of file mumps_solver.h.
Referenced by disable_suppress_solve(), enable_suppress_solve(), MumpsSolver(), and solve().
|
private |
Boolean to suppress warning about communicator not equal to MPI_COMM_WORLD.
Definition at line 214 of file mumps_solver.h.
Referenced by backsub(), disable_suppress_warning_about_MPI_COMM_WORLD(), enable_suppress_warning_about_MPI_COMM_WORLD(), factorise(), MumpsSolver(), resolve(), and solve().
|
private |
Definition at line 223 of file mumps_solver.h.
Referenced by factorise(), and MumpsSolver().