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_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP
00030 #define THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP
00031
00032 #include "Thyra_ProductMultiVectorBase.hpp"
00033 #include "Thyra_MultiVectorDefaultBase.hpp"
00034 #include "Thyra_SingleScalarLinearOpBase.hpp"
00035 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00036
00037
00038 namespace Thyra {
00039
00040
00042 template <class Scalar> class DefaultProductVectorSpace;
00043
00044
00058 template<class Scalar>
00059 class DefaultProductMultiVector
00060 : virtual public ProductMultiVectorBase<Scalar>,
00061 virtual protected MultiVectorDefaultBase<Scalar>,
00062 virtual protected SingleScalarLinearOpBase<Scalar>
00063 {
00064 public:
00065
00066 #ifdef THYRA_INJECT_USING_DECLARATIONS
00067 using MultiVectorDefaultBase<Scalar>::apply;
00068 using SingleScalarLinearOpBase<Scalar>::apply;
00069 #endif
00070
00073
00075 DefaultProductMultiVector();
00076
00078 void initialize(
00079 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00080 const int numMembers
00081 );
00082
00084 void initialize(
00085 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00086 const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs
00087 );
00088
00090 void initialize(
00091 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00092 const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs
00093 );
00094
00099 void uninitialize();
00100
00102
00105
00107 std::string description() const;
00108
00110 void describe(
00111 Teuchos::FancyOStream &out,
00112 const Teuchos::EVerbosityLevel verbLevel
00113 ) const;
00114
00116
00119
00121 RCP<const ProductVectorSpaceBase<Scalar> >
00122 productSpace() const;
00124 bool blockIsConst(const int k) const;
00126 RCP<MultiVectorBase<Scalar> >
00127 getNonconstMultiVectorBlock(const int k);
00129 RCP<const MultiVectorBase<Scalar> >
00130 getMultiVectorBlock(const int k) const;
00131
00133
00137 RCP<MultiVectorBase<Scalar> > clone_mv() const;
00138
00140
00143
00145 RCP< const VectorSpaceBase<Scalar> >
00146 range() const;
00148 RCP< const VectorSpaceBase<Scalar> >
00149 domain() const;
00150
00152
00153 protected:
00154
00157
00159 RCP<const VectorBase<Scalar> > colImpl(Index j) const;
00161 RCP<VectorBase<Scalar> > nonconstColImpl(Index j);
00163 RCP<const MultiVectorBase<Scalar> >
00164 contigSubViewImpl( const Range1D& colRng ) const;
00166 RCP<MultiVectorBase<Scalar> >
00167 nonconstContigSubViewImpl( const Range1D& colRng );
00169 RCP<const MultiVectorBase<Scalar> >
00170 nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
00172 RCP<MultiVectorBase<Scalar> >
00173 nonconstNonContigSubViewImpl( const ArrayView<const int> &cols );
00175 void mvMultiReductApplyOpImpl(
00176 const RTOpPack::RTOpT<Scalar> &primary_op,
00177 const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs,
00178 const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs,
00179 const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs,
00180 const Index primary_first_ele_offset,
00181 const Index primary_sub_dim,
00182 const Index primary_global_offset,
00183 const Index secondary_first_ele_offset,
00184 const Index secondary_sub_dim
00185 ) const;
00187 void acquireDetachedMultiVectorViewImpl(
00188 const Range1D &rowRng,
00189 const Range1D &colRng,
00190 RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv
00191 ) const;
00193 void releaseDetachedMultiVectorViewImpl(
00194 RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv
00195 ) const;
00197 void acquireNonconstDetachedMultiVectorViewImpl(
00198 const Range1D &rowRng,
00199 const Range1D &colRng,
00200 RTOpPack::SubMultiVectorView<Scalar> *sub_mv
00201 );
00203 void commitNonconstDetachedMultiVectorViewImpl(
00204 RTOpPack::SubMultiVectorView<Scalar>* sub_mv
00205 );
00206
00208
00211
00213 bool opSupported(EOpTransp M_trans) const;
00215 void apply(
00216 const EOpTransp M_trans,
00217 const MultiVectorBase<Scalar> &X,
00218 MultiVectorBase<Scalar> *Y,
00219 const Scalar alpha,
00220 const Scalar beta
00221 ) const;
00222
00224
00225 public:
00226
00229
00231 DefaultProductMultiVector(
00232 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in,
00233 const int numMembers
00234 )
00235 :numBlocks_(0)
00236 { initialize(productSpace_in, numMembers); }
00237
00239 DefaultProductMultiVector(
00240 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in,
00241 const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs
00242 )
00243 :numBlocks_(0)
00244 { initialize(productSpace_in, multiVecs); }
00245
00247 DefaultProductMultiVector(
00248 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in,
00249 const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs
00250 )
00251 :numBlocks_(0)
00252 { initialize(productSpace_in, multiVecs); }
00253
00255
00256 private:
00257
00258
00259
00260
00261 typedef Teuchos::ConstNonconstObjectContainer<MultiVectorBase<Scalar> > CNMVC;
00262
00263
00264
00265
00266 RCP<const DefaultProductVectorSpace<Scalar> > productSpace_;
00267 Teuchos::Array<CNMVC> multiVecs_;
00268
00269 int numBlocks_;
00270
00271
00272
00273
00274 template<class MultiVectorType>
00275 void initializeImpl(
00276 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00277 const ArrayView<const RCP<MultiVectorType> > &multiVecs
00278 );
00279
00280 void assertInitialized() const;
00281
00282 void validateColIndex(const int j) const;
00283
00284 };
00285
00286
00291 template<class Scalar>
00292 RCP<DefaultProductMultiVector<Scalar> >
00293 defaultProductMultiVector();
00294
00295
00300 template<class Scalar>
00301 RCP<DefaultProductMultiVector<Scalar> >
00302 defaultProductMultiVector(
00303 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00304 const int numMembers
00305 );
00306
00307
00312 template<class Scalar>
00313 RCP<DefaultProductMultiVector<Scalar> >
00314 defaultProductMultiVector(
00315 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00316 const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs
00317 );
00318
00319
00324 template<class Scalar>
00325 RCP<DefaultProductMultiVector<Scalar> >
00326 defaultProductMultiVector(
00327 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00328 const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs
00329 );
00330
00331
00338 template<class Scalar>
00339 RCP<const ProductMultiVectorBase<Scalar> >
00340 castOrCreateSingleBlockProductMultiVector(
00341 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00342 const RCP<const MultiVectorBase<Scalar> > &mv
00343 );
00344
00345
00352 template<class Scalar>
00353 RCP<ProductMultiVectorBase<Scalar> >
00354 nonconstCastOrCreateSingleBlockProductMultiVector(
00355 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00356 const RCP<MultiVectorBase<Scalar> > &mv
00357 );
00358
00359
00360
00361
00362
00363
00364 #ifndef TEUCHOS_DEBUG
00365
00366
00367 template<class Scalar>
00368 inline
00369 void DefaultProductMultiVector<Scalar>::assertInitialized() const
00370 {}
00371
00372
00373 template<class Scalar>
00374 inline
00375 void DefaultProductMultiVector<Scalar>::validateColIndex(const int j) const
00376 {}
00377
00378
00379 #endif // TEUCHOS_DEBUG
00380
00381
00382 }
00383
00384
00385 #endif // THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP