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 TSFMULTIVECTOROPERATOR_DECL_HPP 00030 #define TSFMULTIVECTOROPERATOR_DECL_HPP 00031 00032 #include "SundanceDefs.hpp" 00033 #include "TSFRowAccessibleOp.hpp" 00034 #include "TSFOpWithBackwardsCompatibleApply.hpp" 00035 #include "TSFLinearOperatorDecl.hpp" 00036 #include "SundanceHandleable.hpp" 00037 #include "Teuchos_RefCountPtr.hpp" 00038 #include "TSFVectorDecl.hpp" 00039 00040 namespace TSFExtended 00041 { 00042 /** 00043 * A MultiVectorOperator is a linear operator whose 00044 * rows or columns are represented as a multivector 00045 */ 00046 template <class Scalar> 00047 class MultiVectorOperator 00048 : public OpWithBackwardsCompatibleApply<Scalar>, 00049 public RowAccessibleOp<Scalar> 00050 { 00051 public: 00052 00053 /** 00054 * Construct from an array of vectors and a specifier for the 00055 * domain space. 00056 */ 00057 MultiVectorOperator(const Teuchos::Array<Vector<Scalar> >& cols, 00058 const VectorSpace<Scalar>& domain); 00059 00060 /** Virtual dtor */ 00061 virtual ~MultiVectorOperator(){;} 00062 00063 00064 /** 00065 * Apply does an element-by-element multiply between the input 00066 * vector, x, and the diagonal values. 00067 */ 00068 virtual void generalApply( 00069 const Thyra::EOpTransp M_trans, 00070 const Thyra::VectorBase<Scalar> &x, 00071 Thyra::VectorBase<Scalar> *y, 00072 const Scalar alpha = 1.0, 00073 const Scalar beta = 0.0 00074 ) const ; 00075 00076 00077 /** Return the domain of the operator */ 00078 RCP< const Thyra::VectorSpaceBase<Scalar> > domain() const ; 00079 00080 00081 /** Return the range of the operator */ 00082 RCP< const Thyra::VectorSpaceBase<Scalar> > range() const ; 00083 00084 00085 00086 /** Return the kth row */ 00087 void getRow(const int& k, 00088 Teuchos::Array<int>& indices, 00089 Teuchos::Array<Scalar>& values) const ; 00090 00091 private: 00092 00093 Teuchos::Array<Vector<Scalar> > cols_; 00094 VectorSpace<Scalar> domain_; 00095 VectorSpace<Scalar> range_; 00096 }; 00097 00098 /** \relates MultiVectorOperator */ 00099 template <class Scalar> 00100 LinearOperator<Scalar> multiVectorOperator( 00101 const Teuchos::Array<Vector<Scalar> >& cols, 00102 const VectorSpace<Scalar>& domain); 00103 } 00104 00105 #endif