|
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_BASE_DECL_HPP 00030 #define THYRA_SPMD_MULTI_VECTOR_BASE_DECL_HPP 00031 00032 #include "Thyra_MultiVectorAdapterBase_decl.hpp" 00033 #include "Teuchos_BLAS.hpp" 00034 00035 00036 namespace Thyra { 00037 00038 00040 template<class Scalar> class SpmdVectorSpaceBase; 00041 00042 00099 template<class Scalar> 00100 class SpmdMultiVectorBase 00101 : virtual public MultiVectorAdapterBase<Scalar> 00102 { 00103 public: 00104 00107 00109 SpmdMultiVectorBase(); 00110 00112 00115 00119 virtual RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const = 0; 00120 00144 void getNonconstLocalData( 00145 const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim 00146 ) 00147 { 00148 getNonconstLocalDataImpl(localValues, leadingDim); 00149 } 00150 00171 void getLocalData( 00172 const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim 00173 ) const 00174 { 00175 getLocalDataImpl(localValues, leadingDim); 00176 } 00177 00179 00182 00184 RCP< const ScalarProdVectorSpaceBase<Scalar> > rangeScalarProdVecSpc() const; 00185 00187 00190 00192 THYRA_DEPRECATED void getLocalData( Scalar **localValues_out, Ordinal *leadingDim_out ) 00193 { 00194 using Teuchos::outArg; 00195 ArrayRCP<Scalar> localValues; 00196 this->getNonconstLocalData(outArg(localValues), outArg(*leadingDim_out)); 00197 *localValues_out = localValues.getRawPtr(); 00198 } 00199 00201 THYRA_DEPRECATED void commitLocalData( Scalar *localValues ) 00202 { 00203 // Do nothing! 00204 } 00205 00207 THYRA_DEPRECATED void getLocalData( 00208 const Scalar **localValues_out, Ordinal *leadingDim_out 00209 ) const 00210 { 00211 using Teuchos::outArg; 00212 ArrayRCP<const Scalar> localValues; 00213 this->getLocalData(outArg(localValues), outArg(*leadingDim_out)); 00214 *localValues_out = localValues.getRawPtr(); 00215 00216 } 00217 00219 THYRA_DEPRECATED void freeLocalData( const Scalar *localValues ) const 00220 { 00221 // Do nothing! 00222 } 00223 00225 00226 protected: 00227 00230 00232 virtual void getNonconstLocalDataImpl( 00233 const Ptr<ArrayRCP<Scalar> > &localValues, const Ptr<Ordinal> &leadingDim 00234 ) = 0; 00235 00237 virtual void getLocalDataImpl( 00238 const Ptr<ArrayRCP<const Scalar> > &localValues, const Ptr<Ordinal> &leadingDim 00239 ) const = 0; 00240 00242 00246 void mvMultiReductApplyOpImpl( 00247 const RTOpPack::RTOpT<Scalar> &primary_op, 00248 const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs, 00249 const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs, 00250 const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs, 00251 const Ordinal primary_global_offset 00252 ) const; 00254 void acquireDetachedMultiVectorViewImpl( 00255 const Range1D &rowRng, 00256 const Range1D &colRng 00257 ,RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv 00258 ) const; 00260 void releaseDetachedMultiVectorViewImpl( 00261 RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv 00262 ) const; 00264 void acquireNonconstDetachedMultiVectorViewImpl( 00265 const Range1D &rowRng, 00266 const Range1D &colRng, 00267 RTOpPack::SubMultiVectorView<Scalar> *sub_mv 00268 ); 00270 void commitNonconstDetachedMultiVectorViewImpl( 00271 RTOpPack::SubMultiVectorView<Scalar>* sub_mv 00272 ); 00274 00277 00283 void euclideanApply( 00284 const EOpTransp M_trans, 00285 const MultiVectorBase<Scalar> &X, 00286 const Ptr<MultiVectorBase<Scalar> > &Y, 00287 const Scalar alpha, 00288 const Scalar beta 00289 ) const; 00290 00292 00295 00304 virtual void updateSpmdSpace(); 00305 00310 Range1D validateRowRange( const Range1D& rowRng ) const; 00311 00316 Range1D validateColRange( const Range1D& rowCol ) const; 00317 00319 00320 private: 00321 00322 // /////////////////////////////////////// 00323 // Private data members 00324 00325 mutable bool in_applyOp_; 00326 00327 mutable Teuchos::BLAS<int,Scalar> blas_; 00328 00329 // cached 00330 Ordinal globalDim_; 00331 Ordinal localOffset_; 00332 Ordinal localSubDim_; 00333 Ordinal numCols_; 00334 00335 }; // end class SpmdMultiVectorBase 00336 00337 } // end namespace Thyra 00338 00339 #endif // THYRA_SPMD_MULTI_VECTOR_BASE_DECL_HPP
1.7.4