LifeV
PreconditionerComposed Class Reference

PreconditionerComposed -. More...

#include <PreconditionerComposed.hpp>

+ Inheritance diagram for PreconditionerComposed:
+ Collaboration diagram for PreconditionerComposed:

Typedefs

typedef Preconditioner super_Type
 
typedef ComposedOperator< Preconditionerprec_Type
 
typedef std::shared_ptr< prec_TypeprecPtr_Type
 
typedef std::shared_ptr< PreconditionerepetraPrecPtr_Type
 
typedef super_Type::operator_raw_type operator_Type
 
typedef std::shared_ptr< operator_TypeoperatorPtr_Type
 
typedef super_Type::list_Type list_Type
 

Constructors, destructor

 PreconditionerComposed (std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >())
 default constructor. More...
 
virtual ~PreconditionerComposed ()
 constructor from matrix A. More...
 
 PreconditionerComposed (PreconditionerComposed &P)
 Copy Constructor. More...
 

Public Methods

void setDataFromGetPot (const GetPot &dataFile, const std::string &section)
 Sets the data from GetPot. More...
 
void createParametersList (list_Type &, const GetPot &dataFile, const std::string &section, const std::string &subSection)
 Creates the Trilinos Teuchos parameter list reading from data file. More...
 
double condest ()
 Returns an estimate of the condition number. More...
 
int buildPreconditioner (operatorPtr_Type &A)
 same as push_back More...
 
int buildPreconditioner (operatorPtr_Type &A, const bool useInverse, const bool useTranspose=false)
 same as push_back More...
 
int push_back (operatorPtr_Type &A, const bool useInverse=false, const bool useTranspose=false)
 Builds a preconditioner based on A and pushes it back in the composedPreconditioner. More...
 
int replace (operatorPtr_Type &A, const UInt index, const bool useInverse=false, const bool useTranspose=false)
 Builds a preconditioner based on A and replaces it in the composedPreconditioner. More...
 
void resetPreconditioner ()
 resets the pointer to the preconditioner M_prec More...
 
const std::vector< operatorPtr_Type > & operVector () const
 returns the operator vectir More...
 

Implementation of Methods from Epetra_Operator

const Epetra_Comm & Comm ()
 returns the communicator More...
 
int SetUseTranspose (bool useTranspose=false)
 sets the M_useTranspose flag More...
 
bool UseTranspose ()
 returns the M_useTranspose flag More...
 
