00001 /* @HEADER@ */ 00002 // 00003 /* @HEADER@ */ 00004 00005 #ifndef PLAYA_EPETRAVECTORSPACE_HPP 00006 #define PLAYA_EPETRAVECTORSPACE_HPP 00007 00008 #include "PlayaDefs.hpp" 00009 #include "Epetra_Map.h" 00010 #include "Teuchos_RefCountPtr.hpp" 00011 #include "PlayaMPIComm.hpp" 00012 #include "PlayaVectorSpaceBaseDecl.hpp" 00013 00014 namespace Playa 00015 { 00016 using namespace Teuchos; 00017 00018 00019 /** 00020 * Adaptor wrapping Epetra map in the Thyra vector space system. 00021 */ 00022 class EpetraVectorSpace : public VectorSpaceBase<double> 00023 { 00024 public: 00025 /** */ 00026 EpetraVectorSpace(const RCP<const Epetra_Map>& map); 00027 00028 /** */ 00029 RCP<VectorBase<double> > 00030 createMember(const VectorSpace<double>& self) const ; 00031 00032 /** @name Overridden form Teuchos::Describable */ 00033 //@{ 00034 /** \brief . */ 00035 std::string description() const; 00036 //@} 00037 00038 /** @name Public overridden from VectorSpace */ 00039 //@{ 00040 00041 /** */ 00042 int dim() const {return globalDim_;} 00043 00044 /** */ 00045 int numLocalElements() const {return numLocalElements_;} 00046 00047 /** */ 00048 int baseGlobalNaturalIndex() const {return baseGlobalNaturalIndex_;} 00049 00050 /** */ 00051 bool isCompatible(const VectorSpaceBase<double>* other) const ; 00052 00053 int numBlocks() const {return 1;} 00054 00055 //@} 00056 00057 /** */ 00058 const RCP<const Epetra_Map>& epetraMap() const 00059 {return epetraMap_;} 00060 00061 00062 /** */ 00063 virtual const MPIComm& comm() const {return comm_;} 00064 00065 protected: 00066 00067 MPIComm epetraCommToTeuchosMPIComm(const Epetra_Comm& epComm) ; 00068 00069 private: 00070 RCP<const Epetra_Map> epetraMap_; 00071 00072 MPIComm comm_; 00073 00074 int globalDim_; 00075 00076 int baseGlobalNaturalIndex_; 00077 00078 int numLocalElements_; 00079 }; 00080 00081 } 00082 00083 #endif