oomph::SuperLUPreconditioner Class Reference

An interface to allow SuperLU to be used as an (exact) Preconditioner. More...

#include <SuperLU_preconditioner.h>

+ Inheritance diagram for oomph::SuperLUPreconditioner:

Public Member Functions

 SuperLUPreconditioner ()
 Constructor. More...
 
 ~SuperLUPreconditioner ()
 Destructor. More...
 
 SuperLUPreconditioner (const SuperLUPreconditioner &)=delete
 Broken copy constructor. More...
 
void operator= (const SuperLUPreconditioner &)=delete
 Broken assignment operator. More...
 
void setup ()
 
void preconditioner_solve (const DoubleVector &r, DoubleVector &z)
 
void preconditioner_solve_transpose (const DoubleVector &r, DoubleVector &z)
 
virtual void clean_up_memory ()
 
double get_memory_usage_for_lu_factors ()
 Get the amount of memory used to store the LU factors inside SuperLU. More...
 
double get_total_memory_needed_for_superlu ()
 
Vector< doubleget_memory_usage_for_superlu ()
 
void enable_doc_stats ()
 Enable documentation of solver statistics. More...
 
void disable_doc_stats ()
 Enable documentation of solver statistics. More...
 
- Public Member Functions inherited from oomph::Preconditioner
 Preconditioner ()
 Constructor. More...
 
 Preconditioner (const Preconditioner &)=delete
 Broken copy constructor. More...
 
void operator= (const Preconditioner &)=delete
 Broken assignment operator. More...
 
virtual ~Preconditioner ()
 Destructor (empty) More...
 
void setup (DoubleMatrixBase *matrix_pt)
 
void setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt)
 
void enable_silent_preconditioner_setup ()
 Set up the block preconditioner quietly! More...
 
void disable_silent_preconditioner_setup ()
 Be verbose in the block preconditioner setup. More...
 
virtual DoubleMatrixBasematrix_pt () const
 Get function for matrix pointer. More...
 
virtual void set_matrix_pt (DoubleMatrixBase *matrix_pt)
 Set the matrix pointer. More...
 
virtual const OomphCommunicatorcomm_pt () const
 Get function for comm pointer. More...
 
virtual void set_comm_pt (const OomphCommunicator *const comm_pt)
 Set the communicator pointer. More...
 
double setup_time () const
 Returns the time to setup the preconditioner. More...
 
virtual void turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse)
 
virtual void turn_into_subsidiary_block_preconditioner (BlockPreconditioner< CRDoubleMatrix > *master_block_prec_pt, const Vector< unsigned > &doftype_in_master_preconditioner_coarse, const Vector< Vector< unsigned >> &doftype_coarsen_map_coarse)
 
- Public Member Functions inherited from oomph::DistributableLinearAlgebraObject
 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...
 
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)
 
void build_distribution (const LinearAlgebraDistribution &dist)
 

Private Attributes

SuperLUSolver Solver
 the SuperLU solver emplyed by this preconditioner More...
 

Additional Inherited Members

- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 
- Protected Attributes inherited from oomph::Preconditioner
bool Silent_preconditioner_setup
 Boolean to indicate whether or not the build should be done silently. More...
 
std::ostream * Stream_pt
 Pointer to the output stream – defaults to std::cout. More...
 

Detailed Description

An interface to allow SuperLU to be used as an (exact) Preconditioner.

Constructor & Destructor Documentation

◆ SuperLUPreconditioner() [1/2]

oomph::SuperLUPreconditioner::SuperLUPreconditioner ( )
inline

Constructor.

44  {
47  }
void disable_doc_time()
Disable documentation of solve times.
Definition: linear_solver.h:116
SuperLUSolver Solver
the SuperLU solver emplyed by this preconditioner
Definition: SuperLU_preconditioner.h:167
void disable_doc_stats()
Disable documentation of solver statistics.
Definition: linear_solver.h:609

References oomph::SuperLUSolver::disable_doc_stats(), oomph::LinearSolver::disable_doc_time(), and Solver.

◆ ~SuperLUPreconditioner()

oomph::SuperLUPreconditioner::~SuperLUPreconditioner ( )
inline

Destructor.

50 {}

◆ SuperLUPreconditioner() [2/2]

oomph::SuperLUPreconditioner::SuperLUPreconditioner ( const SuperLUPreconditioner )
delete

Broken copy constructor.

Member Function Documentation

◆ clean_up_memory()

virtual void oomph::SuperLUPreconditioner::clean_up_memory ( )
inlinevirtual

Clean up memory – forward the call to the version in SuperLU in its LinearSolver incarnation.

Reimplemented from oomph::Preconditioner.

107  {
109  }
void clean_up_memory()
Clean up the memory allocated by the solver.
Definition: linear_solver.cc:2683

References oomph::SuperLUSolver::clean_up_memory(), and Solver.

◆ disable_doc_stats()

void oomph::SuperLUPreconditioner::disable_doc_stats ( )
inline

Enable documentation of solver statistics.

159  {
160  // Disable the documentation of statistics inside SuperLU
162  } // End of disable_doc_stats

References oomph::SuperLUSolver::disable_doc_stats(), and Solver.

◆ enable_doc_stats()

void oomph::SuperLUPreconditioner::enable_doc_stats ( )
inline

Enable documentation of solver statistics.

152  {
153  // Enable the documentation of statistics inside SuperLU
155  } // End of enable_doc_stats
void enable_doc_stats()
Enable documentation of solver statistics.
Definition: linear_solver.h:603

References oomph::SuperLUSolver::enable_doc_stats(), and Solver.

◆ get_memory_usage_for_lu_factors()

double oomph::SuperLUPreconditioner::get_memory_usage_for_lu_factors ( )
inline

