LifeV
InvertibleOperator.hpp
Go to the documentation of this file.
1 /*
2  * InvertibleOperator.hpp
3  *
4  * Created on: Sep 3, 2010
5  * Author: uvilla
6  */
7 
8 #ifndef INVERTIBLEOPERATOR_HPP_
9 #define INVERTIBLEOPERATOR_HPP_
10 
11 #include <Teuchos_ParameterList.hpp>
12 #include <Teuchos_RCPDecl.hpp>
13 
14 #include <lifev/core/linear_algebra/LinearOperatorAlgebra.hpp>
15 #include <lifev/core/util/FactorySingleton.hpp>
16 #include <lifev/core/util/Factory.hpp>
17 #include <lifev/core/array/VectorEpetra.hpp>
18 
19 namespace LifeV
20 {
21 namespace Operators
22 {
23 //! @class InvertibleOperator
24 /*! @brief Abstract class which defines the interface of an Invertible Linear Operator Algebra.
25  *
26  */
28 {
29 public:
30 
32 
33  //! @name Attribute set methods
34  //@{
35 
36  //! If set true, transpose of this operator will be applied.
37  virtual int SetUseTranspose(bool useTranspose);
38 
39  void setOperator(const operatorPtr_Type & _oper);
40 
41  void setPreconditioner(const operatorPtr_Type & _prec);
42 
43  void setParameterList(const Teuchos::ParameterList & _pList);
44 
45  //@}
46 
47  //! @name Mathematical functions
48  //@{
49 
50  //! Returns the result of a Epetra_Operator applied to a vector_Type X in Y.
51  virtual int Apply(const vector_Type& X, vector_Type& Y) const;
52 
53  //! Returns the result of a Epetra_Operator inverse applied to an vector_Type X in Y.
54  virtual int ApplyInverse(const vector_Type& X, vector_Type& Y) const;
55 
56  int NumIter() const {return M_numIterations;}
57 
58  double TimeSolver() const {return M_solutionTime;}
59 
60  //! Returns the infinity norm of the global matrix.
61  double NormInf() const {return M_oper->NormInf();}
62 
63  //@}
64 
65  //! @name Attribute access functions
66  //@{
67 
68  //! Returns a character string describing the operator
69  virtual const char * Label() const {return M_name.c_str();}
70 
71  //! Returns the current UseTranspose setting.
72  virtual bool UseTranspose() const {return M_useTranspose;}
73 
74  //! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise.
75  virtual bool HasNormInf() const {return M_oper->HasNormInf();}
76 
77  //! Returns a pointer to the Epetra_Comm communicator associated with this operator.
78  virtual const comm_Type & Comm() const {return M_oper->Comm();}
79 
80  //! Returns the Epetra_Map object associated with the domain of this operator.
81  virtual const map_Type & OperatorDomainMap() const {return M_oper->OperatorDomainMap();}
82 
83  //! Returns the Epetra_Map object associated with the range of this operator.
84  virtual const map_Type & OperatorRangeMap() const {return M_oper->OperatorRangeMap();}
85 
86  //@}
87 protected:
88 
89  virtual int doApplyInverse(const vector_Type& X, vector_Type& Y) const = 0;
90  virtual void doSetOperator() = 0;
91  virtual void doSetPreconditioner() = 0;
92  virtual void doSetParameterList() = 0;
93 
94  //! The name of the Operator
95  std::string M_name;
96  //! The list of Parameter to feed the linear solver
98 
99  //! The preconditioner operator (the boost copy makes sure that the preconditioner is still alive; see .cpp file for details)
102 
103  //! The operator to be solved (the boost copy makes sure that the operator is still alive; see .cpp file for details)
106  //! Whenever to use the transpose
108 
109  //! Number of iterations performed by the solver
110  mutable int M_numIterations;
111 
112  //! Time spent to solve the linear system
113  mutable double M_solutionTime;
114 };
115 
117 
118 } // Namespace Operators
119 
120 } // Namespace LifeV
121 
122 #endif // INVERTIBLEOPERATOR_HPP_
virtual const map_Type & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
Teuchos::RCP< Epetra_Operator > M_oper
The operator to be solved (the boost copy makes sure that the operator is still alive; see ...
double NormInf() const
Returns the infinity norm of the global matrix.
virtual const char * Label() const
Returns a character string describing the operator.
Abstract class which defines the interface of a Linear Operator.
bool M_useTranspose
Whenever to use the transpose.
void updateInverseJacobian(const UInt &iQuadPt)
virtual const comm_Type & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
virtual int doApplyInverse(const vector_Type &X, vector_Type &Y) const =0
Teuchos::RCP< Epetra_Operator > M_prec
The preconditioner operator (the boost copy makes sure that the preconditioner is still alive; see ...
virtual int Apply(const vector_Type &X, vector_Type &Y) const
Returns the result of a Epetra_Operator applied to a vector_Type X in Y.
int M_numIterations
Number of iterations performed by the solver.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
Abstract class which defines the interface of an Invertible Linear Operator Algebra.
std::shared_ptr< Epetra_Operator > M_operBoost
double M_solutionTime
Time spent to solve the linear system.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
std::string M_name
The name of the Operator.
virtual int ApplyInverse(const vector_Type &X, vector_Type &Y) const
Returns the result of a Epetra_Operator inverse applied to an vector_Type X in Y. ...
FactorySingleton< Factory< InvertibleOperator, std::string > > InvertibleOperatorFactory
void setPreconditioner(const operatorPtr_Type &_prec)
void setOperator(const operatorPtr_Type &_oper)
std::shared_ptr< Epetra_Operator > M_precBoost
virtual const map_Type & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
virtual int SetUseTranspose(bool useTranspose)
If set true, transpose of this operator will be applied.
std::shared_ptr< operator_Type > operatorPtr_Type
Teuchos::RCP< Teuchos::ParameterList > M_pList
The list of Parameter to feed the linear solver.
void setParameterList(const Teuchos::ParameterList &_pList)