LifeV
ComposedOperator< OperatorType > Class Template Reference

ComposedOperator -. More...

#include <ComposedOperator.hpp>

+ Inheritance diagram for ComposedOperator< OperatorType >:
+ Collaboration diagram for ComposedOperator< OperatorType >:

Typedefs

typedef OperatorType operator_Type
 
typedef std::shared_ptr< operator_TypeoperatorPtr_Type
 

Constructors, destructor

 ComposedOperator (const std::shared_ptr< Epetra_Comm > &comm)
 The constructor builds an empty chain of composed operators. More...
 
 ComposedOperator (const ComposedOperator< operator_Type > &P)
 Copy constructor: it doesn't make a real copy of the operators, it just copies the vector of shared pointer (note that the implementation is mandatory in order to avoid a bit-copy of the shared_ptr vector) More...
 
virtual ~ComposedOperator ()
 

Public Methods

UInt push_back (operatorPtr_Type P, const bool useInverse=false, const bool useTranspose=false, const bool summed=false)
 Method to add an operator at the end of the operators list. More...
 
UInt push_back (operator_Type *P, const bool useInverse=false, const bool useTranspose=false, const bool summed=false)
 Method to add an operator at the end of the operators list. More...
 
UInt replace (operatorPtr_Type P, const UInt index, const bool useInverse=false, const bool useTranspose=false)
 we expecte an external matrix shared pointer, we will not destroy the matrix! remember: P = M_operator(0) * ... More...
 
void reset ()
 Resets all the factors in the operator. More...
 
void swap (UInt first, UInt second)
 swaps two factors More...
 
void resetOperator ()
 resets the sandard vector holding all the factors More...
 

Implementation of Epetra_Operator Methods

int SetUseTranspose (bool UseTranspose)
 Method to set the flag M_useTranspose, which specifies if the composed operator is to be transposed. More...
 
int Apply (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 Method returning the result of applying the operator to a vector. More...
 
int ApplyInverse (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 
double NormInf () const
 Returns the quantity $ \| A \|_\infty$ such that

\[\| A \|_\infty = \max_{1\le i\le m} \sum_{j=1}^n |a_{ij}| \]

. More...

 
double Condest () const
 Returns an estimation of the condition number. More...
 
const char * Label () const
 Method returning a string identifying the type of operator. More...
 
bool UseTranspose () const
 Returns true if all the operators composed have to be considered transpose (i.e. More...
 
bool HasNormInf () const
 Never called: it is implemented for compatibility with Epetra_Operator. More...
 
const Epetra_Comm & Comm () const
 Returns the communicator. More...
 
const std::shared_ptr< Epetra_Comm > commPtr () const
 Returns a shared pointer to the communicator. More...
 
const Epetra_Map & OperatorDomainMap () const
 returns the OperatorDomainMap of the operators contained More...
 
const Epetra_Map & OperatorRangeMap () const
 returns the OperatorRangeMap of the operators contained More...
 
const std::vector< operatorPtr_Type > & Operator () const
 Public Get Methods. More...
 
std::vector< operatorPtr_Type > & OperatorView () const
 returns the std::vector of factors by (non const) reference More...
 
bool allTranspose () const
 Returns true if the operator is transposed. More...
 
const std::vector< bool > & transpose () const
 Returns a vector saying for each factor if it is considered transposed or not. More...
 
const std::vector< ID > & summed () const
 Returns a vector of UInt specifying the form of the operator. More...
 
const std::vector< bool > & inverse () const
 Returns a vector saying which factors have to be considered as inverse. More...
 
UInt number () const
 returns the number of factors present in the operator More...
 
const doublemeanIter () const
 
int numCalled () const
 
const Displayerdisplayer ()
 

Setter Methods

{ Sets the MPI communicator

void setComm (const std::shared_ptr< Epetra_Comm > comm)
 Set Methods. More...
 

Protected Methods

}

{

int Apply_DirectOperator (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 Protected Methods. More...
 
int Apply_InverseOperator (const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
 

Protected Members

{

std::vector< operatorPtr_TypeM_operator
 
std::vector< bool > M_inverse
 
std::vector< bool > M_transpose
 
std::vector< IDM_summed
 
bool M_allTranspose
 
UInt M_set
 
double M_meanIter
 
int M_numCalled
 
Displayer M_displayer
 

Detailed Description

template<typename OperatorType>
class LifeV::ComposedOperator< OperatorType >

ComposedOperator -.

Author
Simone Deparis, Paolo Crosetto Paolo Crosetto Class handling a preconditioner defined as a composition of operators. The class is templated so that the operators that define the preconditioner can be general (matrices, other preconditioners, other composed preconditioners, etc.).

Definition at line 64 of file ComposedOperator.hpp.

Member Typedef Documentation

◆ operator_Type

typedef OperatorType operator_Type

Definition at line 73 of file ComposedOperator.hpp.

◆ operatorPtr_Type

typedef std::shared_ptr<operator_Type> operatorPtr_Type

Definition at line 74 of file ComposedOperator.hpp.

Constructor & Destructor Documentation

◆ ComposedOperator() [1/2]

ComposedOperator ( const std::shared_ptr< Epetra_Comm > &  comm)

The constructor builds an empty chain of composed operators.

Constructors and Destructor.

The resulting operator shall be equal to the identity.

Definition at line 340 of file ComposedOperator.hpp.

◆ ComposedOperator() [2/2]

Copy constructor: it doesn't make a real copy of the operators, it just copies the vector of shared pointer (note that the implementation is mandatory in order to avoid a bit-copy of the shared_ptr vector)

Definition at line 355 of file ComposedOperator.hpp.

◆ ~ComposedOperator()

~ComposedOperator ( )
virtual

Definition at line 374 of file ComposedOperator.hpp.

Member Function Documentation

◆ push_back() [1/2]

UInt push_back ( operatorPtr_Type  P,
const bool  useInverse = false,
const bool  useTranspose = false,
const bool  summed = false 
)

Method to add an operator at the end of the operators list.

we expect an external Operator shared pointer, we will not destroy the matrix! remember: P = M_operator(0) * ... * M_operator(Qp-1)

Parameters
Pthe operator
useTransposeflag specifying if we want to applly the transposed operator
summedflag specifying if we want the operator to be summed. Note that the operator would be "out of the vector", summed in a second step after all the multiplications.

Definition at line 398 of file ComposedOperator.hpp.

◆ push_back() [2/2]

UInt push_back ( operator_Type P,
const bool  useInverse = false,
const bool  useTranspose = false,
const bool  summed = false 
)

Method to add an operator at the end of the operators list.

Public Methods.

Deprecated. The input parameter P is a standard pointer.

Parameters
Pthe operator
useTransposeflag specifying if we want to applly the transposed operator
summedflag specifying if we want the operator to be summed. Note that the operator would be "out of the vector", summed in a second step after all the multiplications.

Definition at line 385 of file ComposedOperator.hpp.

◆ replace()

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

we expecte an external matrix shared pointer, we will not destroy the matrix! remember: P = M_operator(0) * ...

  • M_operator(Qp-1) Method to replace an operator in a specified position of the operators vector.
    Parameters
    Pinput operator
    indexposition (starting from 0)
    useInverseflag specifying if the operator is already inverted (if AllpyInverse() is implemented)

Definition at line 435 of file ComposedOperator.hpp.

◆ reset()

void reset ( )

Resets all the factors in the operator.

Calls reset() on all the factors

Definition at line 469 of file ComposedOperator.hpp.

◆ swap()

void swap ( UInt  first,
UInt  second 
)

swaps two factors

Swaps the factors and all the related flags (useTranspose, etc...)

Parameters
firstfirst factor
secondsecond factor

Definition at line 479 of file ComposedOperator.hpp.

◆ resetOperator()

void resetOperator ( )
inline

resets the sandard vector holding all the factors

calls clear on the std::vector

Todo:
change name in e.g.

resetOperator

Definition at line 156 of file ComposedOperator.hpp.

◆ SetUseTranspose()

int SetUseTranspose ( bool  UseTranspose)

Method to set the flag M_useTranspose, which specifies if the composed operator is to be transposed.

Implementation of Epetra_Operator methods.

Definition at line 492 of file ComposedOperator.hpp.

◆ Apply()

int Apply ( const Epetra_MultiVector X,
Epetra_MultiVector Y 
) const

Method returning the result of applying the operator to a vector.

Parameters
Xinput vector
Youtput vector

Definition at line 519 of file ComposedOperator.hpp.

◆ ApplyInverse()

int ApplyInverse ( const Epetra_MultiVector X,
Epetra_MultiVector Y 
) const

Definition at line 527 of file ComposedOperator.hpp.

◆ NormInf()

double NormInf ( ) const

Returns the quantity $ \| A \|_\infty$ such that

\[\| A \|_\infty = \max_{1\le i\le m} \sum_{j=1}^n |a_{ij}| \]

.

Warning
This method must not be called unless HasNormInf() returns true.

Definition at line 533 of file ComposedOperator.hpp.

◆ Condest()

double Condest ( ) const

Returns an estimation of the condition number.

the estimation is devised from an estimation on each factor with the rule $ K_{12}\leq K_1K_2 $

Definition at line 540 of file ComposedOperator.hpp.

◆ Label()

const char * Label ( ) const

Method returning a string identifying the type of operator.

Definition at line 560 of file ComposedOperator.hpp.

◆ UseTranspose()

bool UseTranspose ( ) const

Returns true if all the operators composed have to be considered transpose (i.e.

Get Methods.

if M_allTranspose==true)

Definition at line 570 of file ComposedOperator.hpp.

◆ HasNormInf()

bool HasNormInf ( ) const

Never called: it is implemented for compatibility with Epetra_Operator.

Definition at line 577 of file ComposedOperator.hpp.

◆ Comm()

const Epetra_Comm & Comm ( ) const

Returns the communicator.

Definition at line 585 of file ComposedOperator.hpp.

◆ commPtr()

const std::shared_ptr< Epetra_Comm > commPtr ( ) const

Returns a shared pointer to the communicator.

Definition at line 594 of file ComposedOperator.hpp.

◆ OperatorDomainMap()

const Epetra_Map & OperatorDomainMap ( ) const

returns the OperatorDomainMap of the operators contained

Definition at line 602 of file ComposedOperator.hpp.

◆ OperatorRangeMap()

const Epetra_Map & OperatorRangeMap ( ) const

returns the OperatorRangeMap of the operators contained

Definition at line 611 of file ComposedOperator.hpp.

◆ Operator()

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

Public Get Methods.

returns a const reference tor the std::vector of factors

Definition at line 235 of file ComposedOperator.hpp.

◆ OperatorView()

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

returns the std::vector of factors by (non const) reference

Definition at line 243 of file ComposedOperator.hpp.

◆ allTranspose()

bool allTranspose ( ) const
inline

Returns true if the operator is transposed.

The operator transposed means that all its factors have to be considered transposed

Definition at line 252 of file ComposedOperator.hpp.

◆ transpose()

const std::vector<bool>& transpose ( ) const
inline

Returns a vector saying for each factor if it is considered transposed or not.

Definition at line 258 of file ComposedOperator.hpp.

◆ summed()

const std::vector<ID>& summed ( ) const
inline

Returns a vector of UInt specifying the form of the operator.

The size of the vector corresponds to the number of '+' operation in the operator. Each element of the output vector says how many factors are there between two '+' operation. For instance for the operator AB+CDE the vector M_summed returned would be [2,3]

Definition at line 269 of file ComposedOperator.hpp.

◆ inverse()

const std::vector<bool>& inverse ( ) const
inline

Returns a vector saying which factors have to be considered as inverse.

Definition at line 275 of file ComposedOperator.hpp.

◆ number()

UInt number ( ) const
inline

returns the number of factors present in the operator

Definition at line 280 of file ComposedOperator.hpp.

◆ meanIter()

const double& meanIter ( ) const
inline

Definition at line 285 of file ComposedOperator.hpp.

◆ numCalled()

int numCalled ( ) const
inline

Definition at line 290 of file ComposedOperator.hpp.

◆ displayer()

const Displayer& displayer ( )
inline

Definition at line 295 of file ComposedOperator.hpp.

◆ setComm()

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

Set Methods.

Definition at line 624 of file ComposedOperator.hpp.

◆ Apply_DirectOperator()

int Apply_DirectOperator ( const Epetra_MultiVector X,
Epetra_MultiVector Y 
) const
protected

Protected Methods.

Definition at line 636 of file ComposedOperator.hpp.

◆ Apply_InverseOperator()

int Apply_InverseOperator ( const Epetra_MultiVector X,
Epetra_MultiVector Y 
) const
protected

Definition at line 692 of file ComposedOperator.hpp.

Field Documentation

◆ M_operator

std::vector<operatorPtr_Type> M_operator
mutableprotected

Definition at line 320 of file ComposedOperator.hpp.

◆ M_inverse

std::vector<bool> M_inverse
protected

Definition at line 321 of file ComposedOperator.hpp.

◆ M_transpose

std::vector<bool> M_transpose
protected

Definition at line 322 of file ComposedOperator.hpp.

◆ M_summed

std::vector<ID> M_summed
protected

Definition at line 323 of file ComposedOperator.hpp.

◆ M_allTranspose

bool M_allTranspose
protected

Definition at line 324 of file ComposedOperator.hpp.

◆ M_set

UInt M_set
protected

Definition at line 326 of file ComposedOperator.hpp.

◆ M_meanIter

double M_meanIter
mutableprotected

Definition at line 328 of file ComposedOperator.hpp.

◆ M_numCalled

int M_numCalled
mutableprotected

Definition at line 329 of file ComposedOperator.hpp.

◆ M_displayer

Displayer M_displayer
protected

Definition at line 331 of file ComposedOperator.hpp.


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