Thyra_MPIVectorBaseDecl.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_VECTOR_BASE_DECL_HPP
00030 #define THYRA_MPI_VECTOR_BASE_DECL_HPP
00031 
00032 #include "Thyra_VectorDefaultBase.hpp"
00033 #include "Thyra_MPIVectorSpaceBaseDecl.hpp"
00034 
00035 namespace Thyra {
00036 
00103 template<class Scalar>
00104 class MPIVectorBase : virtual public VectorDefaultBase<Scalar> {
00105 public:
00106 
00108   using VectorDefaultBase<Scalar>::applyOp;
00109 
00111   MPIVectorBase();
00112 
00115 
00118   virtual Teuchos::RefCountPtr<const MPIVectorSpaceBase<Scalar> > mpiSpace() const = 0;
00119 
00141   virtual void getLocalData( Scalar** localValues, Index* stride ) = 0;
00142 
00156   virtual void commitLocalData( Scalar* localValues ) = 0;
00157 
00159 
00162 
00191   virtual void getLocalData( const Scalar** localValues, Index* stride ) const;
00192 
00209   virtual void freeLocalData( const Scalar* localValues ) const;
00210 
00212 
00215 
00217   Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > space() const;
00228   void applyOp(
00229     const RTOpPack::RTOpT<Scalar>   &op
00230     ,const int                      num_vecs
00231     ,const VectorBase<Scalar>*      vecs[]
00232     ,const int                      num_targ_vecs
00233     ,VectorBase<Scalar>*            targ_vecs[]
00234     ,RTOpPack::ReductTarget         *reduct_obj
00235     ,const Index                    first_ele
00236     ,const Index                    sub_dim
00237     ,const Index                    global_offset
00238     ) const;
00240   void getSubVector( const Range1D& rng, RTOpPack::SubVectorT<Scalar>* sub_vec ) const;
00242   void freeSubVector( RTOpPack::SubVectorT<Scalar>* sub_vec ) const;
00244   void getSubVector( const Range1D& rng, RTOpPack::MutableSubVectorT<Scalar>* sub_vec );
00246   void commitSubVector( RTOpPack::MutableSubVectorT<Scalar>* sub_vec );
00247 
00249 
00250 protected:
00251 
00255   virtual void updateMpiSpace();
00256 
00257 private:
00258 
00259   // ///////////////////////////////////////
00260   // Private data members
00261   
00262   mutable bool in_applyOp_;
00263 
00264   // Cached (only on vector space!)
00265   mutable Index  globalDim_;
00266   mutable Index  localOffset_;
00267   mutable Index  localSubDim_;
00268 
00269   // /////////////////////////////////////
00270   // Private member functions
00271 
00272   Range1D validateRange( const Range1D& rng_in ) const;
00273 
00274 }; // end class MPIVectorBase
00275 
00276 } // end namespace Thyra
00277 
00278 #endif // THYRA_MPI_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