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 00052 template<class Scalar> 00053 class DefaultSpmdVector : virtual public SpmdVectorBase<Scalar> { 00054 public: 00055 00058 00059 00061 DefaultSpmdVector(); 00062 00064 DefaultSpmdVector( 00065 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdSpace 00066 ,const ArrayRCP<Scalar> &localValues 00067 ,const Index stride 00068 ); 00069 00095 void initialize( 00096 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdSpace 00097 ,const ArrayRCP<Scalar> &localValues 00098 ,const Index stride 00099 ); 00100 00106 void uninitialize( 00107 RCP<const SpmdVectorSpaceBase<Scalar> > *spmdSpace = NULL 00108 ,ArrayRCP<Scalar> *localValues = NULL 00109 ,Index *stride = NULL 00110 ); 00111 00113 00116 00118 ArrayRCP<Scalar> getRCPtr(); 00120 ArrayRCP<const Scalar> getRCPtr() const; 00122 Scalar* getPtr(); 00124 const Scalar* getPtr() const; 00126 Index getStride() const; 00127 00129 00132 00134 RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const; 00136 void getLocalData( Scalar** localValues, Index* stride ); 00138 void commitLocalData( Scalar* localValues ); 00140 void getLocalData( const Scalar** localValues, Index* stride ) const; 00142 void freeLocalData( const Scalar* localValues ) const; 00143 00145 00146 private: 00147 00148 // /////////////////////////////////////// 00149 // Private data members 00150 00151 RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace_; 00152 ArrayRCP<Scalar> localValues_; 00153 Index stride_; 00154 00155 }; // end class DefaultSpmdVector 00156 00157 // ///////////////////////////////////////////////////// 00158 // Inline members 00159 00160 template<class Scalar> 00161 inline 00162 ArrayRCP<Scalar> 00163 DefaultSpmdVector<Scalar>::getRCPtr() 00164 { 00165 return localValues_; 00166 } 00167 00168 template<class Scalar> 00169 inline 00170 ArrayRCP<const Scalar> 00171 DefaultSpmdVector<Scalar>::getRCPtr() const 00172 { 00173 return localValues_; 00174 } 00175 00176 template<class Scalar> 00177 inline 00178 Scalar* DefaultSpmdVector<Scalar>::getPtr() 00179 { 00180 return localValues_.get(); 00181 } 00182 00183 template<class Scalar> 00184 inline 00185 const Scalar* DefaultSpmdVector<Scalar>::getPtr() const 00186 { 00187 return localValues_.get(); 00188 } 00189 00190 template<class Scalar> 00191 inline 00192 Index DefaultSpmdVector<Scalar>::getStride() const 00193 { 00194 return stride_; 00195 } 00196 00197 } // end namespace Thyra 00198 00199 #endif // THYRA_SPMD_VECTOR_STD_DECL_HPP
1.4.7