Get the amount of memory used to store the LU factors inside SuperLU.

114  {
115  // Return the appropriate result
117  } // End of get_memory_usage_for_lu_factors
double get_memory_usage_for_lu_factors()
How much memory do the LU factors take up? In bytes.
Definition: linear_solver.cc:758

References oomph::SuperLUSolver::get_memory_usage_for_lu_factors(), and Solver.

◆ get_memory_usage_for_superlu()

Vector<double> oomph::SuperLUPreconditioner::get_memory_usage_for_superlu ( )
inline

Get the amount of memory taken up by SuperLU. The first entry of the returned result contains the memory used to store the LU factors and the second entry contains the total memory used to store AND calculate the LU factors

134  {
135  // Allocate storage for the memory statistics
136  Vector<double> memory_usage(2, 0.0);
137 
138  // The first entry contains the memory used to store the LU factors
139  memory_usage[0] = Solver.get_memory_usage_for_lu_factors();
140 
141  // The second entry contains the total memory used to both calculate
142  // and store the LU factors
143  memory_usage[1] = Solver.get_total_needed_memory();
144 
145  // Now return the calculated result
146  return memory_usage;
147  } // End of get_memory_usage_for_superlu
double get_total_needed_memory()
How much memory was allocated by SuperLU? In bytes.
Definition: linear_solver.cc:786

References oomph::SuperLUSolver::get_memory_usage_for_lu_factors(), oomph::SuperLUSolver::get_total_needed_memory(), and Solver.

◆ get_total_memory_needed_for_superlu()

double oomph::SuperLUPreconditioner::get_total_memory_needed_for_superlu ( )
inline

Get the total memory needed by SuperLU to store AND calculate the LU factors

123  {
124  // Return the appropriate result
126  } // End of get_memory_usage_for_superlu

References oomph::SuperLUSolver::get_total_needed_memory(), and Solver.

◆ operator=()

void oomph::SuperLUPreconditioner::operator= ( const SuperLUPreconditioner )
delete

Broken assignment operator.

◆ preconditioner_solve()

void oomph::SuperLUPreconditioner::preconditioner_solve ( const DoubleVector r,
DoubleVector z 
)
inlinevirtual

Function applies SuperLU to vector r for (exact) preconditioning, this requires a call to setup(...) first.

Implements oomph::Preconditioner.

91  {
92  Solver.resolve(r, z);
93  }
void resolve(const DoubleVector &rhs, DoubleVector &result)
Resolve the system for a given RHS.
Definition: linear_solver.cc:1769
r
Definition: UniformPSDSelfTest.py:20

References UniformPSDSelfTest::r, oomph::SuperLUSolver::resolve(), and Solver.

◆ preconditioner_solve_transpose()

void oomph::SuperLUPreconditioner::preconditioner_solve_transpose ( const DoubleVector r,
DoubleVector z 
)
inlinevirtual

Function applies SuperLU to vector r for (exact) preconditioning (of the transposed matrix system) this requires a call to setup(...) first.

Reimplemented from oomph::Preconditioner.

99  {
101  }
void resolve_transpose(const DoubleVector &rhs, DoubleVector &result)
Resolve the (transposed) system for a given RHS.
Definition: linear_solver.cc:1793

References UniformPSDSelfTest::r, oomph::SuperLUSolver::resolve_transpose(), and Solver.

◆ setup()

void oomph::SuperLUPreconditioner::setup ( )
inlinevirtual

Function to set up a preconditioner for the linear system defined by matrix_pt. This function must be called before using preconditioner_solve. Note: matrix_pt must point to an object of class CRDoubleMatrix or CCDoubleMatrix

Implements oomph::Preconditioner.

64  {
65  oomph_info << "Setting up SuperLU (exact) preconditioner" << std::endl;
66  if (dynamic_cast<DistributableLinearAlgebraObject*>(matrix_pt()) != 0)
67  {
68  LinearAlgebraDistribution dist(
70  ->distribution_pt());
71  this->build_distribution(dist);
73  }
74  else
75  {
76  std::ostringstream error_message_stream;
77  error_message_stream
78  << "SuperLUPreconditioner can only be applied to matrices derived \n"
79  << "DistributableLinearAlgebraObject.\n"
80  << "You are most likely to be here because you are using the\n "
81  << "soon to be obsolete CCDoubleMatrix\n";
82  throw OomphLibError(error_message_stream.str(),
85  }
86  }
LinearAlgebraDistribution * distribution_pt() const
access to the LinearAlgebraDistribution
Definition: linear_algebra_distribution.h:457
void build_distribution(const LinearAlgebraDistribution *const dist_pt)
Definition: linear_algebra_distribution.h:507
DistributableLinearAlgebraObject()
Default constructor - create a distribution.
Definition: linear_algebra_distribution.h:438
virtual DoubleMatrixBase * matrix_pt() const
Get function for matrix pointer.
Definition: preconditioner.h:150
void factorise(DoubleMatrixBase *const &matrix_pt)
Definition: linear_solver.cc:1820
OomphInfo oomph_info
Definition: oomph_definitions.cc:319
#define OOMPH_EXCEPTION_LOCATION
Definition: oomph_definitions.h:61
#define OOMPH_CURRENT_FUNCTION
Definition: oomph_definitions.h:86

References oomph::DistributableLinearAlgebraObject::build_distribution(), oomph::DistributableLinearAlgebraObject::distribution_pt(), oomph::SuperLUSolver::factorise(), oomph::Preconditioner::matrix_pt(), OOMPH_CURRENT_FUNCTION, OOMPH_EXCEPTION_LOCATION, oomph::oomph_info, and Solver.

Referenced by oomph::NavierStokesSchurComplementPreconditioner::setup().

Member Data Documentation

◆ Solver


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