Thyra_SpmdMultiVectorBaseDecl.hpp

Go to the documentation of this file.
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_SPMD_MULTI_VECTOR_BASE_DECL_HPP
00030 #define THYRA_SPMD_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 
00039 template<class Scalar> class SpmdVectorSpaceBase;
00040 
00097 template<class Scalar>
00098 class SpmdMultiVectorBase
00099   : virtual public MultiVectorDefaultBase<Scalar>
00100   , virtual public SingleScalarEuclideanLinearOpBase<Scalar>
00101 {
00102 public:
00103 
00105   using SingleScalarEuclideanLinearOpBase<Scalar>::euclideanApply;
00107   using SingleScalarEuclideanLinearOpBase<Scalar>::apply;
00109   using MultiVectorDefaultBase<Scalar>::applyOp;
00110 
00113 
00115   SpmdMultiVectorBase();
00116 
00118 
00121 
00125   virtual Teuchos::RefCountPtr<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const = 0;
00126 
00149   virtual void getLocalData( Scalar **localValues, Index *leadingDim ) = 0;
00150 
00164   virtual void commitLocalData( Scalar *localValues ) = 0;
00165 
00184   virtual void getLocalData( const Scalar **localValues, Index *leadingDim ) const = 0;
00185 
00199   virtual void freeLocalData( const Scalar *localValues ) const = 0;
00200 
00202 
00205 
00207   Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase<Scalar> > rangeScalarProdVecSpc() const;
00208 
00210 
00213 
00216   void apply(
00217     const ETransp                     M_trans
00218     ,const MultiVectorBase<Scalar>    &X
00219     ,MultiVectorBase<Scalar>          *Y
00220     ,const Scalar                     alpha
00221     ,const Scalar                     beta
00222     ) const;
00223 
00225 
00229   void applyOp(
00230     const RTOpPack::RTOpT<Scalar>         &primary_op
00231     ,const int                            num_multi_vecs
00232     ,const MultiVectorBase<Scalar>*const  multi_vecs[]
00233     ,const int                            num_targ_multi_vecs
00234     ,MultiVectorBase<Scalar>*const        targ_multi_vecs[]
00235     ,RTOpPack::ReductTarget*const         reduct_objs[]
00236     ,const Index                          primary_first_ele
00237     ,const Index                          primary_sub_dim
00238     ,const Index                          primary_global_offset
00239     ,const Index                          secondary_first_ele
00240     ,const Index                          secondary_sub_dim
00241     ) const;
00243   void acquireDetachedView(
00244     const Range1D                       &rowRng
00245     ,const Range1D                      &colRng
00246     ,RTOpPack::ConstSubMultiVectorView<Scalar>  *sub_mv
00247     ) const;
00249   void releaseDetachedView( RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv ) const;
00251   void acquireDetachedView(
00252     const Range1D                                &rowRng
00253     ,const Range1D                               &colRng
00254     ,RTOpPack::SubMultiVectorView<Scalar>    *sub_mv
00255     );
00257   void commitDetachedView( RTOpPack::SubMultiVectorView<Scalar>* sub_mv );
00259 
00260 protected:
00261 
00264 
00269   bool opSupported(ETransp M_trans) const;
00270 
00276   void euclideanApply(
00277     const ETransp                     M_trans
00278     ,const MultiVectorBase<Scalar>    &X
00279     ,MultiVectorBase<Scalar>          *Y
00280     ,const Scalar                     alpha
00281     ,const Scalar                     beta
00282     ) const;
00283 
00285 
00288 
00297   virtual void updateSpmdSpace();
00298 
00303   Range1D validateRowRange( const Range1D& rowRng ) const;
00304 
00309   Range1D validateColRange( const Range1D& rowCol ) const;
00310 
00312   
00313 private:
00314   
00315   // ///////////////////////////////////////
00316   // Private data members
00317   
00318   mutable bool in_applyOp_;
00319 
00320   mutable Teuchos::BLAS<int,Scalar> blas_;
00321 
00322   // cached
00323   Index  globalDim_;
00324   Index  localOffset_;
00325   Index  localSubDim_;
00326   Index  numCols_;
00327   
00328 }; // end class SpmdMultiVectorBase
00329 
00330 } // end namespace Thyra
00331 
00332 #endif // THYRA_SPMD_MULTI_VECTOR_BASE_DECL_HPP

Generated on Thu Sep 18 12:33:03 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1