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_SERIAL_VECTOR_STD_DECL_HPP 00030 #define THYRA_SERIAL_VECTOR_STD_DECL_HPP 00031 00032 #include "Thyra_SerialVectorBaseDecl.hpp" 00033 00034 namespace Thyra { 00035 00069 template<class Scalar> 00070 class SerialVectorStd : public SerialVectorBase<Scalar> { 00071 public: 00072 00074 using SerialVectorBase<Scalar>::describe; 00075 00078 00081 SerialVectorStd( 00082 const Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > &vecSpc 00083 ); 00086 SerialVectorStd( 00087 const Index dim = 0 00088 ); 00091 SerialVectorStd( 00092 const Teuchos::RefCountPtr<Scalar> &v 00093 ,const Index vs 00094 ,const Index dim 00095 ,const Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > &vecSpc = Teuchos::null 00096 ); 00099 void initialize( 00100 const Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > &vecSpc 00101 ); 00104 void initialize( 00105 const Index dim 00106 ); 00139 virtual void initialize( 00140 const Teuchos::RefCountPtr<Scalar> &v 00141 ,const Index vs 00142 ,const Index dim 00143 ,const Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > &vecSpc = Teuchos::null 00144 ); 00145 00147 00150 00152 Teuchos::RefCountPtr<Scalar> getRCPtr(); 00154 Teuchos::RefCountPtr<const Scalar> getRCPtr() const; 00156 Scalar* getPtr(); 00158 const Scalar* getPtr() const; 00160 Index getStride() const; 00162 Index getDim() const; 00163 00165 00169 void getData( Scalar** values, Index* stride ); 00171 void commitData( Scalar** values ); 00173 void getData( const Scalar** values, Index* stride ) const; 00175 void freeData( const Scalar** values ) const; 00177 00181 Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > space() const; 00183 00187 std::string description() const; 00189 00190 private: 00191 00192 // /////////////////////////////////////// 00193 // Private data members 00194 00195 Teuchos::RefCountPtr<Scalar> v_; 00196 Index vs_; 00197 Index dim_; 00198 Teuchos::RefCountPtr<const VectorSpaceBase<Scalar> > space_serial_; 00199 00200 // //////////////////////////////// 00201 // Private member functions 00202 00203 void free_mem(); 00204 00205 // Not defined and not to be called 00206 SerialVectorStd(const SerialVectorStd&); 00207 SerialVectorStd& operator=(const SerialVectorStd&); 00208 00209 }; // end class SerialVectorStd 00210 00211 // ///////////////////////////////////////////////////// 00212 // Inline members 00213 00214 template<class Scalar> 00215 inline 00216 Teuchos::RefCountPtr<Scalar> SerialVectorStd<Scalar>::getRCPtr() 00217 { 00218 return v_; 00219 } 00220 00221 template<class Scalar> 00222 inline 00223 Teuchos::RefCountPtr<const Scalar> SerialVectorStd<Scalar>::getRCPtr() const 00224 { 00225 return v_; 00226 } 00227 00228 template<class Scalar> 00229 inline 00230 Scalar* SerialVectorStd<Scalar>::getPtr() 00231 { 00232 return v_.get(); 00233 } 00234 00235 template<class Scalar> 00236 inline 00237 const Scalar* SerialVectorStd<Scalar>::getPtr() const 00238 { 00239 return v_.get(); 00240 } 00241 00242 template<class Scalar> 00243 inline 00244 Index SerialVectorStd<Scalar>::getStride() const 00245 { 00246 return vs_; 00247 } 00248 00249 template<class Scalar> 00250 inline 00251 Index SerialVectorStd<Scalar>::getDim() const 00252 { 00253 return dim_; 00254 } 00255 00256 } // end namespace Thyra 00257 00258 #endif // THYRA_SERIAL_VECTOR_STD_DECL_HPP
1.3.9.1