Thyra_TpetraMultiVector_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 #ifndef THYRA_TPETRA_MULTIVECTOR_DECL_HPP
00030 #define THYRA_TPETRA_MULTIVECTOR_DECL_HPP
00031 
00032 #include "Thyra_SpmdMultiVectorBase.hpp"
00033 #include "Thyra_TpetraVectorSpace_decl.hpp"
00034 #include "Tpetra_MultiVector.hpp"
00035 
00036 
00037 namespace Thyra {
00038 
00039 
00047 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00048 class TpetraMultiVector : virtual public SpmdMultiVectorBase<Scalar> {
00049 public:
00050 
00053 
00055   TpetraMultiVector();
00056 
00059   void initialize(
00060     const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00061     const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
00062     const RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector
00063     );
00064 
00067   void constInitialize(
00068     const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00069     const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
00070     const RCP<const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector
00071     );
00072 
00074   RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00075   getTpetraMultiVector();
00076 
00078   RCP<const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00079   getConstTpetraMultiVector() const;
00080 
00082 
00086   RCP< const ScalarProdVectorSpaceBase<Scalar> >
00087   domainScalarProdVecSpc() const;
00089 
00093   RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const;
00095 
00096 protected:
00097 
00101   RCP<const VectorBase<Scalar> > colImpl(Ordinal j) const;
00103   RCP<VectorBase<Scalar> > nonconstColImpl(Ordinal j);
00104 //  /** \brief . */
00105 //  RCP<MultiVectorBase<Scalar> >
00106 //  nonconstContigSubViewImpl( const Range1D& colRng );
00107 //  /** \brief . */
00108 //  RCP<const MultiVectorBase<Scalar> >
00109 //  nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
00110 //  /** \brief . */
00111 //  RCP<MultiVectorBase<Scalar> >
00112 //  nonconstNonContigSubViewImpl( const ArrayView<const int> &cols );
00114 
00118   void getNonconstLocalDataImpl(
00119     const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim
00120     );
00122   void getLocalDataImpl(
00123     const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim
00124     ) const;
00126   
00127 private:
00128   
00129   // ///////////////////////////////////////
00130   // Private data members
00131 
00132   RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > tpetraVectorSpace_;
00133   RCP<const ScalarProdVectorSpaceBase<Scalar> > domainSpace_;
00134   Teuchos::ConstNonconstObjectContainer<Tpetra::MultiVector<Scalar, LocalOrdinal,GlobalOrdinal,Node> >
00135   tpetraMultiVector_;
00136 
00137   // ////////////////////////////////////
00138   // Private member functions
00139 
00140   template<class TpetraMultiVector_t>
00141   void initializeImpl(
00142     const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00143     const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
00144     const RCP<TpetraMultiVector_t> &tpetraMultiVector
00145     );
00146   
00147 };
00148 
00149 
00154 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00155 RCP<TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00156 tpetraMultiVector(
00157   const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00158   const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
00159   const RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector
00160   )
00161 {
00162   RCP<TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > tmv =
00163     Teuchos::rcp(new TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>);
00164   tmv->initialize(tpetraVectorSpace, domainSpace, tpetraMultiVector);
00165   return tmv;
00166 }
00167 
00168 
00173 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00174 RCP<const TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00175 constTpetraMultiVector(
00176   const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00177   const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace,
00178   const RCP<const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraMultiVector
00179   )
00180 {
00181   RCP<TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > tmv =
00182     Teuchos::rcp(new TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>);
00183   tmv->constInitialize(tpetraVectorSpace, domainSpace, tpetraMultiVector);
00184   return tmv;
00185 }
00186 
00187 
00188 } // end namespace Thyra
00189 
00190 
00191 #endif // THYRA_TPETRA_MULTIVECTOR_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Wed Apr 13 10:00:26 2011 for Thyra by  doxygen 1.6.3