Thyra_MPIMultiVectorBaseDecl.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_MPI_MULTI_VECTOR_BASE_DECL_HPP
00030 #define THYRA_MPI_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 MPIVectorSpaceBase;
00040 
00108 template<class Scalar>
00109 class MPIMultiVectorBase
00110   : virtual public MultiVectorDefaultBase<Scalar>
00111   , virtual public SingleScalarEuclideanLinearOpBase<Scalar>
00112 {
00113 public:
00114 
00116   using SingleScalarEuclideanLinearOpBase<Scalar>::euclideanApply;
00118   using SingleScalarEuclideanLinearOpBase<Scalar>::apply;
00120   using MultiVectorDefaultBase<Scalar>::applyOp;
00121 
00124 
00126   MPIMultiVectorBase();
00127 
00129 
00132 
00135   virtual Teuchos::RefCountPtr<const MPIVectorSpaceBase<Scalar> > mpiSpace() const = 0;
00136 
00158   virtual void getLocalData( Scalar **localValues, Index *leadingDim ) = 0;
00159 
00173   virtual void commitLocalData( Scalar *localValues ) = 0;
00174 
00193   virtual void getLocalData( const Scalar **localValues, Index *leadingDim ) const = 0;
00194 
00208   virtual void freeLocalData( const Scalar *localValues ) const = 0;
00209 
00211 
00214 
00216   Teuchos::RefCountPtr< const ScalarProdVectorSpaceBase<Scalar> > rangeScalarProdVecSpc() const;
00217 
00219 
00222 
00225   void apply(
00226     const ETransp                     M_trans
00227     ,const MultiVectorBase<Scalar>    &X
00228     ,MultiVectorBase<Scalar>          *Y
00229     ,const Scalar                     alpha
00230     ,const Scalar                     beta
00231     ) const;
00232 
00234 
00238   void applyOp(
00239     const RTOpPack::RTOpT<Scalar>   &primary_op
00240     ,const int                      num_multi_vecs
00241     ,const MultiVectorBase<Scalar>* multi_vecs[]
00242     ,const int                      num_targ_multi_vecs
00243     ,MultiVectorBase<Scalar>*       targ_multi_vecs[]
00244     ,RTOpPack::ReductTarget*        reduct_objs[]
00245     ,const Index                    primary_first_ele
00246     ,const Index                    primary_sub_dim
00247     ,const Index                    primary_global_offset
00248     ,const Index                    secondary_first_ele
00249     ,const Index                    secondary_sub_dim
00250     ) const;
00252   void getSubMultiVector(
00253     const Range1D                       &rowRng
00254     ,const Range1D                      &colRng
00255     ,RTOpPack::SubMultiVectorT<Scalar>  *sub_mv
00256     ) const;
00258   void freeSubMultiVector( RTOpPack::SubMultiVectorT<Scalar>* sub_mv ) const;
00260   void getSubMultiVector(
00261     const Range1D                                &rowRng
00262     ,const Range1D                               &colRng
00263     ,RTOpPack::MutableSubMultiVectorT<Scalar>    *sub_mv
00264     );
00266   void commitSubMultiVector( RTOpPack::MutableSubMultiVectorT<Scalar>* sub_mv );
00268 
00269 protected:
00270 
00273 
00278   bool opSupported(ETransp M_trans) const;
00279 
00284   void euclideanApply(
00285     const ETransp                     M_trans
00286     ,const MultiVectorBase<Scalar>    &X
00287     ,MultiVectorBase<Scalar>          *Y
00288     ,const Scalar                     alpha
00289     ,const Scalar                     beta
00290     ) const;
00291 
00293 
00296 
00303   virtual void updateMpiSpace();
00304 
00309   Range1D validateRowRange( const Range1D& rowRng ) const;
00310 
00315   Range1D validateColRange( const Range1D& rowCol ) const;
00316 
00318   
00319 private:
00320   
00321   // ///////////////////////////////////////
00322   // Private data members
00323   
00324   mutable bool in_applyOp_;
00325 
00326   mutable Teuchos::BLAS<int,Scalar> blas_;
00327 
00328   // cached
00329   Index  globalDim_;
00330   Index  localOffset_;
00331   Index  localSubDim_;
00332   Index  numCols_;
00333 
00334   
00335 }; // end class MPIMultiVectorBase
00336 
00337 } // end namespace Thyra
00338 
00339 #endif // THYRA_MPI_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