LifeV
PreconditionerComposition Class Referenceabstract

PreconditionerComposition - Class to manage preconditioners composed by matrices multiplication. More...

#include <PreconditionerComposition.hpp>

+ Inheritance diagram for PreconditionerComposition:
+ Collaboration diagram for PreconditionerComposition:

Protected Attributes

std::shared_ptr< Epetra_Comm > M_comm
 
- Protected Attributes inherited from Preconditioner
std::string M_precType
 
Displayer M_displayer
 
list_Type M_list
 
bool M_preconditionerCreated
 

Private Attributes

precPtr_Type M_prec
 
std::vector< matrixPtr_TypeM_precBaseOperators
 

Public Types

typedef Preconditioner super_Type
 
typedef std::shared_ptr< super_TypesuperPtr_Type
 
typedef Epetra_Operator operator_Type
 
typedef std::shared_ptr< operator_TypeoperatorPtr_Type
 
typedef ComposedOperator< operator_Typeprec_Type
 
typedef std::shared_ptr< prec_TypeprecPtr_Type
 
typedef MatrixEpetra< Realmatrix_Type
 
typedef std::shared_ptr< matrix_TypematrixPtr_Type
 
typedef Teuchos::ParameterList list_Type
 

Constructor & Destructor

 PreconditionerComposition (std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >(new Epetra_MpiComm(MPI_COMM_WORLD)))
 Constructor. More...
 
 ~PreconditionerComposition ()
 Destructor. More...
 
 PreconditionerComposition (const PreconditionerComposition &precComp)
 Copy constructor. More...
 

Methods

virtual void createParametersList (list_Type &list, const GetPot &dataFile, const std::string &section, const std::string &subSection)=0
 Create the list of parameters of the preconditioner. More...
 
virtual int buildPreconditioner (matrixPtr_Type &A)=0
 Build the preconditioner. More...
 
void resetPreconditioner ()
 Reset the preconditioner. More...
 
Real condest ()
 Return an estimation of the conditionement number of the preconditioner. More...
 

Epetra Operator Interface Methods

Int SetUseTranspose (const bool useTranspose=false)
 Set the matrix to be used transposed (or not) More...
 
Int Apply (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 Apply the inverse of the preconditioner on vector1 and store the result in vector2. More...
 
Int ApplyInverse (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 Apply the inverse of the preconditioner on vector1 and store the result in vector2. More...
 
bool UseTranspose ()
 Return true if the preconditioner is transposed. More...
 
const Epetra_Map & OperatorRangeMap () const
 Return the Range map of the operator. More...
 
const Epetra_Map & OperatorDomainMap () const
 Return the Domain map of the operator. More...
 

Set Methods

virtual void setDataFromGetPot (const GetPot &dataFile, const std::string &section)=0
 Setter using GetPot. More...
 
virtual void setParameters (Teuchos::ParameterList &list)=0
 Method to setup the solver using Teuchos::ParameterList. More...
 
void setComm (std::shared_ptr< Epetra_Comm > comm)
 

Get Methods

bool isPreconditionerSet () const
 Preconditioner is set? More...
 
operator_Typepreconditioner ()
 Get a standard pointer to the preconditioner. More...
 
operatorPtr_Type preconditionerPtr ()
 get a std::shared_ptr to the preconditioner. More...
 
virtual std::string preconditionerType ()
 Return the type name of the preconditioner. More...
 
UInt numOperators () const
 Return the number of operators in the composition. More...
 

Private Methods

int pushBack (matrixPtr_Type A, const bool useInverse=false, const bool useTranspose=false)
 Add A to the right of the composition. More...
 
int pushBack (operatorPtr_Type oper, const bool useInverse=false, const bool useTranspose=false, matrixPtr_Type baseMatrix=matrixPtr_Type())
 
int pushBack (matrixPtr_Type A, superPtr_Type preconditioner, const bool useInverse=false, const bool useTranspose=false)
 Use a preconditioner to build the inverse of A and add it to the right of the composition. More...
 
int pushBack (matrixPtr_Type embeddedA, superPtr_Type preconditioner, const VectorBlockStructure &blockStructure, const UInt &blockIndex, const MapEpetra &fullMap, const bool useInverse=false, const bool useTranspose=false, const bool buildPreconditioner=true)
 Use a preconditioner to build the inverse of A and add it to the right of the composition. More...
 
int pushBack (operatorPtr_Type embeddedOperator, const VectorBlockStructure &blockStructure, const UInt &blockIndex, const MapEpetra &fullMap, const bool useInverse, const bool useTranspose)
 

Additional Inherited Members

- Public Types inherited from Preconditioner
typedef Epetra_Operator prec_raw_type
 
typedef std::shared_ptr< prec_raw_typeprec_type
 
typedef MatrixEpetra< Realoperator_raw_type
 
typedef std::shared_ptr< operator_raw_typeoperator_type
 
typedef Displayer::comm_Type comm_Type
 
typedef Displayer::commPtr_Type commPtr_Type
 
typedef Teuchos::ParameterList list_Type
 
- Public Member Functions inherited from Preconditioner
 Preconditioner (const commPtr_Type &comm=commPtr_Type())
 Constructor. More...
 
 Preconditioner (const Preconditioner &preconditioner, const commPtr_Type &comm=commPtr_Type())
 Copy constructor. More...
 
virtual ~Preconditioner ()
 Destructor. More...
 
virtual Int buildPreconditioner (operator_type &matrix)=0
 Build a preconditioner based on the given matrix. More...
 
virtual void showMe (std::ostream &output=std::cout) const
 Show informations about the preconditioner. More...
 
void setParametersList (const list_Type &list)
 The the internal list. More...
 
virtual void setSolver (SolverAztecOO &)
 Set the internal solver. More...
 
const bool & preconditionerCreated ()
 Return true if the preconditioner has been created. More...
 
const list_TypeparametersList () const
 Return the parameters list. More...
 
list_TypeparametersList ()
 Return the parameters list. More...
 

Detailed Description

PreconditionerComposition - Class to manage preconditioners composed by matrices multiplication.

Author
Gwenol Grandperrin

This class makes use of ComposedOperator to handle matrices composition.

Definition at line 61 of file PreconditionerComposition.hpp.

Member Typedef Documentation

◆ super_Type

Definition at line 68 of file PreconditionerComposition.hpp.

◆ superPtr_Type

typedef std::shared_ptr<super_Type> superPtr_Type

Definition at line 69 of file PreconditionerComposition.hpp.

◆ operator_Type

Definition at line 70 of file PreconditionerComposition.hpp.

◆ operatorPtr_Type

typedef std::shared_ptr<operator_Type> operatorPtr_Type

Definition at line 71 of file PreconditionerComposition.hpp.

◆ prec_Type

◆ precPtr_Type

typedef std::shared_ptr<prec_Type> precPtr_Type

Definition at line 73 of file PreconditionerComposition.hpp.

◆ matrix_Type

Definition at line 75 of file PreconditionerComposition.hpp.

◆ matrixPtr_Type

typedef std::shared_ptr<matrix_Type> matrixPtr_Type

Definition at line 76 of file PreconditionerComposition.hpp.

◆ list_Type

typedef Teuchos::ParameterList list_Type

Definition at line 78 of file PreconditionerComposition.hpp.

Constructor & Destructor Documentation

◆ PreconditionerComposition() [1/2]

PreconditionerComposition ( std::shared_ptr< Epetra_Comm >  comm = std::shared_ptr<Epetra_Comm> ( new Epetra_MpiComm ( MPI_COMM_WORLD ) ))

Constructor.

Parameters
commCommunicator (std::shared_ptr<Epetra_Comm>() by default)

Definition at line 57 of file PreconditionerComposition.cpp.

◆ PreconditionerComposition() [2/2]

Copy constructor.

Parameters
precCompPreconditionerComposition

Definition at line 65 of file PreconditionerComposition.cpp.

+ Here is the caller graph for this function:

◆ ~PreconditionerComposition()

Destructor.

Definition at line 73 of file PreconditionerComposition.cpp.

Member Function Documentation

◆ createParametersList()

virtual void createParametersList ( list_Type list,
const GetPot dataFile,
const std::string &  section,
const std::string &  subSection 
)
pure virtual

Create the list of parameters of the preconditioner.

Parameters
listA Parameter list to be filled
dataFileA GetPot object containing the data about the preconditioner
sectionThe section in "dataFile" where to find data about the preconditioner
subSectionThe subsection in "dataFile" where to find data about the preconditioner

Implements Preconditioner.

Implemented in PreconditionerPCD, PreconditionerSIMPLE, and PreconditionerYosida.

◆ buildPreconditioner()

virtual int buildPreconditioner ( matrixPtr_Type A)
pure virtual

Build the preconditioner.

Parameters
Athe base matrix for computing the preconditioner

Implemented in PreconditionerPCD, PreconditionerSIMPLE, and PreconditionerYosida.

◆ resetPreconditioner()

void resetPreconditioner ( )
virtual

Reset the preconditioner.

Implements Preconditioner.

Definition at line 84 of file PreconditionerComposition.cpp.

◆ condest()

Real condest ( )
virtual

Return an estimation of the conditionement number of the preconditioner.

Implements Preconditioner.

Reimplemented in PreconditionerPCD, PreconditionerSIMPLE, and PreconditionerYosida.

Definition at line 92 of file PreconditionerComposition.cpp.

◆ SetUseTranspose()

int SetUseTranspose ( const bool  useTranspose = false)
virtual

Set the matrix to be used transposed (or not)

Parameters
useTransposeIf true the preconditioner is transposed

Reimplemented from Preconditioner.

Definition at line 103 of file PreconditionerComposition.cpp.

◆ Apply()

int Apply ( const Epetra_MultiVector vector1,
Epetra_MultiVector vector2 
) const
virtual

Apply the inverse of the preconditioner on vector1 and store the result in vector2.

Parameters
vector1Vector to which we apply the preconditioner
vector2Vector to the store the result

Reimplemented from Preconditioner.

Definition at line 109 of file PreconditionerComposition.cpp.

◆ ApplyInverse()

int ApplyInverse ( const Epetra_MultiVector vector1,
Epetra_MultiVector vector2 
) const
virtual

Apply the inverse of the preconditioner on vector1 and store the result in vector2.

Parameters
vector1Vector to which we apply the preconditioner
vector2Vector to the store the result

Reimplemented from Preconditioner.

Definition at line 115 of file PreconditionerComposition.cpp.

◆ UseTranspose()

bool UseTranspose ( )
virtual

Return true if the preconditioner is transposed.

Reimplemented from Preconditioner.

Definition at line 121 of file PreconditionerComposition.cpp.

◆ OperatorRangeMap()

const Epetra_Map & OperatorRangeMap ( ) const
virtual

Return the Range map of the operator.

Reimplemented from Preconditioner.

Definition at line 127 of file PreconditionerComposition.cpp.

◆ OperatorDomainMap()

const Epetra_Map & OperatorDomainMap ( ) const
virtual

Return the Domain map of the operator.

Reimplemented from Preconditioner.

Definition at line 133 of file PreconditionerComposition.cpp.

◆ setDataFromGetPot()

virtual void setDataFromGetPot ( const GetPot dataFile,
const std::string &  section 
)
pure virtual

Setter using GetPot.

This method use GetPot to load data from a file and then set the preconditioner.

Parameters
dataFileis a GetPot dataFile
sectionis the section containing the data

Implements Preconditioner.

Implemented in PreconditionerPCD, PreconditionerSIMPLE, and PreconditionerYosida.

◆ setParameters()

virtual void setParameters ( Teuchos::ParameterList &  list)
pure virtual

Method to setup the solver using Teuchos::ParameterList.

Parameters
listTeuchos::ParameterList object

Implemented in PreconditionerPCD, PreconditionerSIMPLE, and PreconditionerYosida.

◆ setComm()

void setComm ( std::shared_ptr< Epetra_Comm >  comm)

copies the shared_ptr to the communicator in the member M_comm and builds a new instance

Definition at line 142 of file PreconditionerComposition.cpp.

◆ isPreconditionerSet()

bool isPreconditionerSet ( ) const

Preconditioner is set?

Returns
true

Definition at line 152 of file PreconditionerComposition.cpp.

◆ preconditioner()

PreconditionerComposition::operator_Type * preconditioner ( )
virtual

Get a standard pointer to the preconditioner.

In most of the cases is more safe to use getPrecPtr(), which returns a std::shared_ptr

Implements Preconditioner.

Definition at line 158 of file PreconditionerComposition.cpp.

◆ preconditionerPtr()

PreconditionerComposition::operatorPtr_Type preconditionerPtr ( )
virtual

get a std::shared_ptr to the preconditioner.

The only requirement on the preconditioner is that it must derive from the Epetra_Operator object

Implements Preconditioner.

Definition at line 164 of file PreconditionerComposition.cpp.

◆ preconditionerType()

std::string preconditionerType ( )
virtual

Return the type name of the preconditioner.

Returns
type of the preconditioner

Implements Preconditioner.

Definition at line 170 of file PreconditionerComposition.cpp.

◆ numOperators()

UInt numOperators ( ) const

Return the number of operators in the composition.

Definition at line 176 of file PreconditionerComposition.cpp.

◆ pushBack() [1/5]

int pushBack ( matrixPtr_Type  A,
const bool  useInverse = false,
const bool  useTranspose = false 
)
protected

Add A to the right of the composition.

Definition at line 185 of file PreconditionerComposition.cpp.

◆ pushBack() [2/5]

int pushBack ( operatorPtr_Type  oper,
const bool  useInverse = false,
const bool  useTranspose = false,
matrixPtr_Type  baseMatrix = matrixPtr_Type() 
)
protected

Definition at line 196 of file PreconditionerComposition.cpp.

◆ pushBack() [3/5]

int pushBack ( matrixPtr_Type  A,
superPtr_Type  preconditioner,
const bool  useInverse = false,
const bool  useTranspose = false 
)
protected

Use a preconditioner to build the inverse of A and add it to the right of the composition.

Definition at line 211 of file PreconditionerComposition.cpp.

◆ pushBack() [4/5]

int pushBack ( matrixPtr_Type  embeddedA,
superPtr_Type  preconditioner,
const VectorBlockStructure blockStructure,
const UInt blockIndex,
const MapEpetra fullMap,
const bool  useInverse = false,
const bool  useTranspose = false,
const bool  buildPreconditioner = true 
)
protected

Use a preconditioner to build the inverse of A and add it to the right of the composition.

Definition at line 226 of file PreconditionerComposition.cpp.

◆ pushBack() [5/5]

int pushBack ( operatorPtr_Type  embeddedOperator,
const VectorBlockStructure blockStructure,
const UInt blockIndex,
const MapEpetra fullMap,
const bool  useInverse,
const bool  useTranspose 
)
protected

Definition at line 260 of file PreconditionerComposition.cpp.

Field Documentation

◆ M_comm

std::shared_ptr<Epetra_Comm> M_comm
protected

Definition at line 242 of file PreconditionerComposition.hpp.

◆ M_prec

precPtr_Type M_prec
private

Definition at line 245 of file PreconditionerComposition.hpp.

◆ M_precBaseOperators

std::vector< matrixPtr_Type > M_precBaseOperators
private

Definition at line 246 of file PreconditionerComposition.hpp.


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