Thyra_SerialMultiVectorBaseDecl.hpp

00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //    Thyra: Interfaces and Support for Abstract Numerical Algorithms
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 THYRA_SERIAL_MULTI_VECTOR_BASE_DECL_HPP
00030 #define THYRA_SERIAL_MULTI_VECTOR_BASE_DECL_HPP
00031 
00032 #include "Thyra_MultiVectorDefaultBaseDecl.hpp"
00033 #include "Thyra_SingleScalarEuclideanLinearOpBaseDecl.hpp"
00034 #include "Teuchos_BLAS.hpp"
00035 
00036 namespace Thyra {
00037 
00065 template<class Scalar>
00066 class SerialMultiVectorBase
00067   : virtual public MultiVectorDefaultBase<Scalar>
00068   , virtual protected SingleScalarEuclideanLinearOpBase<Scalar>
00069 {
00070 public:
00071 
00073   using SingleScalarEuclideanLinearOpBase<Scalar>::euclideanApply;
00075   using MultiVectorDefaultBase<Scalar>::applyOp;
00076 
00079 
00081   SerialMultiVectorBase();
00082 
00084 
00087 
00097   virtual void getData( const Scalar **values, Index *leadingDim ) const = 0;
00098 
00104   virtual void freeData( const Scalar *values ) const = 0;
00105 
00117   virtual void getData( Scalar **values, Index *leadingDim ) = 0;
00118 
00124   virtual void commitData( Scalar *values ) = 0;
00125 
00127 
00130 
00133   /*
00134   void apply(
00135     const ETransp                     M_trans
00136     ,const MultiVectorBase<Scalar>    &X
00137     ,MultiVectorBase<Scalar>          *Y
00138     ,const Scalar                     alpha
00139     ,const Scalar                     beta
00140     ) const;
00141   */
00142 
00144 
00148   void applyOp(
00149     const RTOpPack::RTOpT<Scalar>   &primary_op
00150     ,const int                      num_multi_vecs
00151     ,const MultiVectorBase<Scalar>* multi_vecs[]
00152     ,const int                      num_targ_multi_vecs
00153     ,MultiVectorBase<Scalar>*       targ_multi_vecs[]
00154     ,RTOpPack::ReductTarget*        reduct_objs[]
00155     ,const Index                    primary_first_ele
00156     ,const Index                    primary_sub_dim
00157     ,const Index                    primary_global_offset
00158     ,const Index                    secondary_first_ele
00159     ,const Index                    secondary_sub_dim
00160     ) const;
00162   void getSubMultiVector(
00163     const Range1D                       &rowRng
00164     ,const Range1D                      &colRng
00165     ,RTOpPack::SubMultiVectorT<Scalar>  *sub_mv
00166     ) const;
00168   void freeSubMultiVector( RTOpPack::SubMultiVectorT<Scalar>* sub_mv ) const;
00170   void getSubMultiVector(
00171     const Range1D                                &rowRng
00172     ,const Range1D                               &colRng
00173     ,RTOpPack::MutableSubMultiVectorT<Scalar>    *sub_mv
00174     );
00176   void commitSubMultiVector( RTOpPack::MutableSubMultiVectorT<Scalar>* sub_mv );
00178 
00179 protected:
00180 
00183 
00188   bool opSupported(ETransp M_trans) const;
00189 
00194   void euclideanApply(
00195     const ETransp                     M_trans
00196     ,const MultiVectorBase<Scalar>    &X
00197     ,MultiVectorBase<Scalar>          *Y
00198     ,const Scalar                     alpha
00199     ,const Scalar                     beta
00200     ) const;
00201 
00203 
00206 
00214   virtual void updateSpace();
00215 
00220   Range1D validateRowRange( const Range1D& rowRng ) const;
00221 
00226   Range1D validateColRange( const Range1D& rowCol ) const;
00227 
00229   
00230 private:
00231   
00232   // ///////////////////////////////////////
00233   // Private data members
00234   
00235   mutable bool in_applyOp_;
00236 
00237   mutable Teuchos::BLAS<int,Scalar> blas_;
00238 
00239   // cached
00240   Index  numRows_;
00241   Index  numCols_;
00242   
00243 }; // end class SerialMultiVectorBase
00244 
00245 } // end namespace Thyra
00246 
00247 #endif // THYRA_SERIAL_MULTI_VECTOR_BASE_DECL_HPP

Generated on Thu Sep 18 12:39:52 2008 for Thyra ANA Operator/VectorBase Interfaces and Related Software by doxygen 1.3.9.1