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 TSFSIMPLIFIEDOPBASE_DECL_HPP 00030 #define TSFSIMPLIFIEDOPBASE_DECL_HPP 00031 00032 #include "SundanceDefs.hpp" 00033 #include "SundanceOut.hpp" 00034 #include "TSFOpWithBackwardsCompatibleApply.hpp" 00035 #include "TSFVectorDecl.hpp" 00036 00037 00038 00039 00040 namespace TSFExtended 00041 { 00042 using namespace Teuchos; 00043 using namespace Thyra; 00044 00045 /** 00046 * SimplifiedLinearOpBase provides a simplified apply() interface 00047 * in terms of handle classes. Writers of operator subtypes 00048 * can optionally use this interface to be able to work with handle 00049 * classes rather than raw pointers and such. 00050 */ 00051 template <class Scalar> 00052 class SimplifiedLinearOpBase 00053 : public OpWithBackwardsCompatibleApply<Scalar> 00054 { 00055 public: 00056 00057 00058 /** 00059 * 00060 */ 00061 virtual void applyOp(const Thyra::EOpTransp M_trans, 00062 const Vector<Scalar>& in, 00063 Vector<Scalar> out) const = 0 ; 00064 00065 00066 /** 00067 * generalApply() applies either the operator or the transpose 00068 * according to the value of the transpose flag. This method is 00069 * backwards compatible with TSFCore-based code. 00070 */ 00071 void generalApply(const Thyra::EOpTransp M_trans, 00072 const Thyra::VectorBase<Scalar> &x, 00073 Thyra::VectorBase<Scalar>* y, 00074 const Scalar alpha = Teuchos::ScalarTraits<Scalar>::one(), 00075 const Scalar beta = Teuchos::ScalarTraits<Scalar>::zero()) const ; 00076 00077 }; 00078 00079 00080 /** 00081 * SimplifiedLinearOpWithSpaces extends SimplifiedLinearOpBase to store 00082 * the range and domain spaces. 00083 */ 00084 template <class Scalar> 00085 class SimplifiedLinearOpWithSpaces 00086 : public SimplifiedLinearOpBase<Scalar> 00087 { 00088 public: 00089 /** */ 00090 SimplifiedLinearOpWithSpaces(const VectorSpace<Scalar>& domain, 00091 const VectorSpace<Scalar>& range); 00092 00093 /** 00094 * \brief Return a smart pointer for the range space 00095 * for <tt>this</tt> operator. 00096 */ 00097 RCP< const VectorSpaceBase<Scalar> > range() const ; 00098 00099 /** \brief Return a smart pointer for the domain space for <tt>this</tt> operator. 00100 */ 00101 RCP< const VectorSpaceBase<Scalar> > domain() const ; 00102 00103 private: 00104 VectorSpace<Scalar> range_; 00105 VectorSpace<Scalar> domain_; 00106 00107 }; 00108 00109 } 00110 00111 #endif