|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
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_MULTI_VECTOR_STD_DECL_HPP 00030 #define THYRA_Spmd_MULTI_VECTOR_STD_DECL_HPP 00031 00032 #include "Thyra_SpmdMultiVectorBase_decl.hpp" 00033 00034 00035 namespace Thyra { 00036 00037 00054 template<class Scalar> 00055 class DefaultSpmdMultiVector : virtual public SpmdMultiVectorBase<Scalar> { 00056 public: 00057 00060 00062 DefaultSpmdMultiVector(); 00063 00065 DefaultSpmdMultiVector( 00066 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace, 00067 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace 00068 ); 00069 00071 DefaultSpmdMultiVector( 00072 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace, 00073 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace, 00074 const ArrayRCP<Scalar> &localValues, 00075 const Ordinal leadingDim = -1 00076 ); 00077 00093 void initialize( 00094 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace, 00095 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace 00096 ); 00097 00126 void initialize( 00127 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace, 00128 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace, 00129 const ArrayRCP<Scalar> &localValues, 00130 const Ordinal leadingDim = -1 00131 ); 00132 00138 void uninitialize( 00139 RCP<const SpmdVectorSpaceBase<Scalar> > *spmdRangeSpace = NULL, 00140 RCP<const ScalarProdVectorSpaceBase<Scalar> > *domainSpace = NULL, 00141 ArrayRCP<Scalar> *localValues = NULL, 00142 Ordinal *leadingDim = NULL 00143 ); 00144 00146 RCP< const ScalarProdVectorSpaceBase<Scalar> > 00147 domainScalarProdVecSpc() const; 00148 00150 00154 RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const; 00156 00157 protected: 00158 00162 RCP<VectorBase<Scalar> > nonconstColImpl(Ordinal j); 00164 RCP<const MultiVectorBase<Scalar> > 00165 contigSubViewImpl(const Range1D& colRng) const; 00167 RCP<MultiVectorBase<Scalar> > 00168 nonconstContigSubViewImpl(const Range1D& colRng); 00170 RCP<const MultiVectorBase<Scalar> > 00171 nonContigSubViewImpl(const ArrayView<const int> &cols) const; 00173 RCP<MultiVectorBase<Scalar> > 00174 nonconstNonContigSubViewImpl(const ArrayView<const int> &cols); 00176 00180 void getNonconstLocalDataImpl( 00181 const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim 00182 ); 00184 void getLocalDataImpl( 00185 const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim 00186 ) const; 00188 00189 private: 00190 00191 // /////////////////////////////////////// 00192 // Private data members 00193 00194 RCP<const SpmdVectorSpaceBase<Scalar> > spmdRangeSpace_; 00195 RCP<const ScalarProdVectorSpaceBase<Scalar> > domainSpace_; 00196 ArrayRCP<Scalar> localValues_; 00197 Ordinal leadingDim_; 00198 00199 // /////////////////////////////////////// 00200 // Private member functions 00201 00202 ArrayRCP<Scalar> createContiguousCopy(const ArrayView<const int> &cols) const; 00203 00204 public: 00205 00206 #ifdef THYRA_DEBUG 00207 // Unit testing sensing varaible 00208 static int numSkipCopyBack; 00209 #endif 00210 00211 }; // end class DefaultSpmdMultiVector 00212 00213 00214 template<class Scalar> 00215 RCP<DefaultSpmdMultiVector<Scalar> > 00216 defaultSpmdMultiVector( 00217 const RCP<const SpmdVectorSpaceBase<Scalar> > &spmdRangeSpace, 00218 const RCP<const ScalarProdVectorSpaceBase<Scalar> > &domainSpace, 00219 const ArrayRCP<Scalar> &localValues, 00220 const Ordinal leadingDim = -1 00221 ) 00222 { 00223 return Teuchos::rcp( 00224 new DefaultSpmdMultiVector<Scalar>( 00225 spmdRangeSpace, domainSpace, localValues, leadingDim 00226 ) 00227 ); 00228 } 00229 00230 00231 } // end namespace Thyra 00232 00233 00234 #endif // THYRA_Spmd_MULTI_VECTOR_STD_DECL_HPP
1.7.4