Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
oomph::TrilinosPreconditionerBase Class Referenceabstract

Base class for Trilinos preconditioners as oomph-lib preconditioner. More...

#include <trilinos_preconditioners.h>

+ Inheritance diagram for oomph::TrilinosPreconditionerBase:

Public Member Functions

 TrilinosPreconditionerBase ()
 Constructor. More...
 
virtual ~TrilinosPreconditionerBase ()
 Destructor. More...
 
void clean_up_memory ()
 deletes the preconditioner, matrices and maps More...
 
 TrilinosPreconditionerBase (const TrilinosPreconditionerBase &)=delete
 Broken copy constructor. More...
 
void setup ()
 Broken assignment operator. More...
 
void setup (Epetra_CrsMatrix *epetra_matrix_pt)
 Function to setup a preconditioner for the linear system defined by the oomph-lib oomph_matrix_pt and Epetra epetra_matrix_pt matrices. This method is called by Trilinos solvers. More...
 
void preconditioner_solve (const DoubleVector &r, DoubleVector &z)
 applies the preconditioner More...
 
Epetra_Operator *& epetra_operator_pt ()
 Access function to Epetra_preconditioner_pt. For use with TrilinosAztecOOSolver. More...
 
Epetra_Operator * epetra_operator_pt () const
 Access function to Epetra_preconditioner_pt (const version) For use with TrilinosAztecOOSolver. 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...
 
virtual void preconditioner_solve_transpose (const DoubleVector &r, DoubleVector &z)
 Apply the preconditioner. Pure virtual generic interface function. This method should apply the preconditioner operator to the vector r and return the vector z. (broken virtual) More...
 
void setup (DoubleMatrixBase *matrix_pt)
 Setup the preconditioner: store the matrix pointer and the communicator pointer then call preconditioner specific setup() function. More...
 
void setup (const Problem *problem_pt, DoubleMatrixBase *matrix_pt)
 Compatability layer for old preconditioners where problem pointers were needed. The problem pointer is only used to get a communicator pointer. More...
 
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 interface function for making a preconditioner a subsidiary of a block preconditioner. By default nothing is needed, but if this preconditioner is also a block preconditioner then things need to happen. There's an assumption here that the block preconditioner will be in CR form but since that assumption is hard coded all over BlockPreconditioner we're safe. More...
 
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)
 Virtual interface function for making a preconditioner a subsidiary of a block preconditioner. By default nothing is needed, but if this preconditioner is also a block preconditioner then things need to happen. Version for coarsening dof-types. More...
 
- 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
 if the communicator_pt is null then the distribution is not setup then false is returned, otherwise return true More...
 
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 double Cumulative_preconditioner_solve_time = 0.0
 Static double that accumulates the preconditioner solve time of all instantiations of this class. Reset it manually, e.g. after every Newton solve. More...
 

Protected Member Functions

virtual void setup_trilinos_preconditioner (Epetra_CrsMatrix *epetra_matrix_pt)=0
 Function to set up a specific Trilinos preconditioner. This is called by setup(...). More...
 
- Protected Member Functions inherited from oomph::DistributableLinearAlgebraObject
void clear_distribution ()
 clear the distribution of this distributable linear algebra object More...
 

Protected Attributes

Epetra_Operator * Epetra_preconditioner_pt
 The preconditioner which will be set up using function setup_trilinos_preconditioner(...) More...
 
Epetra_CrsMatrix * Epetra_matrix_pt
 Pointer used to store the epetra matrix - only used when this preconditioner is setup using the oomph-lib interface. More...
 
- 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

Base class for Trilinos preconditioners as oomph-lib preconditioner.

Definition at line 55 of file trilinos_preconditioners.h.

Constructor & Destructor Documentation

◆ TrilinosPreconditionerBase() [1/2]

oomph::TrilinosPreconditionerBase::TrilinosPreconditionerBase ( )
inline

Constructor.

Definition at line 59 of file trilinos_preconditioners.h.

References Epetra_matrix_pt, and Epetra_preconditioner_pt.

◆ ~TrilinosPreconditionerBase()

virtual oomph::TrilinosPreconditionerBase::~TrilinosPreconditionerBase ( )
inlinevirtual

Destructor.

Definition at line 67 of file trilinos_preconditioners.h.

References clean_up_memory().

◆ TrilinosPreconditionerBase() [2/2]

oomph::TrilinosPreconditionerBase::TrilinosPreconditionerBase ( const TrilinosPreconditionerBase )
delete

Broken copy constructor.

Member Function Documentation

◆ clean_up_memory()

void oomph::TrilinosPreconditionerBase::clean_up_memory ( )
inlinevirtual

deletes the preconditioner, matrices and maps

Reimplemented from oomph::Preconditioner.

Definition at line 78 of file trilinos_preconditioners.h.

References Epetra_matrix_pt, and Epetra_preconditioner_pt.

Referenced by setup(), and ~TrilinosPreconditionerBase().

