Thyra Package Browser (Single Doxygen Collection) Version of the Day
Thyra_DefaultSpmdVector_decl.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_DEFAULT_SPMD_VECTOR_DECL_HPP
00030 #define THYRA_DEFAULT_SPMD_VECTOR_DECL_HPP
00031 
00032 
00033 #include "Thyra_SpmdVectorBase_decl.hpp"
00034 
00035 
00036 namespace Thyra {
00037 
00038 
00055 template<class Scalar>
00056 class DefaultSpmdVector : virtual public SpmdVectorBase<Scalar> {
00057 public:
00058 
00061 
00062 
00064   DefaultSpmdVector();
00065 
00067   DefaultSpmdVector(
00068     const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdSpace
00069     ,const ArrayRCP<Scalar> &localValues
00070     ,const Ordinal stride
00071     );
00072 
00098   void initialize(
00099     const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdSpace
00100     ,const ArrayRCP<Scalar> &localValues
00101     ,const Ordinal stride
00102     );
00103 
00109   void uninitialize(
00110     RCP<const SpmdVectorSpaceBase<Scalar> > *spmdSpace = NULL
00111     ,ArrayRCP<Scalar> *localValues = NULL
00112     ,Ordinal *stride = NULL
00113     );
00114 
00116 
00119 
00121   ArrayRCP<Scalar> getRCPtr();
00123   ArrayRCP<const Scalar> getRCPtr() const;
00125   Scalar* getPtr();
00127   const Scalar* getPtr() const;
00129   Ordinal getStride() const;
00130   
00132 
00135 
00137   RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const;
00139   void getNonconstLocalDataImpl(const Ptr<ArrayRCP<Scalar> > &localValues);
00141   void getLocalDataImpl(const Ptr<ArrayRCP<const Scalar> > &localValues) const;
00142 
00144 
00145 private:
00146 
00147   // ///////////////////////////////////////
00148   // Private data members
00149   
00150   RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace_;
00151   ArrayRCP<Scalar> localValues_;
00152   Ordinal stride_;
00153 
00154 };
00155 
00156 
00157 // /////////////////////////////////////////////////////
00158 // Inline members
00159 
00160 
00161 template<class Scalar>
00162 inline
00163 ArrayRCP<Scalar>
00164 DefaultSpmdVector<Scalar>::getRCPtr()
00165 {
00166   return localValues_;
00167 }
00168 
00169 
00170 template<class Scalar>
00171 inline
00172 ArrayRCP<const Scalar>
00173 DefaultSpmdVector<Scalar>::getRCPtr() const
00174 {
00175   return localValues_;
00176 }
00177 
00178 
00179 template<class Scalar>
00180 inline
00181 Scalar* DefaultSpmdVector<Scalar>::getPtr()
00182 {
00183   return localValues_.get();
00184 }
00185 
00186 
00187 template<class Scalar>
00188 inline
00189 const Scalar* DefaultSpmdVector<Scalar>::getPtr() const
00190 {
00191   return localValues_.get();
00192 }
00193 
00194 
00195 template<class Scalar>
00196 inline
00197 Ordinal DefaultSpmdVector<Scalar>::getStride() const
00198 {
00199   return stride_;
00200 } 
00201 
00202 
00203 } // end namespace Thyra
00204 
00205 
00206 #endif // THYRA_DEFAULT_SPMD_VECTOR_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines