Thyra_ProductVectorDecl.hpp

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 
00035 namespace Thyra {
00036 
00038 template <class Scalar> class ProductVectorSpace;
00039 
00053 template<class Scalar>
00054 class ProductVector
00055   : virtual public ProductVectorBase<Scalar>
00056   , virtual protected VectorDefaultBase<Scalar>
00057 {
00058 public:
00059 
00061   using ProductVectorBase<Scalar>::applyOp;
00062 
00065 
00067   ProductVector(
00068     const Teuchos::RefCountPtr<const ProductVectorSpace<Scalar> >  &productSpace
00069     ,const Teuchos::RefCountPtr<VectorBase<Scalar> >               vecs[]
00070     );
00071 
00076   void initialize(
00077     const Teuchos::RefCountPtr<const ProductVectorSpace<Scalar> >  &productSpace
00078     ,const Teuchos::RefCountPtr<VectorBase<Scalar> >               vecs[]
00079     );
00080 
00085   void uninitialize(
00086     Teuchos::RefCountPtr<const ProductVectorSpace<Scalar> >  *productSpace = NULL
00087     ,Teuchos::RefCountPtr<VectorBase<Scalar> >               vecs[]        = NULL
00088     );
00089 
00091 
00094 
00096   Teuchos::RefCountPtr<const ProductVectorSpaceBase<Scalar> > productSpace() const;
00098   Teuchos::RefCountPtr<VectorBase<Scalar> > getBlock(const int k); 
00100   Teuchos::RefCountPtr<const VectorBase<Scalar> > getBlock(const int k) const;
00101 
00103 
00106 
00108   Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > space() const;
00110   void applyOp(
00111     const RTOpPack::RTOpT<Scalar>    &op
00112     ,const int                       num_vecs
00113     ,const VectorBase<Scalar>*       vecs[]
00114     ,const int                       num_targ_vecs
00115     ,VectorBase<Scalar>*             targ_vecs[]
00116     ,RTOpPack::ReductTarget          *reduct_obj
00117     ,const Index                     first_ele
00118     ,const Index                     sub_dim
00119     ,const Index                     global_offset
00120     ) const;
00122   void getSubVector( const Range1D& rng, RTOpPack::SubVectorT<Scalar>* sub_vec ) const;
00124   void freeSubVector( RTOpPack::SubVectorT<Scalar>* sub_vec ) const;
00126   void getSubVector( const Range1D& rng, RTOpPack::MutableSubVectorT<Scalar>* sub_vec );
00128   void commitSubVector( RTOpPack::MutableSubVectorT<Scalar>* sub_vec );
00130   void setSubVector( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec );
00131 
00133 
00134 private:
00135 
00136   // //////////////////////////////
00137   // Private data members
00138 
00139   Teuchos::RefCountPtr<const ProductVectorSpace<Scalar> >       productSpace_;
00140   std::vector<Teuchos::RefCountPtr<VectorBase<Scalar> > >       vecs_;
00141   // cache
00142   int numBlocks_;
00143 
00144 
00145 protected:
00146 
00147   // //////////////////////////////
00148   // Protected member functions
00149   // Added to allow TSFExtended ProductVector to derive from this.
00150   ProductVector();
00151 
00152 };
00153 
00154 } // namespace Thyra
00155 
00156 #endif // THYRA_PRODUCT_VECTOR_DECL_HPP

Generated on Thu Sep 18 12:39:52 2008 for Thyra ANA Operator/VectorBase Interfaces and Related Software by doxygen 1.3.9.1