TSFInverseOperatorDecl.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 /* ***********************************************************************
00003 // 
00004 //           TSFExtended: Trilinos Solver Framework Extended
00005 //                 Copyright (2004) Sandia Corporation
00006 // 
00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00008 // license for use of this work by or on behalf of the U.S. Government.
00009 // 
00010 // This library is free software; you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as
00012 // published by the Free Software Foundation; either version 2.1 of the
00013 // License, or (at your option) any later version.
00014 //  
00015 // This library is distributed in the hope that it will be useful, but
00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 // Lesser General Public License for more details.
00019 //  
00020 // You should have received a copy of the GNU Lesser General Public
00021 // License along with this library; if not, write to the Free Software
00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00023 // USA
00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00025 // 
00026 // **********************************************************************/
00027  /* @HEADER@ */
00028 
00029 #ifndef TSFINVERSEOPERATOR_DECL_HPP
00030 #define TSFINVERSEOPERATOR_DECL_HPP
00031 
00032 #include "SundanceDefs.hpp"
00033 #include "TSFLinearOperatorDecl.hpp"
00034 #include "Thyra_ZeroLinearOpBase.hpp"
00035 #include "TSFOpWithBackwardsCompatibleApply.hpp"
00036 #include "Thyra_VectorSpaceBase.hpp"
00037 
00038 #include "Teuchos_RefCountPtr.hpp"
00039 #include "TSFLinearSolverDecl.hpp"
00040 #include "TSFSolverState.hpp"
00041 
00042 namespace TSFExtended
00043 {
00044 using Teuchos::RCP;
00045 
00046 /** 
00047  * TSFInverseOperator represents the inverse of some other operator.  An
00048  * inverse operator object will contain an operator and a solver.  The 
00049  * operator data member is the operator whose inverse this represents.  The
00050  * solver data member is the solver that will be used in applying the
00051  * inverse.  If the solver is null, the operator is assumed to have
00052  * self-contained ability to solve systems, as for a dense matrix that 
00053  * does solves by factoring and backsolves.
00054  */
00055 template <class Scalar> 
00056 class InverseOperator : public OpWithBackwardsCompatibleApply<Scalar>,
00057   public Printable
00058 {
00059 public:
00060   /**
00061    * Ctor with a linear operator and a solver specified.
00062    */
00063   InverseOperator(const LinearOperator<Scalar>& op, 
00064     const LinearSolver<Scalar>& solver);
00065 
00066   /** Virtual dtor */
00067   virtual ~InverseOperator(){;}
00068 
00069 
00070   /** 
00071    * Compute alpha*M*x + beta*y, where M=*this.
00072    * @param M_trans specifies whether the operator is transposed:
00073    *                op(M) = M, for M_trans == NOTRANS
00074    *                op(M) = M', for M_trans == TRANS
00075    * @param x       vector of length this->domain()->dim()
00076    * @param y       vector of length this->range()->dim()
00077    * @param alpha   scalar multiplying M*x (default is 1.0)
00078    * @param beta    scalar multiplying y (default is 0.0)
00079    */
00080   virtual void generalApply(
00081     const Thyra::EOpTransp            M_trans,
00082     const Thyra::VectorBase<Scalar>    &x,
00083     Thyra::VectorBase<Scalar>          *y,
00084     const Scalar            alpha = 1.0,
00085     const Scalar            beta  = 0.0
00086     ) const ;
00087 
00088   /** 
00089    * Return the domain of the operator. 
00090    */
00091   virtual RCP<const Thyra::VectorSpaceBase<Scalar> > domain() const ;
00092     
00093 
00094   /** 
00095    * Return the range of the operator. 
00096    */
00097   virtual RCP<const Thyra::VectorSpaceBase<Scalar> > range() const ;
00098 
00099   /** */
00100   void print(std::ostream& os) const ;
00101 
00102 
00103 private:
00104   const LinearOperator<Scalar> op_;
00105   const LinearSolver<Scalar> solver_;  
00106   std::string msg_;
00107 };
00108 
00109 
00110 /** */
00111 template <class Scalar> 
00112 LinearOperator<Scalar> 
00113 inverse(const LinearOperator<Scalar>& op, 
00114   const LinearSolver<Scalar>& solver);
00115   
00116 
00117 }
00118 
00119 #endif

Site Contact