TSFEpetraVectorSpace.hpp
Go to the documentation of this file.
00001 /* ***********************************************************************
00002 // 
00003 //           TSFExtended: Trilinos Solver Framework Extended
00004 //                 Copyright (2004) Sandia Corporation
00005 // 
00006 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00007 // license for use of this work by or on behalf of the U.S. Government.
00008 // 
00009 // This library is free software; you can redistribute it and/or modify
00010 // it under the terms of the GNU Lesser General Public License as
00011 // published by the Free Software Foundation; either version 2.1 of the
00012 // License, or (at your option) any later version.
00013 //  
00014 // This library is distributed in the hope that it will be useful, but
00015 // WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 //  
00019 // You should have received a copy of the GNU Lesser General Public
00020 // License along with this library; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00022 // USA
00023 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00024 // 
00025 // **********************************************************************/
00026 
00027 #ifndef TSFEPETRAVECTORSPACE_HPP
00028 #define TSFEPETRAVECTORSPACE_HPP
00029 
00030 #include "SundanceDefs.hpp"
00031 #include "Epetra_Map.h"
00032 #include "Teuchos_RefCountPtr.hpp"
00033 #include "Teuchos_Comm.hpp"
00034 #include "Thyra_ScalarProdVectorSpaceBase.hpp"
00035 #include "Thyra_SpmdVectorSpaceBase.hpp"
00036 
00037 namespace TSFExtended
00038 {
00039 using namespace Teuchos;
00040 using namespace Thyra;
00041 
00042 
00043 /**
00044  * Adaptor wrapping Epetra map in the Thyra vector space system.
00045  */
00046 class EpetraVectorSpace 
00047   : virtual public Thyra::ScalarProdVectorSpaceBase<double>,
00048     virtual public Thyra::SpmdVectorSpaceBase<double>
00049 {
00050 public:
00051 
00052   /** */
00053   EpetraVectorSpace(const RCP<const Epetra_Map>& map);
00054     
00055 
00056   /** @name Overridden form Teuchos::Describable */
00057   //@{
00058   /** \brief . */
00059   std::string description() const;
00060   //@}
00061 
00062   /** @name Public overridden from VectorSpace */
00063   //@{
00064 
00065   /** */
00066   OrdType dim() const ;
00067 
00068   /** */
00069   bool isCompatible(const VectorSpaceBase<double>& other) const ;
00070 
00071   /** */
00072   RCP<const VectorSpaceFactoryBase<double> > 
00073   smallVecSpcFcty() const ;
00074 
00075   /** \brief clone the space */
00076   RCP< const VectorSpaceBase<double> > clone() const ;
00077 
00078   //@}
00079 
00080 
00081 
00082 
00083   /** \name Overidden from SpmdVectorSpaceBase */
00084   //@{
00085   /** */
00086   Teuchos::RCP<const Teuchos::Comm<OrdType> > getComm() const
00087     {return comm_;}
00088 
00089   /** */
00090   OrdType localSubDim() const {return localSubDim_;}
00091 
00092   /** */
00093   OrdType localOffset() const {return localOffset_;}
00094 
00095   /** */
00096   OrdType mapCode() const {return -1;}
00097   //@}
00098 
00099 
00100  /** */
00101   const RCP<const Epetra_Map>& epetraMap() const 
00102     {return epetraMap_;}
00103 
00104 
00105 protected:
00106   /** */
00107   Teuchos::RCP<const Teuchos::Comm<OrdType> > 
00108   epetraCommToTeuchosComm(const Epetra_Comm& epComm) const ;
00109   
00110   /** @name Protected overridden from VectorSpace */
00111   //@{
00112   /** \brief create a vector */
00113   RCP<VectorBase<double> > createMember() const;
00114   /** \brief create a multivector */
00115   RCP<MultiVectorBase<double> > createMembers(int numVecs) const;
00116   //@}
00117 private:
00118   /** */
00119   RCP<const VectorSpaceFactoryBase<double> > smallVecSpcFactory_;
00120   /** */
00121   RCP<const Epetra_Map> epetraMap_;
00122 
00123   Teuchos::RCP<const Teuchos::Comm<OrdType> > comm_;
00124 
00125   OrdType localSubDim_;
00126 
00127   OrdType localOffset_;
00128 };
00129   
00130 }
00131 
00132 #endif

Site Contact