![]() |
|
Wrapper to Mumps solver. More...
#include <mumps_solver.h>
Public Member Functions | |
MumpsSolver () | |
Constructor: Call setup. More... | |
MumpsSolver (const MumpsSolver &dummy)=delete | |
Broken copy constructor. More... | |
void | operator= (const MumpsSolver &)=delete |
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 () |
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 () |
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) |
void | solve (DoubleMatrixBase *const &matrix_pt, const DoubleVector &rhs, DoubleVector &result) |
void | resolve (const DoubleVector &rhs, DoubleVector &result) |
void | enable_doc_stats () |
Enable documentation of statistics. More... | |
void | disable_doc_stats () |
Disable documentation of statistics. More... | |
double | jacobian_setup_time () |
virtual double | linear_solver_solution_time () |
void | enable_suppress_solve () |
void | disable_suppress_solve () |
void | enable_delete_matrix_data () |
void | disable_delete_matrix_data () |
void | factorise (DoubleMatrixBase *const &matrix_pt) |
void | backsub (const DoubleVector &rhs, DoubleVector &result) |
void | clean_up_memory () |
Clean up the memory allocated by the mumps solver. More... | |
void | declare_jacobian_is_unsymmetric () |
Tell MUMPS that the Jacobian matrix is unsymmetric. More... | |
void | declare_jacobian_is_symmetric () |
Tell MUMPS that the Jacobian matrix is general symmetric. More... | |
void | declare_jacobian_is_symmetric_positive_definite () |
Tell MUMPS that the Jacobian matrix is symmetric positive-definite. More... | |
void | use_pord_ordering () |
void | use_metis_ordering () |
void | use_scotch_ordering () |
![]() | |
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 (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 double | jacobian_setup_time () const |
virtual double | linear_solver_solution_time () const |
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) |
Static Public Attributes | |
static bool | Suppress_incorrect_rhs_distribution_warning_in_resolve |
static int | Default_workspace_scaling_factor = 5 |
Private Types | |
enum | MumpsJacobianSymmetryFlags { Unsymmetric = 0 , Symmetric_positive_definite = 1 , Symmetric = 2 } |
enum | MumpsJacobianOrderingFlags { Scotch_ordering = 3 , Pord_ordering = 4 , Metis_ordering = 5 } |
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 |
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 |
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... | |
unsigned | Jacobian_symmetry_flag |
unsigned | Jacobian_ordering_flag |
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 |
Wrapper to Mumps solver.
|
private |
|
private |
oomph::MumpsSolver::MumpsSolver | ( | ) |
Constructor: Call setup.
|
delete |
Broken copy constructor.
oomph::MumpsSolver::~MumpsSolver | ( | ) |
Destructor: Cleanup.
Destructor: Shutdown mumps.
References shutdown_mumps().
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
References oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::built(), oomph::TimingHelpers::convert_secs_to_formatted_string(), oomph::DistributableLinearAlgebraObject::distribution_built(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, oomph::LinearSolver::Doc_time, j, Mumps_is_initialised, Mumps_struc_pt, n, oomph::LinearAlgebraDistribution::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::DoubleVector::redistribute(), Suppress_incorrect_rhs_distribution_warning_in_resolve, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
|
virtual |
Clean up the memory allocated by the mumps solver.
Clean up the memory allocated for the MumpsSolver solver.
Reimplemented from oomph::LinearSolver.
References shutdown_mumps().
Referenced by oomph::NewMumpsPreconditioner::clean_up_memory(), disable_resolve(), and solve().
|
inline |
Tell MUMPS that the Jacobian matrix is general symmetric.
References Jacobian_symmetry_flag, and Symmetric.
|
inline |
Tell MUMPS that the Jacobian matrix is symmetric positive-definite.
References Jacobian_symmetry_flag, and Symmetric_positive_definite.
|
inline |
Tell MUMPS that the Jacobian matrix is unsymmetric.
References Jacobian_symmetry_flag, and Unsymmetric.
|
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.
References Delete_matrix_data.
|
inline |
|
inlinevirtual |
Overload disable resolve so that it cleans up memory too.
Reimplemented from oomph::LinearSolver.
References clean_up_memory(), and oomph::LinearSolver::disable_resolve().
|
inline |
Don't suppress info being printed to screen during MUMPS solve.
References Suppress_mumps_info_during_solve.
|
inline |
Unset the flag so that the system is actually solved again This is the default (obviously)
References Suppress_solve.
|
inline |
Don't suppress warning about communicator not equal to MPI_COMM_WORLD.
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.
References Delete_matrix_data.
|
inline |
|
inline |
Set boolean to suppress info being printed to screen during MUMPS solve
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)
References Suppress_solve.
|
inline |
Set boolean to suppress warning about communicator not equal to MPI_COMM_WORLD
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.
References A_loc, oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::CRDoubleMatrix::built(), oomph::CRDoubleMatrix::clear(), oomph::CRDoubleMatrix::column_index(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::TimingHelpers::convert_secs_to_formatted_string(), Delete_matrix_data, oomph::DistributableLinearAlgebraObject::distributed(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, oomph::LinearSolver::Doc_time, oomph::DistributableLinearAlgebraObject::first_row(), initialise_mumps(), int(), Irn_loc, Jcn_loc, m, Mumps_is_initialised, Mumps_struc_pt, oomph::OomphCommunicator::my_rank(), n, oomph::DoubleMatrixBase::ncol(), oomph::CRDoubleMatrix::nnz(), oomph::OomphCommunicator::nproc(), oomph::DoubleMatrixBase::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, 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 oomph::NewMumpsPreconditioner::setup(), and solve().
|
private |
Initialise instance of mumps data structure.
References Jacobian_ordering_flag, Jacobian_symmetry_flag, Mumps_is_initialised, and Mumps_struc_pt.
Referenced by factorise().
|
inline |
Returns the time taken to assemble the Jacobian matrix and residual vector
References Jacobian_setup_time.
|
inlinevirtual |
Return the time taken to solve the linear system (needs to be overloaded for each linear solver)
References Solution_time.
|
delete |
Broken assignment operator.
|
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.
References backsub(), oomph::TimingHelpers::convert_secs_to_formatted_string(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Doc_stats, oomph::LinearSolver::Doc_time, Mumps_struc_pt, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Solution_time, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
Referenced by oomph::NewMumpsPreconditioner::preconditioner_solve().
|
private |
Shutdown mumps.
References A_loc, Irn_loc, Jcn_loc, Mumps_is_initialised, and Mumps_struc_pt.
Referenced by clean_up_memory(), factorise(), and ~MumpsSolver().
|
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.
References backsub(), oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DoubleVector::built(), oomph::LinearAlgebraDistribution::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(), Mumps_struc_pt, oomph::DoubleMatrixBase::ncol(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::DoubleMatrixBase::nrow(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, Solution_time, Suppress_warning_about_MPI_COMM_WORLD, 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::LinearAlgebraDistribution::build(), oomph::DoubleVector::built(), oomph::Problem::communicator_pt(), oomph::LinearAlgebraDistribution::communicator_pt(), oomph::TimingHelpers::convert_secs_to_formatted_string(), Delete_matrix_data, oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::LinearSolver::Doc_time, oomph::Problem::get_jacobian(), Jacobian_setup_time, oomph::OomphCommunicator::my_rank(), oomph::Problem::ndof(), oomph::OomphCommunicator::nproc(), OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, oomph::DoubleVector::redistribute(), Suppress_solve, Suppress_warning_about_MPI_COMM_WORLD, and oomph::TimingHelpers::timer().
|
inline |
References Jacobian_ordering_flag, and Metis_ordering.
|
inline |
References Jacobian_ordering_flag, and Pord_ordering.
|
inline |
References Jacobian_ordering_flag, and Scotch_ordering.
Referenced by factorise(), and shutdown_mumps().
|
static |
Default factor for workspace – static so it can be overwritten globally.
/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// Default factor for workspace – static so it can be overwritten globally.
|
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.
Referenced by disable_delete_matrix_data(), enable_delete_matrix_data(), factorise(), and solve().
|
private |
Set to true for MumpsSolver to output statistics (false by default).
Referenced by backsub(), disable_doc_stats(), enable_doc_stats(), factorise(), and resolve().
Vector for row numbers.
Referenced by factorise(), and shutdown_mumps().
|
private |
stores an integer from the public enum which specifies which package (PORD, Metis or SCOTCH) is used to reorder the Jacobian matrix during the analysis
Referenced by initialise_mumps(), use_metis_ordering(), use_pord_ordering(), and use_scotch_ordering().
|
private |
Jacobian setup time.
Referenced by jacobian_setup_time(), and solve().
|
private |
symmetry of the Jacobian matrix we're solving; takes one of the enum values above
Referenced by declare_jacobian_is_symmetric(), declare_jacobian_is_symmetric_positive_definite(), declare_jacobian_is_unsymmetric(), and initialise_mumps().
Referenced by factorise(), and shutdown_mumps().
|
private |
Has mumps been initialised?
Referenced by backsub(), factorise(), initialise_mumps(), and shutdown_mumps().
|
private |
Pointer to MUMPS struct that contains the solver data.
Referenced by backsub(), factorise(), initialise_mumps(), resolve(), shutdown_mumps(), and solve().
|
private |
Solution time.
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
Referenced by backsub().
|
private |
Boolean to suppress info being printed to screen during MUMPS solve.
Referenced by disable_suppress_mumps_info_during_solve(), enable_suppress_mumps_info_during_solve(), and factorise().
|
private |
Suppress solve?
Referenced by disable_suppress_solve(), enable_suppress_solve(), and solve().
|
private |
Boolean to suppress warning about communicator not equal to MPI_COMM_WORLD
Referenced by backsub(), disable_suppress_warning_about_MPI_COMM_WORLD(), enable_suppress_warning_about_MPI_COMM_WORLD(), factorise(), resolve(), and solve().
|
private |
Referenced by factorise().