|
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_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 "Teuchos_ConstNonconstObjectContainer.hpp" 00035 00036 00037 namespace Thyra { 00038 00039 00041 template <class Scalar> class DefaultProductVectorSpace; 00042 00043 00057 template<class Scalar> 00058 class DefaultProductMultiVector 00059 : virtual public ProductMultiVectorBase<Scalar>, 00060 virtual protected MultiVectorDefaultBase<Scalar> 00061 { 00062 public: 00063 00066 00068 DefaultProductMultiVector(); 00069 00071 void initialize( 00072 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00073 const int numMembers 00074 ); 00075 00077 void initialize( 00078 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00079 const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs 00080 ); 00081 00083 void initialize( 00084 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00085 const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs 00086 ); 00087 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<const ProductVectorSpaceBase<Scalar> > 00115 productSpace() const; 00117 bool blockIsConst(const int k) const; 00119 RCP<MultiVectorBase<Scalar> > 00120 getNonconstMultiVectorBlock(const int k); 00122 RCP<const MultiVectorBase<Scalar> > 00123 getMultiVectorBlock(const int k) const; 00124 00126 00130 RCP<MultiVectorBase<Scalar> > clone_mv() const; 00131 00133 00136 00138 RCP< const VectorSpaceBase<Scalar> > 00139 range() const; 00141 RCP< const VectorSpaceBase<Scalar> > 00142 domain() const; 00143 00145 00146 protected: 00147 00150 00152 RCP<const VectorBase<Scalar> > colImpl(Ordinal j) const; 00154 RCP<VectorBase<Scalar> > nonconstColImpl(Ordinal j); 00156 RCP<const MultiVectorBase<Scalar> > 00157 contigSubViewImpl( const Range1D& colRng ) const; 00159 RCP<MultiVectorBase<Scalar> > 00160 nonconstContigSubViewImpl( const Range1D& colRng ); 00162 RCP<const MultiVectorBase<Scalar> > 00163 nonContigSubViewImpl( const ArrayView<const int> &cols ) const; 00165 RCP<MultiVectorBase<Scalar> > 00166 nonconstNonContigSubViewImpl( const ArrayView<const int> &cols ); 00168 void mvMultiReductApplyOpImpl( 00169 const RTOpPack::RTOpT<Scalar> &primary_op, 00170 const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs, 00171 const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs, 00172 const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs, 00173 const Ordinal primary_global_offset 00174 ) const; 00176 void acquireDetachedMultiVectorViewImpl( 00177 const Range1D &rowRng, 00178 const Range1D &colRng, 00179 RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv 00180 ) const; 00182 void releaseDetachedMultiVectorViewImpl( 00183 RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv 00184 ) const; 00186 void acquireNonconstDetachedMultiVectorViewImpl( 00187 const Range1D &rowRng, 00188 const Range1D &colRng, 00189 RTOpPack::SubMultiVectorView<Scalar> *sub_mv 00190 ); 00192 void commitNonconstDetachedMultiVectorViewImpl( 00193 RTOpPack::SubMultiVectorView<Scalar>* sub_mv 00194 ); 00195 00197 00200 00202 bool opSupportedImpl(EOpTransp M_trans) const; 00203 00205 void applyImpl( 00206 const EOpTransp M_trans, 00207 const MultiVectorBase<Scalar> &X, 00208 const Ptr<MultiVectorBase<Scalar> > &Y, 00209 const Scalar alpha, 00210 const Scalar beta 00211 ) const; 00212 00214 00215 public: 00216 00219 00221 DefaultProductMultiVector( 00222 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in, 00223 const int numMembers 00224 ) 00225 :numBlocks_(0) 00226 { initialize(productSpace_in, numMembers); } 00227 00229 DefaultProductMultiVector( 00230 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in, 00231 const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs 00232 ) 00233 :numBlocks_(0) 00234 { initialize(productSpace_in, multiVecs); } 00235 00237 DefaultProductMultiVector( 00238 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace_in, 00239 const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs 00240 ) 00241 :numBlocks_(0) 00242 { initialize(productSpace_in, multiVecs); } 00243 00245 00246 private: 00247 00248 // ////////////////////////////// 00249 // Private types 00250 00251 typedef Teuchos::ConstNonconstObjectContainer<MultiVectorBase<Scalar> > CNMVC; 00252 00253 // ////////////////////////////// 00254 // Private data members 00255 00256 RCP<const DefaultProductVectorSpace<Scalar> > productSpace_; 00257 Teuchos::Array<CNMVC> multiVecs_; 00258 // cache 00259 int numBlocks_; 00260 00261 // ////////////////////////////// 00262 // Private member functions 00263 00264 template<class MultiVectorType> 00265 void initializeImpl( 00266 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00267 const ArrayView<const RCP<MultiVectorType> > &multiVecs 00268 ); 00269 00270 void assertInitialized() const; 00271 00272 void validateColIndex(const int j) const; 00273 00274 }; 00275 00276 00281 template<class Scalar> 00282 RCP<DefaultProductMultiVector<Scalar> > 00283 defaultProductMultiVector(); 00284 00285 00290 template<class Scalar> 00291 RCP<DefaultProductMultiVector<Scalar> > 00292 defaultProductMultiVector( 00293 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00294 const int numMembers 00295 ); 00296 00297 00302 template<class Scalar> 00303 RCP<DefaultProductMultiVector<Scalar> > 00304 defaultProductMultiVector( 00305 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00306 const ArrayView<const RCP<MultiVectorBase<Scalar> > > &multiVecs 00307 ); 00308 00309 00314 template<class Scalar> 00315 RCP<DefaultProductMultiVector<Scalar> > 00316 defaultProductMultiVector( 00317 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00318 const ArrayView<const RCP<const MultiVectorBase<Scalar> > > &multiVecs 00319 ); 00320 00321 00328 template<class Scalar> 00329 RCP<const ProductMultiVectorBase<Scalar> > 00330 castOrCreateSingleBlockProductMultiVector( 00331 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00332 const RCP<const MultiVectorBase<Scalar> > &mv 00333 ); 00334 00335 00342 template<class Scalar> 00343 RCP<ProductMultiVectorBase<Scalar> > 00344 nonconstCastOrCreateSingleBlockProductMultiVector( 00345 const RCP<const DefaultProductVectorSpace<Scalar> > &productSpace, 00346 const RCP<MultiVectorBase<Scalar> > &mv 00347 ); 00348 00349 00350 // ///////////////////////// 00351 // Inline members 00352 00353 00354 #ifndef TEUCHOS_DEBUG 00355 00356 00357 template<class Scalar> 00358 inline 00359 void DefaultProductMultiVector<Scalar>::assertInitialized() const 00360 {} 00361 00362 00363 template<class Scalar> 00364 inline 00365 void DefaultProductMultiVector<Scalar>::validateColIndex(const int j) const 00366 {} 00367 00368 00369 #endif // TEUCHOS_DEBUG 00370 00371 00372 } // namespace Thyra 00373 00374 00375 #endif // THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP
1.7.4