virtual int ApplyInverse (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 Applies the inverse operator to an input vector. More...
 
virtual int Apply (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 Applies the operator to an input vector. More...
 
const Epetra_Map & OperatorRangeMap () const
 returns the range map More...
 
const Epetra_Map & OperatorDomainMap () const
 returns the domain map More...
 

Get Methods

super_Type::prec_raw_typepreconditioner ()
 returns a raw pointer to the preconditioner base class More...
 
UInt number () const
 returms the number of factors in the preconditioner More...
 
super_Type::prec_type preconditionerPtr ()
 returns a shared pointer to the preconditioner More...
 
const precPtr_Type composedPreconditionerPtr ()
 returns a shared pointer to the preconditioner More...
 
std::string preconditionerType ()
 returns a string identifying the preconditioner type More...
 

Static Methods

static PreconditionercreateComposedPreconditioner ()
 Factory method. More...
 

Private Methods

void myCreateParametersList (const GetPot &dataFile, const std::string &section, const std::string &subSection)
 
Int createPrec (operatorPtr_Type &oper, std::shared_ptr< Preconditioner > &prec)
 

Private Members

std::vector< operatorPtr_TypeM_operVector
 
precPtr_Type M_prec
 
static bool registerComposed = PRECFactory::instance().registerProduct ( "Composed", &PreconditionerComposed::createComposedPreconditioner )
 

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...
 
- Protected Attributes inherited from Preconditioner
std::string M_precType
 
Displayer M_displayer
 
list_Type M_list
 
bool M_preconditionerCreated
 

Detailed Description

PreconditionerComposed -.

Author
Simone Deparis, Paolo Crosetto Paolo Crosetto Class handling a preconditioner defined as a multiplication of several preconditioners. The class inherits from the base Preconditioner class and implements some methds which are used in the EpetraOperator, so that it can be passed as a template argument to the ComposedOperator object. It contains an instance of ComposedOperator, which will be filled with shared pointers to trilinos preconditioners (more generally Epetra_Operators) and a vector of shared pointers to LifeV matrices (of MatrixEpetra type, in M_operVector). Notice that the matrices are not copied when the push_back method is called, and not even if the copy constructor is called. Only the shared pointers are copied. The same happens to the preconditioners through the constructor of the ComposedOperator class, which behave in the same way.

Definition at line 65 of file PreconditionerComposed.hpp.

Member Typedef Documentation

◆ super_Type

Definition at line 74 of file PreconditionerComposed.hpp.

◆ prec_Type

◆ precPtr_Type

typedef std::shared_ptr<prec_Type> precPtr_Type

Definition at line 76 of file PreconditionerComposed.hpp.

◆ epetraPrecPtr_Type

typedef std::shared_ptr<Preconditioner> epetraPrecPtr_Type

Definition at line 77 of file PreconditionerComposed.hpp.

◆ operator_Type

◆ operatorPtr_Type

typedef std::shared_ptr<operator_Type> operatorPtr_Type

Definition at line 79 of file PreconditionerComposed.hpp.

◆ list_Type

Definition at line 80 of file PreconditionerComposed.hpp.

Constructor & Destructor Documentation

◆ PreconditionerComposed() [1/2]

PreconditionerComposed ( std::shared_ptr< Epetra_Comm >  comm = std::shared_ptr<Epetra_Comm>())

default constructor.

Definition at line 34 of file PreconditionerComposed.cpp.

+ Here is the caller graph for this function:

◆ PreconditionerComposed() [2/2]

Copy Constructor.

This copy constructor does not copy the matrices, but just the shared_ptrs. It calls the copy constructor of ComposedOperator.

◆ ~PreconditionerComposed()

~PreconditionerComposed ( )
virtual

constructor from matrix A.

Parameters
AMatrixEpetra<double> matrix upon which construct the preconditioner default destructor

Definition at line 53 of file PreconditionerComposed.cpp.

Member Function Documentation

◆ setDataFromGetPot()

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

Sets the data from GetPot.

Implements Preconditioner.

Definition at line 64 of file PreconditionerComposed.cpp.

◆ createParametersList()

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

Creates the Trilinos Teuchos parameter list reading from data file.

Implements Preconditioner.

Definition at line 71 of file PreconditionerComposed.cpp.

◆ condest()

double condest ( )
virtual

Returns an estimate of the condition number.

Implements Preconditioner.

Definition at line 95 of file PreconditionerComposed.cpp.

◆ buildPreconditioner() [1/2]

int buildPreconditioner ( operatorPtr_Type A)

same as push_back

Definition at line 107 of file PreconditionerComposed.cpp.

◆ buildPreconditioner() [2/2]

int buildPreconditioner ( operatorPtr_Type A,
const bool  useInverse,
const bool  useTranspose = false 
)

same as push_back

Definition at line 114 of file PreconditionerComposed.cpp.

◆ push_back()

int push_back ( operatorPtr_Type A,
const bool  useInverse = false,
const bool  useTranspose = false 
)

Builds a preconditioner based on A and pushes it back in the composedPreconditioner.

Definition at line 123 of file PreconditionerComposed.cpp.

+ Here is the caller graph for this function:

◆ replace()

int replace ( operatorPtr_Type A,
const UInt  index,
const bool  useInverse = false,
const bool  useTranspose = false 
)

Builds a preconditioner based on A and replaces it in the composedPreconditioner.

Definition at line 151 of file PreconditionerComposed.cpp.

◆ resetPreconditioner()

void resetPreconditioner ( )
virtual

resets the pointer to the preconditioner M_prec

Implements Preconditioner.

Definition at line 174 of file PreconditionerComposed.cpp.

◆ operVector()

const std::vector<operatorPtr_Type>& operVector ( ) const
inline

returns the operator vectir

Definition at line 143 of file PreconditionerComposed.hpp.

◆ Comm()

const Epetra_Comm& Comm ( )
inline

returns the communicator

Definition at line 152 of file PreconditionerComposed.hpp.

◆ SetUseTranspose()

int SetUseTranspose ( bool  useTranspose = false)
inlinevirtual

sets the M_useTranspose flag

Reimplemented from Preconditioner.

Definition at line 158 of file PreconditionerComposed.hpp.

◆ UseTranspose()

bool UseTranspose ( )
inlinevirtual

returns the M_useTranspose flag

Reimplemented from Preconditioner.

Definition at line 163 of file PreconditionerComposed.hpp.

◆ ApplyInverse()

virtual int ApplyInverse ( const Epetra_MultiVector X,
Epetra_MultiVector Y 
) const
inlinevirtual

Applies the inverse operator to an input vector.

Parameters
Xinput vector
Youtput vector

Reimplemented from Preconditioner.

Definition at line 173 of file PreconditionerComposed.hpp.

◆ Apply()

virtual int Apply ( const Epetra_MultiVector X,
Epetra_MultiVector Y 
) const
inlinevirtual

Applies the operator to an input vector.

Parameters
Xinput vector
Youtput vector

Reimplemented from Preconditioner.

Definition at line 183 of file PreconditionerComposed.hpp.

◆ OperatorRangeMap()

const Epetra_Map& OperatorRangeMap ( ) const
inlinevirtual

returns the range map

Reimplemented from Preconditioner.

Definition at line 189 of file PreconditionerComposed.hpp.

◆ OperatorDomainMap()

const Epetra_Map& OperatorDomainMap ( ) const
inlinevirtual

returns the domain map

Reimplemented from Preconditioner.

Definition at line 195 of file PreconditionerComposed.hpp.

◆ preconditioner()

Preconditioner::prec_raw_type * preconditioner ( )
virtual

returns a raw pointer to the preconditioner base class

Implements Preconditioner.

Definition at line 101 of file PreconditionerComposed.cpp.

◆ number()

UInt number ( ) const
inline

returms the number of factors in the preconditioner

Definition at line 207 of file PreconditionerComposed.hpp.

◆ preconditionerPtr()

super_Type::prec_type preconditionerPtr ( )
inlinevirtual

returns a shared pointer to the preconditioner

Implements Preconditioner.

Definition at line 213 of file PreconditionerComposed.hpp.

◆ composedPreconditionerPtr()

const precPtr_Type composedPreconditionerPtr ( )
inline

returns a shared pointer to the preconditioner

Definition at line 219 of file PreconditionerComposed.hpp.

◆ preconditionerType()

std::string preconditionerType ( )
inlinevirtual

returns a string identifying the preconditioner type

Implements Preconditioner.

Definition at line 225 of file PreconditionerComposed.hpp.

◆ createComposedPreconditioner()

static Preconditioner* createComposedPreconditioner ( )
inlinestatic

Factory method.

Definition at line 235 of file PreconditionerComposed.hpp.

◆ myCreateParametersList()

void myCreateParametersList ( const GetPot dataFile,
const std::string &  section,
const std::string &  subSection 
)
private

See http://trilinos.sandia.gov/packages/docs/r9.0/packages/ifpack/doc/html/index.html for more informations on the parameters

Definition at line 79 of file PreconditionerComposed.cpp.

+ Here is the caller graph for this function:

◆ createPrec()

Int createPrec ( operatorPtr_Type oper,
std::shared_ptr< Preconditioner > &  prec 
)
private

Definition at line 187 of file PreconditionerComposed.cpp.

Field Documentation

◆ M_operVector

std::vector<operatorPtr_Type> M_operVector
private

Definition at line 254 of file PreconditionerComposed.hpp.

◆ M_prec

precPtr_Type M_prec
private

Definition at line 255 of file PreconditionerComposed.hpp.

◆ registerComposed

bool registerComposed = PRECFactory::instance().registerProduct ( "Composed", &PreconditionerComposed::createComposedPreconditioner )
staticprivate

Definition at line 256 of file PreconditionerComposed.hpp.


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