Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
oomph::DenseLU Class Reference

Dense LU decomposition-based solve of full assembled linear system. VERY inefficient but useful to illustrate the principle. Only suitable for use with Serial matrices and vectors. This solver will only work with non-distributed matrices and vectors (note: DenseDoubleMatrix is not distributable) More...

#include <linear_solver.h>

+ Inheritance diagram for oomph::DenseLU:

Public Member Functions

 DenseLU ()
 Constructor, initialise storage. More...
 
 DenseLU (const DenseLU &dummy)
 Broken copy constructor. More...
 
void operator= (const DenseLU &)
 Broken assignment operator. More...
 
 ~DenseLU ()
 Destructor, clean up the stored LU factors. 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. More...
 
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...
 
double jacobian_setup_time () const
 returns the time taken to assemble the jacobian matrix and residual vector 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...
 
- 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 disable_resolve ()
 Disable resolve (i.e. store matrix and/or LU decomposition, say) This function simply resets an internal flag. It's virtual so it can be overloaded to perform additional tasks such as cleaning up memory that is only required for the resolve. More...
 
virtual void resolve (const DoubleVector &rhs, DoubleVector &result)
 Resolve the system defined by the last assembled jacobian and the rhs vector. Solution is returned in the vector result. (broken virtual) 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...
 

Protected Member Functions

void factorise (DoubleMatrixBase *const &matrix_pt)
 Perform the LU decomposition of the matrix. More...
 
void backsub (const DoubleVector &rhs, DoubleVector &result)
 Do the backsubstitution step to solve the system LU result = rhs. More...
 
void backsub (const Vector< double > &rhs, Vector< double > &result)
 perform back substitution using Vector<double> More...
 
void clean_up_memory ()
 Clean up the stored LU factors. More...
 
- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 clear the distribution of this distributable linear algebra object More...
 

Protected Attributes

double Jacobian_setup_time
 Jacobian setup time. More...
 
double Solution_time
 Solution time. More...
 
int Sign_of_determinant_of_matrix
 Sign of the determinant of the matrix (obtained during the LU decomposition) 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...
 

Private Attributes

long * Index
 Pointer to storage for the index of permutations in the LU solve. More...
 
double * LU_factors
 Pointer to storage for the LU decomposition. More...
 

Friends

class DenseDoubleMatrix
 The DenseDoubleMatrix class is a friend. More...
 

Detailed Description

Dense LU decomposition-based solve of full assembled linear system. VERY inefficient but useful to illustrate the principle. Only suitable for use with Serial matrices and vectors. This solver will only work with non-distributed matrices and vectors (note: DenseDoubleMatrix is not distributable)

Definition at line 261 of file linear_solver.h.

Constructor & Destructor Documentation

oomph::DenseLU::DenseLU ( )
inline

Constructor, initialise storage.

Definition at line 269 of file linear_solver.h.

References oomph::LinearSolver::Doc_time.

oomph::DenseLU::DenseLU ( const DenseLU dummy)
inline

Broken copy constructor.

Definition at line 279 of file linear_solver.h.

References oomph::BrokenCopy::broken_copy().

oomph::DenseLU::~DenseLU ( )
inline

Destructor, clean up the stored LU factors.

Definition at line 291 of file linear_solver.h.

References clean_up_memory().

Member Function Documentation

void oomph::DenseLU::backsub ( const DoubleVector rhs,
DoubleVector result 
)
protected

Do the backsubstitution step to solve the system LU result = rhs.

Do the backsubstitution for the DenseLU solver. WARNING: this class does not perform any PARANOID checks on the vectors - these are all performed in the solve(...) method.

Definition at line 313 of file linear_solver.cc.

References i, Index, LU_factors, oomph::DistributableLinearAlgebraObject::nrow(), and oomph::DoubleVector::values_pt().

Referenced by solve().

void oomph::DenseLU::backsub ( const Vector< double > &  rhs,
Vector< double > &  result 
)
protected

perform back substitution using Vector<double>

Do the backsubstitution for the DenseLU solver. WARNING: this class does not perform any PARANOID checks on the vectors - these are all performed in the solve(...) method. So, if you call backsub directly, you have been warned...

Definition at line 366 of file linear_solver.cc.

References i, Index, and LU_factors.

void oomph::DenseLU::clean_up_memory ( )
protectedvirtual

Clean up the stored LU factors.

Delete the storage that has been allocated for the LU factors, if the matrix data is not itself being overwritten.

Reimplemented from oomph::LinearSolver.

Definition at line 107 of file linear_solver.cc.

References oomph::DistributableLinearAlgebraObject::clear_distribution(), Index, and LU_factors.

Referenced by factorise(), solve(), and ~DenseLU().

void oomph::DenseLU::factorise ( DoubleMatrixBase *const &  matrix_pt)
protected

Perform the LU decomposition of the matrix.

LU decompose the matrix. WARNING: this class does not perform any PARANOID checks on the vectors - these are all performed in the solve(...) method.

Definition at line 132 of file linear_solver.cc.

References clean_up_memory(), i, Index, LU_factors, oomph::DoubleMatrixBase::nrow(), and Sign_of_determinant_of_matrix.

Referenced by solve().

double oomph::DenseLU::jacobian_setup_time ( ) const
inlinevirtual

returns the time taken to assemble the jacobian matrix and residual vector

Reimplemented from oomph::LinearSolver.

Definition at line 310 of file linear_solver.h.

References Jacobian_setup_time.

virtual double oomph::DenseLU::linear_solver_solution_time ( ) const
inlinevirtual

return the time taken to solve the linear system (needs to be overloaded for each linear solver)

Reimplemented from oomph::LinearSolver.

Definition at line 317 of file linear_solver.h.

References Solution_time.

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

Broken assignment operator.

Definition at line 285 of file linear_solver.h.

References oomph::BrokenCopy::broken_assign().

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

Reimplemented in oomph::FD_LU.

Definition at line 57 of file linear_solver.cc.

References oomph::LinearSolver::Doc_time, oomph::Problem::get_jacobian(), Jacobian_setup_time, oomph::Problem::ndof(), oomph::oomph_info, Sign_of_determinant_of_matrix, oomph::Problem::sign_of_jacobian(), and oomph::TimingHelpers::timer().

Referenced by oomph::FD_LU::solve().

void oomph::DenseLU::solve ( DoubleMatrixBase *const &  matrix_pt,
const DoubleVector rhs,
DoubleVector result 
)
virtual
void oomph::DenseLU::solve ( DoubleMatrixBase *const &  matrix_pt,
const Vector< double > &  rhs,
Vector< double > &  result 
)
virtual

Linear-algebra-type solver: Takes pointer to a matrix and rhs vector and returns the solution of the linear system.

Reimplemented from oomph::LinearSolver.

Reimplemented in oomph::FD_LU.

Definition at line 529 of file linear_solver.cc.

References backsub(), clean_up_memory(), oomph::LinearSolver::Doc_time, oomph::LinearSolver::Enable_resolve, factorise(), oomph::oomph_info, and Solution_time.

Friends And Related Function Documentation

friend class DenseDoubleMatrix
friend

The DenseDoubleMatrix class is a friend.

Definition at line 264 of file linear_solver.h.

Member Data Documentation

long* oomph::DenseLU::Index
private

Pointer to storage for the index of permutations in the LU solve.

Definition at line 350 of file linear_solver.h.

Referenced by backsub(), clean_up_memory(), and factorise().

double oomph::DenseLU::Jacobian_setup_time
protected

Jacobian setup time.

Definition at line 338 of file linear_solver.h.

Referenced by jacobian_setup_time(), solve(), and oomph::FD_LU::solve().

double* oomph::DenseLU::LU_factors
private

Pointer to storage for the LU decomposition.

Definition at line 353 of file linear_solver.h.

Referenced by backsub(), clean_up_memory(), and factorise().

int oomph::DenseLU::Sign_of_determinant_of_matrix
protected

Sign of the determinant of the matrix (obtained during the LU decomposition)

Definition at line 345 of file linear_solver.h.

Referenced by factorise(), solve(), and oomph::FD_LU::solve().

double oomph::DenseLU::Solution_time
protected

Solution time.

Definition at line 341 of file linear_solver.h.

Referenced by linear_solver_solution_time(), and solve().


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