Thyra_VectorDefaultBaseDecl.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_VECTOR_DEFAULT_BASE_DECL_HPP
00030 #define THYRA_VECTOR_DEFAULT_BASE_DECL_HPP
00031 
00032 #include "Thyra_VectorBaseDecl.hpp"
00033 #include "Thyra_MultiVectorDefaultBaseDecl.hpp"
00034 #include "Thyra_SingleRhsLinearOpBaseDecl.hpp"
00035 
00036 namespace Thyra {
00037 
00062 template<class Scalar>
00063 class VectorDefaultBase
00064   : virtual public VectorBase<Scalar>
00065   , virtual protected MultiVectorDefaultBase<Scalar>
00066   , virtual protected SingleRhsLinearOpBase<Scalar>
00067 {
00068 public:
00069 
00070 #ifdef THYRA_INJECT_USING_DECLARATIONS
00071   using VectorBase<Scalar>::apply;
00072   using MultiVectorDefaultBase<Scalar>::apply;
00073   using SingleRhsLinearOpBase<Scalar>::apply;
00074 #endif
00075 
00078 
00080   virtual std::string description() const;
00081 
00104   virtual void describe(
00105     Teuchos::FancyOStream                &out
00106     ,const Teuchos::EVerbosityLevel      verbLevel
00107     ) const;
00108 
00110 
00113 
00115   virtual RCP< const VectorSpaceBase<Scalar> > range() const;
00117   virtual RCP< const VectorSpaceBase<Scalar> > domain() const;
00118 
00120 
00123 
00125   RCP<MultiVectorBase<Scalar> > clone_mv() const;
00126 
00128 
00131 
00135   RCP<VectorBase<Scalar> > clone_v() const;
00136 
00138 
00139 protected:
00140 
00143 
00145   virtual RCP<VectorBase<Scalar> > nonconstColImpl(Index j);
00147   virtual RCP<const MultiVectorBase<Scalar> >
00148   contigSubViewImpl( const Range1D& col_rng ) const;
00150   virtual RCP<MultiVectorBase<Scalar> >
00151   nonconstContigSubViewImpl( const Range1D& col_rng );
00153   virtual RCP<const MultiVectorBase<Scalar> >
00154   nonContigSubViewImpl( const ArrayView<const int> &cols ) const;
00156   virtual RCP<MultiVectorBase<Scalar> >
00157   nonconstNonContigSubViewImpl( const ArrayView<const int> &cols );
00159   virtual void acquireDetachedMultiVectorViewImpl(
00160     const Range1D &rowRng,
00161     const Range1D &colRng,
00162     RTOpPack::ConstSubMultiVectorView<Scalar> *sub_mv
00163     ) const;
00165   virtual void releaseDetachedMultiVectorViewImpl(
00166     RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv
00167     ) const;
00169   virtual void acquireNonconstDetachedMultiVectorViewImpl(
00170     const Range1D &rowRng,
00171     const Range1D &colRng,
00172     RTOpPack::SubMultiVectorView<Scalar> *sub_mv
00173     );
00175   virtual void commitNonconstDetachedMultiVectorViewImpl(
00176     RTOpPack::SubMultiVectorView<Scalar>* sub_mv
00177     );
00178 
00180 
00183 
00198   virtual void acquireDetachedVectorViewImpl(
00199     const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec
00200     ) const;
00208   virtual void releaseDetachedVectorViewImpl(
00209     RTOpPack::ConstSubVectorView<Scalar>* sub_vec
00210     ) const;
00224   virtual void acquireNonconstDetachedVectorViewImpl(
00225     const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec
00226     );
00233   virtual void commitNonconstDetachedVectorViewImpl(
00234     RTOpPack::SubVectorView<Scalar>* sub_vec
00235     );
00245   virtual void setSubVectorImpl( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec );
00246 
00248 
00254 
00259   bool opSupported(EOpTransp M_trans) const;
00260 
00262   void apply(
00263     const EOpTransp M_trans,
00264     const VectorBase<Scalar> &x,
00265     VectorBase<Scalar> *y,
00266     const Scalar alpha,
00267     const Scalar beta
00268     ) const;
00269 
00271 
00272 private:
00273 
00274   // /////////////////////////////////////
00275   // Private data members
00276 
00277   RCP<VectorSpaceBase<Scalar> >  domain_; // Only initialized if *this is used as a MultiVectorBase
00278 
00279   // /////////////////////////////////////
00280   // Private member functions
00281 
00282   void validateColRng( const Range1D &rowRng ) const;
00283   void validateColIndexes( const ArrayView<const int> &cols ) const;
00284 
00285 };
00286 
00287 } // end namespace Thyra
00288 
00289 #endif  // THYRA_VECTOR_DEFAULT_BASE_DECL_HPP

Generated on Wed May 12 21:26:54 2010 for Thyra Operator/Vector Support by  doxygen 1.4.7