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_SPMD_VECTOR_STD_DECL_HPP 00030 #define THYRA_SPMD_VECTOR_STD_DECL_HPP 00031 00032 #include "Thyra_SpmdVectorBaseDecl.hpp" 00033 00034 namespace Thyra { 00035 00053 template<class Scalar> 00054 class DefaultSpmdVector : virtual public SpmdVectorBase<Scalar> { 00055 public: 00056 00059 00060 00062 DefaultSpmdVector(); 00063 00065 DefaultSpmdVector( 00066 const Teuchos::RCP<const SpmdVectorSpaceBase<Scalar> > &spmdSpace 00067 ,const Teuchos::RCP<Scalar> &localValues 00068 ,const Index stride 00069 ); 00070 00096 void initialize( 00097 const Teuchos::RCP<const SpmdVectorSpaceBase<Scalar> > &spmdSpace 00098 ,const Teuchos::RCP<Scalar> &localValues 00099 ,const Index stride 00100 ); 00101 00107 void uninitialize( 00108 Teuchos::RCP<const SpmdVectorSpaceBase<Scalar> > *spmdSpace = NULL 00109 ,Teuchos::RCP<Scalar> *localValues = NULL 00110 ,Index *stride = NULL 00111 ); 00112 00114 00117 00119 Teuchos::RCP<Scalar> getRCPtr(); 00121 Teuchos::RCP<const Scalar> getRCPtr() const; 00123 Scalar* getPtr(); 00125 const Scalar* getPtr() const; 00127 Index getStride() const; 00128 00130 00133 00135 Teuchos::RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const; 00137 void getLocalData( Scalar** localValues, Index* stride ); 00139 void commitLocalData( Scalar* localValues ); 00141 void getLocalData( const Scalar** localValues, Index* stride ) const; 00143 void freeLocalData( const Scalar* localValues ) const; 00144 00146 00147 private: 00148 00149 // /////////////////////////////////////// 00150 // Private data members 00151 00152 Teuchos::RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace_; 00153 Teuchos::RCP<Scalar> localValues_; 00154 Index stride_; 00155 00156 }; // end class DefaultSpmdVector 00157 00158 // ///////////////////////////////////////////////////// 00159 // Inline members 00160 00161 template<class Scalar> 00162 inline 00163 Teuchos::RCP<Scalar> 00164 DefaultSpmdVector<Scalar>::getRCPtr() 00165 { 00166 return localValues_; 00167 } 00168 00169 template<class Scalar> 00170 inline 00171 Teuchos::RCP<const Scalar> 00172 DefaultSpmdVector<Scalar>::getRCPtr() const 00173 { 00174 return localValues_; 00175 } 00176 00177 template<class Scalar> 00178 inline 00179 Scalar* DefaultSpmdVector<Scalar>::getPtr() 00180 { 00181 return localValues_.get(); 00182 } 00183 00184 template<class Scalar> 00185 inline 00186 const Scalar* DefaultSpmdVector<Scalar>::getPtr() const 00187 { 00188 return localValues_.get(); 00189 } 00190 00191 template<class Scalar> 00192 inline 00193 Index DefaultSpmdVector<Scalar>::getStride() const 00194 { 00195 return stride_; 00196 } 00197 00198 } // end namespace Thyra 00199 00200 #endif // THYRA_SPMD_VECTOR_STD_DECL_HPP
1.4.7