Thyra_DefaultProductVectorDecl.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_PRODUCT_VECTOR_DECL_HPP
00030 #define THYRA_PRODUCT_VECTOR_DECL_HPP
00031 
00032 #include "Thyra_ProductVectorBase.hpp"
00033 #include "Thyra_VectorDefaultBase.hpp"
00034 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00035 
00036 namespace Thyra {
00037 
00039 template <class Scalar> class DefaultProductVectorSpace;
00040 
00054 template<class Scalar>
00055 class DefaultProductVector
00056   : virtual public ProductVectorBase<Scalar>
00057   , virtual protected VectorDefaultBase<Scalar>
00058 {
00059 public:
00060 
00062   using ProductVectorBase<Scalar>::applyOp;
00064   using VectorDefaultBase<Scalar>::acquireDetachedView;
00066   using VectorDefaultBase<Scalar>::releaseDetachedView;
00068   using VectorDefaultBase<Scalar>::commitDetachedView;
00069 
00072 
00074   DefaultProductVector(
00075     const Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  &productSpace
00076     );
00077 
00079   DefaultProductVector(
00080     const Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  &productSpace
00081     ,const Teuchos::RefCountPtr<VectorBase<Scalar> >                      vecs[]
00082     );
00083 
00085   DefaultProductVector(
00086     const Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  &productSpace
00087     ,const Teuchos::RefCountPtr<const VectorBase<Scalar> >                vecs[]
00088     );
00089 
00094   void initialize(
00095     const Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  &productSpace
00096     );
00097 
00102   void initialize(
00103     const Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  &productSpace
00104     ,const Teuchos::RefCountPtr<VectorBase<Scalar> >                      vecs[]
00105     );
00106 
00111   void initialize(
00112     const Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  &productSpace
00113     ,const Teuchos::RefCountPtr<const VectorBase<Scalar> >                vecs[]
00114     );
00115 
00120   void uninitialize();
00121 
00123 
00126 
00128   Teuchos::RefCountPtr<VectorBase<Scalar> > getNonconstVectorBlock(const int k); 
00130   Teuchos::RefCountPtr<const VectorBase<Scalar> > getVectorBlock(const int k) const;
00131 
00133 
00137   void setBlock(int i, const Teuchos::RefCountPtr<const VectorBase<Scalar> >& b); 
00139   void setNonconstBlock(int i, const Teuchos::RefCountPtr<VectorBase<Scalar> >& b); 
00141 
00144 
00146   Teuchos::RefCountPtr<const ProductVectorSpaceBase<Scalar> > productSpace() const;
00148   bool blockIsConst(const int k) const; 
00150   Teuchos::RefCountPtr<MultiVectorBase<Scalar> >
00151   getNonconstMultiVectorBlock(const int k);
00153   Teuchos::RefCountPtr<const MultiVectorBase<Scalar> >
00154   getMultiVectorBlock(const int k) const;
00155 
00157 
00160 
00162   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > space() const;
00164   void applyOp(
00165     const RTOpPack::RTOpT<Scalar>    &op
00166     ,const int                       num_vecs
00167     ,const VectorBase<Scalar>*const  vecs[]
00168     ,const int                       num_targ_vecs
00169     ,VectorBase<Scalar>*const        targ_vecs[]
00170     ,RTOpPack::ReductTarget          *reduct_obj
00171     ,const Index                     first_ele
00172     ,const Index                     sub_dim
00173     ,const Index                     global_offset
00174     ) const;
00176   void acquireDetachedView( const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec ) const;
00178   void releaseDetachedView( RTOpPack::ConstSubVectorView<Scalar>* sub_vec ) const;
00180   void acquireDetachedView( const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec );
00182   void commitDetachedView( RTOpPack::SubVectorView<Scalar>* sub_vec );
00184   void setSubVector( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec );
00185 
00187 
00188 private:
00189 
00190   // //////////////////////////////
00191   // Private types
00192 
00193   typedef Teuchos::ConstNonconstObjectContainer<VectorBase<Scalar> > CNVC;
00194 
00195   // //////////////////////////////
00196   // Private data members
00197 
00198   Teuchos::RefCountPtr<const DefaultProductVectorSpace<Scalar> >  productSpace_;
00199   Teuchos::Array<CNVC>                                            vecs_;
00200   // cache
00201   int numBlocks_;
00202 
00203 protected:
00204 
00205   // //////////////////////////////
00206   // Protected member functions
00207 
00208   // Added to allow TSFExtended DefaultProductVector to derive from this.
00209   DefaultProductVector();
00210 
00211 };
00212 
00213 } // namespace Thyra
00214 
00215 #endif // THYRA_PRODUCT_VECTOR_DECL_HPP

Generated on Thu Sep 18 12:33:02 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1