◆ epetra_operator_pt() [1/2]

Epetra_Operator*& oomph::TrilinosPreconditionerBase::epetra_operator_pt ( )
inline

Access function to Epetra_preconditioner_pt. For use with TrilinosAztecOOSolver.

Definition at line 118 of file trilinos_preconditioners.h.

References Epetra_preconditioner_pt.

Referenced by oomph::TrilinosAztecOOSolver::solver_setup().

◆ epetra_operator_pt() [2/2]

Epetra_Operator* oomph::TrilinosPreconditionerBase::epetra_operator_pt ( ) const
inline

Access function to Epetra_preconditioner_pt (const version) For use with TrilinosAztecOOSolver.

Definition at line 125 of file trilinos_preconditioners.h.

References Epetra_preconditioner_pt.

◆ preconditioner_solve()

void oomph::TrilinosPreconditionerBase::preconditioner_solve ( const DoubleVector r,
DoubleVector z 
)
virtual

applies the preconditioner

preconditioner_solve - applies the preconditioner to the vector r taking distributed oomph-lib vectors (DistributedVector<double>) as arguments.

Implements oomph::Preconditioner.

Definition at line 126 of file trilinos_preconditioners.cc.

References oomph::DoubleVector::build(), oomph::TrilinosEpetraHelpers::copy_to_oomphlib_vector(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_vector(), Cumulative_preconditioner_solve_time, oomph::DistributableLinearAlgebraObject::distribution_pt(), Epetra_preconditioner_pt, and oomph::TimingHelpers::timer().

◆ setup() [1/2]

void oomph::TrilinosPreconditionerBase::setup ( )
virtual

Broken assignment operator.

Function to set up a preconditioner for the linear system defined by matrix_pt. This function must be called before using preconditioner_solve. NOTE 1. matrix_pt must point to an object of class CRDoubleMatrix or DistributedCRDoubleMatrix This method should be called by oomph-lib solvers and preconditioners.

Function to set up a preconditioner for the linear system defined by matrix_pt. This function must be called before using preconditioner_solve. NOTE 1. matrix_pt must point to an object of class CRDoubleMatrix or DistributedCRDoubleMatrix This method should be called by oomph-lib solvers and preconditioners

Implements oomph::Preconditioner.

Definition at line 53 of file trilinos_preconditioners.cc.

References oomph::DistributableLinearAlgebraObject::build_distribution(), clean_up_memory(), oomph::TrilinosEpetraHelpers::create_distributed_epetra_matrix(), oomph::DistributableLinearAlgebraObject::distribution_pt(), Epetra_matrix_pt, oomph::Preconditioner::matrix_pt(), oomph::DoubleMatrixBase::ncol(), oomph::DistributableLinearAlgebraObject::nrow(), oomph::DoubleMatrixBase::nrow(), and setup_trilinos_preconditioner().

Referenced by oomph::TrilinosAztecOOSolver::solver_setup().

◆ setup() [2/2]

void oomph::TrilinosPreconditionerBase::setup ( Epetra_CrsMatrix *  epetra_matrix_pt)

Function to setup a preconditioner for the linear system defined by the oomph-lib oomph_matrix_pt and Epetra epetra_matrix_pt matrices. This method is called by Trilinos solvers.

Definition at line 100 of file trilinos_preconditioners.cc.

References clean_up_memory(), oomph::Preconditioner::matrix_pt(), and setup_trilinos_preconditioner().

◆ setup_trilinos_preconditioner()

virtual void oomph::TrilinosPreconditionerBase::setup_trilinos_preconditioner ( Epetra_CrsMatrix *  epetra_matrix_pt)
protectedpure virtual

Function to set up a specific Trilinos preconditioner. This is called by setup(...).

Implemented in oomph::TrilinosIFPACKPreconditioner, and oomph::TrilinosMLPreconditioner.

Referenced by setup().

Member Data Documentation

◆ Cumulative_preconditioner_solve_time

double oomph::TrilinosPreconditionerBase::Cumulative_preconditioner_solve_time = 0.0
static

Static double that accumulates the preconditioner solve time of all instantiations of this class. Reset it manually, e.g. after every Newton solve.

////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////// Static double that accumulates the preconditioner solve time of all instantiations of this class. Reset it manually, e.g. after every Newton solve.

Definition at line 75 of file trilinos_preconditioners.h.

Referenced by preconditioner_solve().

◆ Epetra_matrix_pt

Epetra_CrsMatrix* oomph::TrilinosPreconditionerBase::Epetra_matrix_pt
protected

Pointer used to store the epetra matrix - only used when this preconditioner is setup using the oomph-lib interface.

Definition at line 142 of file trilinos_preconditioners.h.

Referenced by clean_up_memory(), setup(), and TrilinosPreconditionerBase().

◆ Epetra_preconditioner_pt

Epetra_Operator* oomph::TrilinosPreconditionerBase::Epetra_preconditioner_pt
protected

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