LifeV
CompositeOperator.hpp
Go to the documentation of this file.
1 /*
2  * CompositeOperator.hpp
3  *
4  * Created on: Jul 28, 2012
5  * Author: uvilla
6  */
7 
8 #ifndef COMPOSITEOPERATOR_HPP_
9 #define COMPOSITEOPERATOR_HPP_
10 
11 #include <lifev/core/linear_algebra/LinearOperatorAlgebra.hpp>
12 
13 namespace LifeV
14 {
15 
16 namespace Operators
17 {
18 
20 {
21 public:
23 
24  virtual ~CompositeOperator();
25 
26  //! \warning Transpose is not supported yet.
27  virtual int SetUseTranspose(bool /*UseTranspose*/) { return -1; }
28 
29  //! The first operator we push is the first to be applied
30  int pushBack( const operatorPtr_Type & op, const bool inverted);
31 
32  //! set whenever we want to define Apply or ApplyInverse
34 
35  //! @name Mathematical functions
36  //@{
37 
38  //! Applies all the operator (with their flags) starting from the first that was pushed
39  virtual int Apply(const vector_Type& X, vector_Type& Y) const;
40 
41  //! Applies all the operator (with their flags) starting from the first that was pushed
42  virtual int ApplyInverse(const vector_Type& X, vector_Type& Y) const;
43 
44  //! Returns the infinity norm of the global matrix.
45  virtual double NormInf() const { return -1;}
46  //@}
47 
48  //! @name Attribute access functions
49  //@{
50 
51  //! Returns a character string describing the operator
52  virtual const char * Label() const{ return "Operators::CompositeOperator \n";}
53 
54  //! Returns the current UseTranspose setting.
55  virtual bool UseTranspose() const { return false;}
56 
57  //! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise.
58  virtual bool HasNormInf() const {return false;}
59 
60  //! Returns a pointer to the Epetra_Comm communicator associated with this operator.
61  virtual const comm_Type & Comm() const { return (*ops.begin())->Comm(); }
62 
63  //! Returns the raw_map object associated with the domain of this operator.
64  virtual const map_Type & OperatorDomainMap() const { return ops.front()->OperatorDomainMap(); }
65 
66  //! Returns the raw_map object associated with the range of this operator.
67  virtual const map_Type & OperatorRangeMap() const { return ops.back()->OperatorRangeMap(); }
68  //@}
69 
70 private:
71 
72  int allocateTmpVects(const vector_Type& X, vector_Type& Y) const;
73  void deleteTmpVects() const;
74 
80 
81 };
82 
83 } /* namespace Operators */
84 } /* namespace LifeV */
85 #endif /* COMPOSITEOPERATOR_HPP_ */
virtual int ApplyInverse(const vector_Type &X, vector_Type &Y) const
Applies all the operator (with their flags) starting from the first that was pushed.
virtual bool UseTranspose() const
Returns the current UseTranspose setting.
std::vector< operatorPtr_Type > ops
Abstract class which defines the interface of a Linear Operator.
int pushBack(const operatorPtr_Type &op, const bool inverted)
The first operator we push is the first to be applied.
void updateInverseJacobian(const UInt &iQuadPt)
virtual int Apply(const vector_Type &X, vector_Type &Y) const
Applies all the operator (with their flags) starting from the first that was pushed.
virtual const char * Label() const
Returns a character string describing the operator.
virtual double NormInf() const
Returns the infinity norm of the global matrix.
void DefineAlreadyInverted()
set whenever we want to define Apply or ApplyInverse
int allocateTmpVects(const vector_Type &X, vector_Type &Y) const
std::vector< Epetra_MultiVector * > vects
virtual const map_Type & OperatorDomainMap() const
Returns the raw_map object associated with the domain of this operator.
virtual bool HasNormInf() const
Returns true if the this object can provide an approximate Inf-norm, false otherwise.
virtual const map_Type & OperatorRangeMap() const
Returns the raw_map object associated with the range of this operator.
virtual const comm_Type & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this operator.
std::shared_ptr< operator_Type > operatorPtr_Type