Thyra Version of the Day
Thyra_TpetraVectorSpace_decl.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 
00030 #ifndef THYRA_TPETRA_VECTOR_SPACE_DECL_HPP
00031 #define THYRA_TPETRA_VECTOR_SPACE_DECL_HPP
00032 
00033 
00034 #include "Thyra_SpmdVectorSpaceDefaultBase.hpp"
00035 #include "Tpetra_Map.hpp"
00036 
00037 
00038 namespace Thyra {
00039 
00040 
00045 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00046 class TpetraVectorSpace : public SpmdVectorSpaceDefaultBase<Scalar>
00047 {
00048 public:
00049 
00051   typedef TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> this_t;
00052 
00055 
00057   static RCP<TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > create();
00058 
00060   void initialize(
00061     const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
00062     );
00063 
00065 
00071   bool hasInCoreView(
00072     const Range1D& rng, const EViewType viewType, const EStrideType strideType
00073     ) const;
00075   RCP< const VectorSpaceBase<Scalar> > clone() const;
00077 
00078 protected:
00079 
00082 
00084   RCP<VectorBase<Scalar> >
00085   createMember() const;
00087   RCP<MultiVectorBase<Scalar> >
00088   createMembers(int numMembers) const;
00089 
00091 
00092 public:
00093 
00096 
00098   RCP<const Teuchos::Comm<Ordinal> > getComm() const;
00100   Ordinal localSubDim() const;
00101 
00103 
00104 private:
00105 
00106   // //////////////////////////////////////
00107   // Private data members
00108 
00109   RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > tpetraMap_;
00110   RCP<const Teuchos::Comm<Ordinal> > comm_;
00111   Ordinal localSubDim_;
00112   int numProc_;
00113   int procRank_;
00114   RCP<this_t> weakSelfPtr_;
00115 
00116   // /////////////////////////////////////
00117   // Private member functions
00118  
00119   TpetraVectorSpace();
00120  
00121 }; // end class TpetraVectorSpace
00122 
00123 
00128 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00129 RCP<TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00130 tpetraVectorSpace(
00131   const RCP<const Tpetra::Map<LocalOrdinal,GlobalOrdinal,Node> > &tpetraMap
00132   )
00133 {
00134   RCP<TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > vs =
00135     TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node>::create();
00136   vs->initialize(tpetraMap);
00137   return vs;
00138 }
00139 
00140 
00141 } // end namespace Thyra
00142 
00143 
00144 #endif // THYRA_TPETRA_VECTOR_SPACE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines