00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef THYRA_SPMD_MULTI_VECTOR_BASE_DECL_HPP
00030 #define THYRA_SPMD_MULTI_VECTOR_BASE_DECL_HPP
00031
00032 #include "Thyra_MultiVectorDefaultBaseDecl.hpp"
00033 #include "Thyra_SingleScalarEuclideanLinearOpBaseDecl.hpp"
00034 #include "Teuchos_BLAS.hpp"
00035
00036 namespace Thyra {
00037
00039 template<class Scalar> class SpmdVectorSpaceBase;
00040
00097 template<class Scalar>
00098 class SpmdMultiVectorBase
00099 : virtual public MultiVectorDefaultBase<Scalar>
00100 , virtual public SingleScalarEuclideanLinearOpBase<Scalar>
00101 {
00102 public:
00103
00104 #ifdef THYRA_INJECT_USING_DECLARATIONS
00105 using SingleScalarEuclideanLinearOpBase<Scalar>::euclideanApply;
00106 using SingleScalarEuclideanLinearOpBase<Scalar>::apply;
00107 #endif
00108
00111
00113 SpmdMultiVectorBase();
00114
00116
00119
00123 virtual RCP<const SpmdVectorSpaceBase<Scalar> > spmdSpace() const = 0;
00124
00149 virtual void getLocalData( Scalar **localValues, Index *leadingDim ) = 0;
00150
00164 virtual void commitLocalData( Scalar *localValues ) = 0;
00165
00187 virtual void getLocalData(
00188 const Scalar **localValues, Index *leadingDim
00189 ) const = 0;
00190
00205 virtual void freeLocalData( const Scalar *localValues ) const = 0;
00206
00208
00211
00213 RCP< const ScalarProdVectorSpaceBase<Scalar> > rangeScalarProdVecSpc() const;
00214
00216
00219
00223 void apply(
00224 const EOpTransp M_trans,
00225 const MultiVectorBase<Scalar> &X,
00226 MultiVectorBase<Scalar> *Y,
00227 const Scalar alpha,
00228 const Scalar beta
00229 ) const;
00230
00232
00236 void mvMultiReductApplyOpImpl(
00237 const RTOpPack::RTOpT<Scalar> &primary_op,
00238 const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs,
00239 const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs,
00240 const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs,
00241 const Index primary_first_ele,
00242 const Index primary_sub_dim,
00243 const Index primary_global_offset,
00244 const Index secondary_first_ele,
00245 const Index secondary_sub_dim
00246 ) const;
00248 void acquireDetachedMultiVectorViewImpl(
00249 const Range1D &rowRng,
00250 const Range1D &colRng
00251 ,RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv
00252 ) const;
00254 void releaseDetachedMultiVectorViewImpl(
00255 RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv
00256 ) const;
00258 void acquireNonconstDetachedMultiVectorViewImpl(
00259 const Range1D &rowRng,
00260 const Range1D &colRng,
00261 RTOpPack::SubMultiVectorView<Scalar> *sub_mv
00262 );
00264 void commitNonconstDetachedMultiVectorViewImpl(
00265 RTOpPack::SubMultiVectorView<Scalar>* sub_mv
00266 );
00268
00269 protected:
00270
00273
00278 bool opSupported(EOpTransp M_trans) const;
00279
00285 void euclideanApply(
00286 const EOpTransp M_trans
00287 ,const MultiVectorBase<Scalar> &X
00288 ,MultiVectorBase<Scalar> *Y
00289 ,const Scalar alpha
00290 ,const Scalar beta
00291 ) const;
00292
00294
00297
00306 virtual void updateSpmdSpace();
00307
00312 Range1D validateRowRange( const Range1D& rowRng ) const;
00313
00318 Range1D validateColRange( const Range1D& rowCol ) const;
00319
00321
00322 private:
00323
00324
00325
00326
00327 mutable bool in_applyOp_;
00328
00329 mutable Teuchos::BLAS<int,Scalar> blas_;
00330
00331
00332 Index globalDim_;
00333 Index localOffset_;
00334 Index localSubDim_;
00335 Index numCols_;
00336
00337 mutable Scalar *nonconstLocalValuesViewPtr_;
00338 mutable const Scalar *localValuesViewPtr_;
00339
00340 };
00341
00342 }
00343
00344 #endif // THYRA_SPMD_MULTI_VECTOR_BASE_DECL_HPP