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_MULTI_VECTOR_PRODUCT_VECTOR_DECL_HPP
00030 #define THYRA_MULTI_VECTOR_PRODUCT_VECTOR_DECL_HPP
00031
00032
00033 #include "Thyra_ProductVectorBase.hpp"
00034 #include "Thyra_VectorDefaultBase.hpp"
00035 #include "Thyra_DefaultProductVector.hpp"
00036 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00037
00038
00039 namespace Thyra {
00040
00041
00042 template<class Scalar> class DefaultMultiVectorProductVectorSpace;
00043
00044
00056 template<class Scalar>
00057 class DefaultMultiVectorProductVector
00058 : virtual public ProductVectorBase<Scalar>,
00059 virtual protected VectorDefaultBase<Scalar>
00060 {
00061 public:
00062
00065
00067 DefaultMultiVectorProductVector();
00068
00070 void initialize(
00071 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &productSpace,
00072 const RCP<MultiVectorBase<Scalar> > &multiVec
00073 );
00074
00076 void initialize(
00077 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &productSpace,
00078 const RCP<const MultiVectorBase<Scalar> > &multiVec
00079 );
00080
00081
00082
00084 RCP<MultiVectorBase<Scalar> >
00085 getNonconstMultiVector();
00086
00088 RCP<const MultiVectorBase<Scalar> >
00089 getMultiVector() const;
00090
00092 void uninitialize();
00093
00095
00098
00100 std::string description() const;
00101
00103 void describe(
00104 Teuchos::FancyOStream &out,
00105 const Teuchos::EVerbosityLevel verbLevel
00106 ) const;
00107
00109
00112
00114 RCP<VectorBase<Scalar> >
00115 getNonconstVectorBlock(const int k);
00117 RCP<const VectorBase<Scalar> >
00118 getVectorBlock(const int k) const;
00119
00121
00124
00126 RCP<const ProductVectorSpaceBase<Scalar> >
00127 productSpace() const;
00129 bool blockIsConst(const int k) const;
00131 RCP<MultiVectorBase<Scalar> >
00132 getNonconstMultiVectorBlock(const int k);
00134 RCP<const MultiVectorBase<Scalar> >
00135 getMultiVectorBlock(const int k) const;
00136
00138
00141
00143 RCP< const VectorSpaceBase<Scalar> > space() const;
00145 void applyOp(
00146 const RTOpPack::RTOpT<Scalar> &op,
00147 const int num_vecs,
00148 const VectorBase<Scalar>*const vecs[],
00149 const int num_targ_vecs,
00150 VectorBase<Scalar>*const targ_vecs[],
00151 RTOpPack::ReductTarget *reduct_obj,
00152 const Index first_ele,
00153 const Index sub_dim,
00154 const Index global_offset
00155 ) const;
00157 void acquireDetachedVectorViewImpl(
00158 const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec
00159 ) const;
00161 void releaseDetachedVectorViewImpl(
00162 RTOpPack::ConstSubVectorView<Scalar>* sub_vec
00163 ) const;
00165 void acquireNonconstDetachedVectorViewImpl(
00166 const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec
00167 );
00169 void commitNonconstDetachedVectorViewImpl(
00170 RTOpPack::SubVectorView<Scalar>* sub_vec
00171 );
00173 void setSubVector(
00174 const RTOpPack::SparseSubVectorT<Scalar>& sub_vec
00175 );
00176
00178
00179 private:
00180
00181
00182
00183
00184 typedef Teuchos::ConstNonconstObjectContainer<MultiVectorBase<Scalar> > CNMVC;
00185
00186
00187
00188
00189 int numBlocks_;
00190 RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > productSpace_;
00191 CNMVC multiVec_;
00192
00193
00194
00195
00196 RCP<const DefaultProductVector<Scalar> >
00197 getDefaultProductVector() const;
00198
00199 };
00200
00201
00207 template<class Scalar>
00208 inline
00209 RCP<DefaultMultiVectorProductVector<Scalar> >
00210 multiVectorProductVector(
00211 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &productSpace,
00212 const RCP<MultiVectorBase<Scalar> > &multiVec
00213 )
00214 {
00215 RCP<DefaultMultiVectorProductVector<Scalar> > multiVecProdVec
00216 = Teuchos::rcp(new DefaultMultiVectorProductVector<Scalar>());
00217 multiVecProdVec->initialize(productSpace,multiVec);
00218 return multiVecProdVec;
00219 }
00220
00221
00227 template<class Scalar>
00228 inline
00229 RCP<const DefaultMultiVectorProductVector<Scalar> >
00230 multiVectorProductVector(
00231 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &productSpace,
00232 const RCP<const MultiVectorBase<Scalar> > &multiVec
00233 )
00234 {
00235 RCP<DefaultMultiVectorProductVector<Scalar> > multiVecProdVec
00236 = Teuchos::rcp(new DefaultMultiVectorProductVector<Scalar>());
00237 multiVecProdVec->initialize(productSpace,multiVec);
00238 return multiVecProdVec;
00239 }
00240
00241
00242
00243
00244
00245
00251 template<class Scalar>
00252 inline
00253 RCP<DefaultMultiVectorProductVector<Scalar> >
00254 multiVectorProductVector(
00255 const RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &productSpace
00256 )
00257 {
00258 #ifdef TEUCHOS_DEBUG
00259 TEST_FOR_EXCEPT(is_null(productSpace));
00260 #endif
00261 return multiVectorProductVector(
00262 productSpace,
00263 createMembers(productSpace->getBlock(0),productSpace->numBlocks())
00264 );
00265 }
00266
00267
00268 }
00269
00270
00271 #endif // THYRA_MULTI_VECTOR_PRODUCT_VECTOR_DECL_HPP