Thyra_MultiVectorBaseDecl.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_MULTI_VECTOR_BASE_DECL_HPP
00030 #define THYRA_MULTI_VECTOR_BASE_DECL_HPP
00031 
00032 #include "Thyra_LinearOpBaseDecl.hpp"
00033 #include "RTOpPack_RTOpT.hpp"
00034 
00035 namespace Thyra {
00036 
00475 template<class Scalar>
00476 class MultiVectorBase : virtual public LinearOpBase<Scalar>
00477 {
00478 public:
00479 
00481   using LinearOpBase<Scalar>::describe;
00482   
00485 
00507   virtual Teuchos::RefCountPtr<const VectorBase<Scalar> > col(Index j) const;
00508 
00529   virtual Teuchos::RefCountPtr<VectorBase<Scalar> > col(Index j) = 0;
00530 
00532 
00535 
00559   virtual Teuchos::RefCountPtr<const MultiVectorBase<Scalar> > subView( const Range1D& colRng ) const = 0;
00560   
00585   virtual Teuchos::RefCountPtr<MultiVectorBase<Scalar> > subView( const Range1D& colRng ) = 0;
00586 
00612   virtual Teuchos::RefCountPtr<const MultiVectorBase<Scalar> > subView( const int numCols, const int cols[] ) const = 0;
00613 
00639   virtual Teuchos::RefCountPtr<MultiVectorBase<Scalar> > subView( const int numCols, const int cols[] ) = 0;
00640   
00642 
00645 
00667   virtual void applyOp(
00668     const RTOpPack::RTOpT<Scalar>         &primary_op
00669     ,const int                            num_multi_vecs
00670     ,const MultiVectorBase<Scalar>*const  multi_vecs[]
00671     ,const int                            num_targ_multi_vecs
00672     ,MultiVectorBase<Scalar>*const        targ_multi_vecs[]
00673     ,RTOpPack::ReductTarget*const         reduct_objs[]
00674     ,const Index                          primary_first_ele_offset
00675     ,const Index                          primary_sub_dim
00676     ,const Index                          primary_global_offset
00677     ,const Index                          secondary_first_ele_offset
00678     ,const Index                          secondary_sub_dim
00679     ) const = 0;
00680 
00701   virtual void applyOp(
00702     const RTOpPack::RTOpT<Scalar>         &primary_op
00703     ,const RTOpPack::RTOpT<Scalar>        &secondary_op
00704     ,const int                            num_multi_vecs
00705     ,const MultiVectorBase<Scalar>*const  multi_vecs[]
00706     ,const int                            num_targ_multi_vecs
00707     ,MultiVectorBase<Scalar>*const        targ_multi_vecs[]
00708     ,RTOpPack::ReductTarget               *reduct_obj
00709     ,const Index                          primary_first_ele_offset
00710     ,const Index                          primary_sub_dim
00711     ,const Index                          primary_global_offset
00712     ,const Index                          secondary_first_ele_offset
00713     ,const Index                          secondary_sub_dim
00714     ) const = 0;
00715 
00717 
00720 
00780   virtual void acquireDetachedView(
00781     const Range1D                       &rowRng
00782     ,const Range1D                      &colRng
00783     ,RTOpPack::ConstSubMultiVectorView<Scalar>  *sub_mv
00784     ) const = 0;
00785 
00811   virtual void releaseDetachedView( RTOpPack::ConstSubMultiVectorView<Scalar>* sub_mv ) const = 0;
00812 
00882   virtual void acquireDetachedView(
00883     const Range1D                            &rowRng
00884     ,const Range1D                           &colRng
00885     ,RTOpPack::SubMultiVectorView<Scalar>    *sub_mv
00886     ) = 0;
00887 
00916   virtual void commitDetachedView( RTOpPack::SubMultiVectorView<Scalar>* sub_mv ) = 0;
00917 
00919 
00922 
00931   virtual Teuchos::RefCountPtr<MultiVectorBase<Scalar> > clone_mv() const = 0;
00932 
00934 
00937 
00939   Teuchos::RefCountPtr<const LinearOpBase<Scalar> > clone() const;
00940 
00942 
00943 private:
00944   
00945 #ifdef DOXYGEN_COMPILE
00946   VectorBase<Scalar>  *columns; // Doxygen only
00947 #endif  
00948 
00949 }; // end class MultiVectorBase<Scalar>
00950 
00960 
00966 template<class Scalar>
00967 inline
00968 void applyOp(
00969   const RTOpPack::RTOpT<Scalar>        &primary_op
00970   ,const int                           num_multi_vecs
00971   ,const MultiVectorBase<Scalar>*const multi_vecs[]
00972   ,const int                           num_targ_multi_vecs
00973   ,MultiVectorBase<Scalar>*const       targ_multi_vecs[]
00974   ,RTOpPack::ReductTarget*const        reduct_objs[]
00975   ,const Index                         primary_first_ele_offset
00976 #ifndef __sun
00977                                        = 0
00978 #endif
00979   ,const Index                         primary_sub_dim
00980 #ifndef __sun
00981                                        = -1
00982 #endif
00983   ,const Index                         primary_global_offset
00984 #ifndef __sun
00985                                        = 0
00986 #endif
00987   ,const Index                         secondary_first_ele_offset
00988 #ifndef __sun
00989                                        = 0
00990 #endif
00991   ,const Index                         secondary_sub_dim
00992 #ifndef __sun
00993                                        = -1
00994 #endif
00995   )
00996 {
00997   if(num_multi_vecs)
00998     multi_vecs[0]->applyOp(
00999       primary_op
01000       ,num_multi_vecs,multi_vecs,num_targ_multi_vecs,targ_multi_vecs
01001       ,reduct_objs,primary_first_ele_offset,primary_sub_dim,primary_global_offset
01002       ,secondary_first_ele_offset,secondary_sub_dim
01003       );
01004   else if(num_targ_multi_vecs)
01005     targ_multi_vecs[0]->applyOp(
01006       primary_op
01007       ,num_multi_vecs,multi_vecs,num_targ_multi_vecs,targ_multi_vecs
01008       ,reduct_objs,primary_first_ele_offset,primary_sub_dim,primary_global_offset
01009       ,secondary_first_ele_offset,secondary_sub_dim
01010       );
01011 }
01012 
01013 #ifdef __sun
01014 template<class Scalar>
01015 inline
01016 void applyOp(
01017   const RTOpPack::RTOpT<Scalar>        &primary_op
01018   ,const int                           num_multi_vecs
01019   ,const MultiVectorBase<Scalar>*const multi_vecs[]
01020   ,const int                           num_targ_multi_vecs
01021   ,MultiVectorBase<Scalar>*const       targ_multi_vecs[]
01022   ,RTOpPack::ReductTarget*const        reduct_objs[]
01023   )
01024 {
01025   applyOp(
01026     primary_op
01027     ,num_multi_vecs,multi_vecs,num_targ_multi_vecs,targ_multi_vecs
01028     ,reduct_objs,0,-1,0,0,-1
01029     );
01030 }
01031 #endif
01032 
01038 template<class Scalar>
01039 inline
01040 void applyOp(
01041   const RTOpPack::RTOpT<Scalar>        &primary_op
01042   ,const RTOpPack::RTOpT<Scalar>       &secondary_op
01043   ,const int                           num_multi_vecs
01044   ,const MultiVectorBase<Scalar>*const multi_vecs[]
01045   ,const int                           num_targ_multi_vecs
01046   ,MultiVectorBase<Scalar>*const       targ_multi_vecs[]
01047   ,RTOpPack::ReductTarget              *reduct_obj
01048   ,const Index                         primary_first_ele_offset
01049 #ifndef __sun
01050                                        = 0
01051 #endif
01052   ,const Index                         primary_sub_dim
01053 #ifndef __sun
01054                                        = -1
01055 #endif
01056   ,const Index                         primary_global_offset
01057 #ifndef __sun
01058                                        = 0
01059 #endif
01060   ,const Index                         secondary_first_ele_offset
01061 #ifndef __sun
01062                                        = 0
01063 #endif
01064   ,const Index                         secondary_sub_dim
01065 #ifndef __sun
01066                                        = -1
01067 #endif
01068   )
01069 {
01070   if(num_multi_vecs)
01071     multi_vecs[0]->applyOp(
01072       primary_op,secondary_op
01073       ,num_multi_vecs,multi_vecs,num_targ_multi_vecs,targ_multi_vecs
01074       ,reduct_obj,primary_first_ele_offset,primary_sub_dim,primary_global_offset
01075       ,secondary_first_ele_offset,secondary_sub_dim
01076       );
01077   else if(num_targ_multi_vecs)
01078     targ_multi_vecs[0]->applyOp(
01079       primary_op,secondary_op
01080       ,num_multi_vecs,multi_vecs,num_targ_multi_vecs,targ_multi_vecs
01081       ,reduct_obj,primary_first_ele_offset,primary_sub_dim,primary_global_offset
01082       ,secondary_first_ele_offset,secondary_sub_dim
01083       );
01084 }
01085 
01086 #ifdef __sun
01087 
01088 template<class Scalar>
01089 inline
01090 void applyOp(
01091   const RTOpPack::RTOpT<Scalar>        &primary_op
01092   ,const RTOpPack::RTOpT<Scalar>       &secondary_op
01093   ,const int                           num_multi_vecs
01094   ,const MultiVectorBase<Scalar>*const multi_vecs[]
01095   ,const int                           num_targ_multi_vecs
01096   ,MultiVectorBase<Scalar>*const       targ_multi_vecs[]
01097   ,RTOpPack::ReductTarget              *reduct_obj
01098   )
01099 {
01100   applyOp(
01101     primary_op,secondary_op
01102     ,num_multi_vecs,multi_vecs,num_targ_multi_vecs,targ_multi_vecs
01103     ,reduct_obj,0,-1,0,0,-1
01104     );
01105 }
01106 
01107 #endif // __sun
01108 
01110 
01111 } // namespace Thyra
01112 
01113 #endif // THYRA_MULTI_VECTOR_BASE_DECL_HPP

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