Thyra Package Browser (Single Doxygen Collection) Version of the Day
Thyra_TpetraVector_def.hpp
Go to the documentation of this file.
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_VECTOR_HPP
00030 #define THYRA_TPETRA_VECTOR_HPP
00031 
00032 
00033 #include "Thyra_TpetraVector_decl.hpp"
00034 
00035 
00036 namespace Thyra {
00037 
00038 
00039 // Constructors/initializers/accessors
00040 
00041 
00042 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00043 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::TpetraVector()
00044 {}
00045 
00046 
00047 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00048 void TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::initialize(
00049   const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00050   const RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector
00051   )
00052 {
00053   initializeImpl(tpetraVectorSpace, tpetraVector);
00054 }
00055 
00056 
00057 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00058 void TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::constInitialize(
00059   const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00060   const RCP<const Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVector
00061   )
00062 {
00063   initializeImpl(tpetraVectorSpace, tpetraVector);
00064 }
00065 
00066 
00067 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00068 RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00069 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::getTpetraVector()
00070 {
00071   return tpetraVector_.getNonconstObj();
00072 }
00073 
00074 
00075 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00076 RCP<const Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
00077 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::getConstTpetraVector() const
00078 {
00079   return tpetraVector_;
00080 }
00081 
00082 
00083 // Overridden from SpmdVectorBase
00084 
00085 
00086 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00087 RCP<const SpmdVectorSpaceBase<Scalar> >
00088 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::spmdSpace() const
00089 {
00090   return tpetraVectorSpace_;
00091 }
00092 
00093 
00094 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00095 void TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::getNonconstLocalDataImpl(
00096   const Ptr<ArrayRCP<Scalar> > &localValues )
00097 {
00098   *localValues = tpetraVector_.getNonconstObj()->get1dViewNonConst();
00099 }
00100 
00101 
00102 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00103 void TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::getLocalDataImpl(
00104   const Ptr<ArrayRCP<const Scalar> > &localValues ) const
00105 {
00106   *localValues = tpetraVector_->get1dView();
00107 }
00108 
00109 
00110 // private
00111 
00112 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
00113 template<class TpetraVector_t>
00114 void TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::initializeImpl(
00115   const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
00116   const RCP<TpetraVector_t> &tpetraVector
00117   )
00118 {
00119 #ifdef TEUCHOS_DEBUG
00120   TEUCHOS_ASSERT(nonnull(tpetraVectorSpace));
00121   TEUCHOS_ASSERT(nonnull(tpetraVector));
00122 #endif
00123   tpetraVectorSpace_ = tpetraVectorSpace;
00124   tpetraVector_.initialize(tpetraVector);
00125   this->updateSpmdSpace();
00126 }
00127 
00128 
00129 } // end namespace Thyra
00130 
00131 
00132 #endif // THYRA_TPETRA_VECTOR_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines