Thyra_DefaultProductMultiVectorDecl.hpp

Go to the documentation of this file.
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 "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 
00068 
00070   DefaultProductMultiVector(
00071     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00072     const int numMembers
00073     );
00074 
00076   DefaultProductMultiVector(
00077     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00078     const Teuchos::RCP<MultiVectorBase<Scalar> > multiVecs[]
00079     );
00080 
00082   DefaultProductMultiVector(
00083     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00084     const Teuchos::RCP<const MultiVectorBase<Scalar> > multiVecs[]
00085     );
00086 
00091   void initialize(
00092     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00093     const int numMembers
00094     );
00095 
00100   void initialize(
00101     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00102     const Teuchos::RCP<MultiVectorBase<Scalar> > multiVecs[]
00103     );
00104 
00109   void initialize(
00110     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00111     const Teuchos::RCP<const MultiVectorBase<Scalar> > multiVecs[]
00112     );
00113 
00118   void uninitialize();
00119 
00121 
00124                                                 
00126   std::string description() const;
00127 
00129   void describe(
00130     Teuchos::FancyOStream &out,
00131     const Teuchos::EVerbosityLevel verbLevel
00132     ) const;
00133 
00135 
00138 
00140   Teuchos::RCP<const ProductVectorSpaceBase<Scalar> >
00141   productSpace() const;
00143   bool blockIsConst(const int k) const;
00145   Teuchos::RCP<MultiVectorBase<Scalar> >
00146   getNonconstMultiVectorBlock(const int k);
00148   Teuchos::RCP<const MultiVectorBase<Scalar> >
00149   getMultiVectorBlock(const int k) const;
00150 
00152 
00155 
00157   Teuchos::RCP<const VectorBase<Scalar> > col(Index j) const;
00159   Teuchos::RCP<VectorBase<Scalar> > col(Index j);
00161   Teuchos::RCP<const MultiVectorBase<Scalar> >
00162   subView( const Range1D& colRng ) const;
00164   Teuchos::RCP<MultiVectorBase<Scalar> >
00165   subView( const Range1D& colRng );
00167   Teuchos::RCP<const MultiVectorBase<Scalar> >
00168   subView( const int numCols, const int cols[] ) const;
00170   Teuchos::RCP<MultiVectorBase<Scalar> >
00171   subView( const int numCols, const int cols[] );
00173   void mvMultiReductApplyOpImpl(
00174     const RTOpPack::RTOpT<Scalar> &primary_op,
00175     const int num_multi_vecs,
00176     const MultiVectorBase<Scalar>*const multi_vecs[],
00177     const int num_targ_multi_vecs,
00178     MultiVectorBase<Scalar>*const targ_multi_vecs[],
00179     RTOpPack::ReductTarget*const 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     );
00207   Teuchos::RCP<MultiVectorBase<Scalar> > clone_mv() const;
00208 
00210 
00213 
00215   Teuchos::RCP< const VectorSpaceBase<Scalar> >
00216   range() const;
00218   Teuchos::RCP< const VectorSpaceBase<Scalar> >
00219   domain() const;
00220 
00222 
00223 protected:
00224 
00227 
00229   bool opSupported(ETransp M_trans) const;
00231   void apply(
00232     const ETransp M_trans,
00233     const MultiVectorBase<Scalar> &X,
00234     MultiVectorBase<Scalar> *Y,
00235     const Scalar alpha,
00236     const Scalar beta
00237     ) const;
00238 
00240 
00241 private:
00242 
00243   // //////////////////////////////
00244   // Private types
00245 
00246   typedef Teuchos::ConstNonconstObjectContainer<MultiVectorBase<Scalar> > CNMVC;
00247 
00248   // //////////////////////////////
00249   // Private data members
00250 
00251   Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > productSpace_;
00252   Teuchos::Array<CNMVC> multiVecs_;
00253   // cache
00254   int numBlocks_;
00255 
00256   // //////////////////////////////
00257   // Private member functions
00258 
00259   template<class MultiVectorType>
00260   void initializeImpl(
00261     const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00262     const Teuchos::RCP<MultiVectorType> multiVecs[]
00263     );
00264   
00265   void assertInitialized() const;
00266 
00267   void validateColIndex(const int j) const;
00268 
00269   //  Not defined and not to be called!
00270   DefaultProductMultiVector();
00271 
00272 };
00273 
00274 
00279 template<class Scalar>
00280 inline
00281 Teuchos::RCP<DefaultProductMultiVector<Scalar> >
00282 defaultProductMultiVector(
00283   const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00284   const int numMembers
00285   )
00286 {
00287   return Teuchos::rcp(
00288     new DefaultProductMultiVector<Scalar>(productSpace,numMembers)
00289     );
00290 }
00291 
00292 
00297 template<class Scalar>
00298 Teuchos::RCP<DefaultProductMultiVector<Scalar> >
00299 defaultProductMultiVector(
00300   const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00301   const Teuchos::RCP<MultiVectorBase<Scalar> > multiVecs[]
00302   )
00303 {
00304   return Teuchos::rcp(
00305     new DefaultProductMultiVector<Scalar>(productSpace,multiVecs)
00306     );
00307 }
00308 
00309 
00314 template<class Scalar>
00315 Teuchos::RCP<DefaultProductMultiVector<Scalar> >
00316 defaultProductMultiVector(
00317   const Teuchos::RCP<const DefaultProductVectorSpace<Scalar> > &productSpace,
00318   const Teuchos::RCP<const MultiVectorBase<Scalar> > multiVecs[]
00319   )
00320 {
00321   return Teuchos::rcp(
00322     new DefaultProductMultiVector<Scalar>(productSpace,multiVecs)
00323     );
00324 }
00325 
00326 
00327 // /////////////////////////
00328 // Inline members
00329 
00330 #ifndef TEUCHOS_DEBUG
00331 
00332 
00333 template<class Scalar>
00334 inline
00335 void DefaultProductMultiVector<Scalar>::assertInitialized() const
00336 {}
00337 
00338 
00339 template<class Scalar>
00340 inline
00341 void DefaultProductMultiVector<Scalar>::validateColIndex(const int j) const
00342 {}
00343 
00344 
00345 
00346 #endif // TEUCHOS_DEBUG
00347 
00348 
00349 
00350 } // namespace Thyra
00351 
00352 
00353 #endif // THYRA_DEFAULT_PRODUCT_MULTI_VECTOR_DECL_HPP

Generated on Tue Oct 20 12:47:25 2009 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.4.7