Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | List of all members
oomph::MumpsSolver Class Reference

Wrapper to Mumps solver. More...

#include <mumps_solver.h>

+ Inheritance diagram for oomph::MumpsSolver:

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...
 
- Public Member Functions inherited from oomph::LinearSolver
 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...
 
- Public Member Functions inherited from oomph::DistributableLinearAlgebraObject
 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...
 
LinearAlgebraDistributiondistribution_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

- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 clear the distribution of this distributable linear algebra object More...
 
- 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. 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...
 

Detailed Description

Wrapper to Mumps solver.

Definition at line 60 of file mumps_solver.h.

Constructor & Destructor Documentation

oomph::MumpsSolver::MumpsSolver ( )
oomph::MumpsSolver::MumpsSolver ( const MumpsSolver dummy)
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().

Member Function Documentation

void oomph::MumpsSolver::backsub ( const DoubleVector rhs,
DoubleVector result 
)
void oomph::MumpsSolver::clean_up_memory ( )
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 oomph::NewMumpsPreconditioner::clean_up_memory(), disable_resolve(), and solve().

void oomph::MumpsSolver::disable_delete_matrix_data ( )
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 Delete_matrix_data.

void oomph::MumpsSolver::disable_doc_stats ( )
inline

Disable documentation of statistics.

Definition at line 135 of file mumps_solver.h.

References Doc_stats.

void oomph::MumpsSolver::disable_resolve ( )
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().

void oomph::MumpsSolver::disable_suppress_mumps_info_during_solve ( )
inline

Don't suppress info being printed to screen during MUMPS solve.

Definition at line 109 of file mumps_solver.h.

References Suppress_mumps_info_during_solve.

void oomph::MumpsSolver::disable_suppress_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.

void oomph::MumpsSolver::disable_suppress_warning_about_MPI_COMM_WORLD ( )
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.

void oomph::MumpsSolver::enable_delete_matrix_data ( )
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.

void oomph::MumpsSolver::enable_doc_stats ( )
inline

Enable documentation of statistics.

Definition at line 132 of file mumps_solver.h.

References Doc_stats.

void oomph::MumpsSolver::enable_suppress_mumps_info_during_solve ( )
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.

void oomph::MumpsSolver::enable_suppress_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.

void oomph::MumpsSolver::enable_suppress_warning_about_MPI_COMM_WORLD ( )
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)
void oomph::MumpsSolver::initialise_mumps ( )
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().

double oomph::MumpsSolver::jacobian_setup_time ( )
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.

virtual double oomph::MumpsSolver::linear_solver_solution_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.

void oomph::MumpsSolver::operator= ( const MumpsSolver )
inline

Broken assignment operator.

Definition at line 79 of file mumps_solver.h.

References oomph::BrokenCopy::broken_assign().

void oomph::MumpsSolver::resolve ( const DoubleVector rhs,
DoubleVector result 
)
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 oomph::NewMumpsPreconditioner::preconditioner_solve().

void oomph::MumpsSolver::shutdown_mumps ( )
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().

void oomph::MumpsSolver::solve ( Problem *const &  problem_pt,
DoubleVector result 
)
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().

void oomph::MumpsSolver::solve ( DoubleMatrixBase *const &  matrix_pt,
const DoubleVector rhs,
DoubleVector result 
)
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().

Member Data Documentation

Vector<double> oomph::MumpsSolver::A_loc
private

Definition at line 240 of file mumps_solver.h.

Referenced by factorise(), and shutdown_mumps().

int oomph::MumpsSolver::Default_workspace_scaling_factor =5
static

Default factor for workspace – static so it can be overwritten globally.

Definition at line 191 of file mumps_solver.h.

Referenced by MumpsSolver().

bool oomph::MumpsSolver::Delete_matrix_data
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().

bool oomph::MumpsSolver::Doc_stats
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().

Vector<int> oomph::MumpsSolver::Irn_loc
private

Vector for row numbers.

Definition at line 234 of file mumps_solver.h.

Referenced by factorise(), and shutdown_mumps().

double oomph::MumpsSolver::Jacobian_setup_time
private

Jacobian setup time.

Definition at line 202 of file mumps_solver.h.

Referenced by jacobian_setup_time(), and solve().

Vector<int> oomph::MumpsSolver::Jcn_loc
private

Definition at line 237 of file mumps_solver.h.

Referenced by factorise(), and shutdown_mumps().

bool oomph::MumpsSolver::Mumps_is_initialised
private

Has mumps been initialised?

Definition at line 220 of file mumps_solver.h.

Referenced by backsub(), factorise(), initialise_mumps(), MumpsSolver(), and shutdown_mumps().

DMUMPS_STRUC_C* oomph::MumpsSolver::Mumps_struc_pt
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().

double oomph::MumpsSolver::Solution_time
private

Solution time.

Definition at line 205 of file mumps_solver.h.

Referenced by linear_solver_solution_time(), resolve(), and solve().

bool oomph::MumpsSolver::Suppress_incorrect_rhs_distribution_warning_in_resolve =false
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().

bool oomph::MumpsSolver::Suppress_mumps_info_during_solve
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().

bool oomph::MumpsSolver::Suppress_solve
private

Suppress solve?

Definition at line 208 of file mumps_solver.h.

Referenced by disable_suppress_solve(), enable_suppress_solve(), MumpsSolver(), and solve().

bool oomph::MumpsSolver::Suppress_warning_about_MPI_COMM_WORLD
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().

unsigned oomph::MumpsSolver::Workspace_scaling_factor
private

Definition at line 223 of file mumps_solver.h.

Referenced by factorise(), and MumpsSolver().


The documentation for this class was generated from the following files: