00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_INVERSEOPERATOR_DECL_HPP 00006 #define PLAYA_INVERSEOPERATOR_DECL_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "PlayaLinearOperatorDecl.hpp" 00010 #include "PlayaLinearOpWithSpacesDecl.hpp" 00011 #include "Teuchos_RCP.hpp" 00012 #include "PlayaLinearSolverDecl.hpp" 00013 #include "PlayaSolverState.hpp" 00014 00015 namespace Playa 00016 { 00017 using Teuchos::RCP; 00018 00019 /** 00020 * PlayaInverseOperator represents the inverse of some other operator. An 00021 * inverse operator object will contain an operator and a solver. The 00022 * operator data member is the operator whose inverse this represents. The 00023 * solver data member is the solver that will be used in applying the 00024 * inverse. If the solver is null, the operator is assumed to have 00025 * self-contained ability to solve systems, as for a dense matrix that 00026 * does solves by factoring and backsolves. 00027 */ 00028 template <class Scalar> 00029 class InverseOperator : public LinearOpWithSpaces<Scalar>, 00030 public Printable 00031 { 00032 public: 00033 /** 00034 * Ctor with a linear operator and a solver specified. 00035 */ 00036 InverseOperator(const LinearOperator<Scalar>& op, 00037 const LinearSolver<Scalar>& solver); 00038 00039 /** Virtual dtor */ 00040 virtual ~InverseOperator(){;} 00041 00042 /** 00043 * Apply the operator. 00044 * 00045 * \param applyType Indicates whether to apply the operator, its transpose, 00046 * or its conjugate transpose. 00047 * \param in The vector on which the operator is to act 00048 * \param out The vector into which the result of the operation 00049 * is to be written. This vector should already be initialized by the 00050 * appropriate space. 00051 **/ 00052 virtual void apply( 00053 Teuchos::ETransp applyType, 00054 const Vector<Scalar>& in, 00055 Vector<Scalar> out) const ; 00056 00057 00058 00059 /** */ 00060 void print(std::ostream& os) const ; 00061 00062 /** */ 00063 LinearOperator<Scalar> op() const {return op_;} 00064 00065 00066 private: 00067 const LinearOperator<Scalar> op_; 00068 const LinearSolver<Scalar> solver_; 00069 std::string msg_; 00070 }; 00071 00072 00073 /** \brief Implicit inverse operator. */ 00074 template <class Scalar> 00075 LinearOperator<Scalar> 00076 inverse(const LinearOperator<Scalar>& op, 00077 const LinearSolver<Scalar>& solver); 00078 00079 00080 } 00081 00082 #endif