Thyra_VectorBaseDecl.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_BASE_DECL_HPP
00030 #define THYRA_VECTOR_BASE_DECL_HPP
00031 
00032 #include "Thyra_OperatorVectorTypes.hpp"
00033 #include "Thyra_MultiVectorBaseDecl.hpp"
00034 #include "RTOpPack_RTOpT.hpp"
00035 
00036 namespace Thyra {
00037 
00128 template<class Scalar>
00129 class VectorBase : virtual public MultiVectorBase<Scalar>
00130 {
00131 public:
00132 
00134   using MultiVectorBase<Scalar>::describe;
00136   using MultiVectorBase<Scalar>::applyOp;
00138   using MultiVectorBase<Scalar>::col;
00140   using MultiVectorBase<Scalar>::acquireDetachedView;
00142   using MultiVectorBase<Scalar>::releaseDetachedView;
00144   using MultiVectorBase<Scalar>::commitDetachedView;
00145 
00148 
00165   virtual Teuchos::RefCountPtr< const VectorSpaceBase<Scalar> > space() const = 0;
00166 
00168 
00171 
00188   virtual void applyOp(
00189     const RTOpPack::RTOpT<Scalar>    &op
00190     ,const int                       num_vecs
00191     ,const VectorBase<Scalar>*const  vecs[]
00192     ,const int                       num_targ_vecs
00193     ,VectorBase<Scalar>*const        targ_vecs[]
00194     ,RTOpPack::ReductTarget          *reduct_obj
00195     ,const Index                     first_ele_offset
00196     ,const Index                     sub_dim
00197     ,const Index                     global_offset
00198     ) const = 0;
00199 
00201 
00204 
00219   virtual Teuchos::RefCountPtr<VectorBase<Scalar> > clone_v() const = 0;
00220 
00222 
00225 
00266   virtual void acquireDetachedView( const Range1D& rng, RTOpPack::ConstSubVectorView<Scalar>* sub_vec ) const = 0;
00267 
00287   virtual void releaseDetachedView( RTOpPack::ConstSubVectorView<Scalar>* sub_vec ) const = 0;
00288 
00336   virtual void acquireDetachedView( const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec ) = 0;
00337 
00361   virtual void commitDetachedView( RTOpPack::SubVectorView<Scalar>* sub_vec ) = 0;
00362 
00386   virtual void setSubVector( const RTOpPack::SparseSubVectorT<Scalar>& sub_vec ) = 0;
00387 
00389 
00390 }; // end class VectorBase
00391 
00401 
00484 template<class Scalar>
00485 inline
00486 void applyOp(
00487   const RTOpPack::RTOpT<Scalar>   &op
00488   ,const int                      num_vecs
00489   ,const VectorBase<Scalar>*const vecs[]
00490   ,const int                      num_targ_vecs
00491   ,VectorBase<Scalar>*const       targ_vecs[]
00492   ,RTOpPack::ReductTarget         *reduct_obj
00493   ,const Index                    first_ele_offset
00494 #ifndef __sun
00495                                                 = 0
00496 #endif
00497   ,const Index                    sub_dim
00498 #ifndef __sun
00499                                                 = -1
00500 #endif
00501   ,const Index                    global_offset
00502 #ifndef __sun
00503                                                 = 0
00504 #endif
00505   )
00506 {
00507   if(num_vecs)
00508     vecs[0]->applyOp(op,num_vecs,vecs,num_targ_vecs,targ_vecs,reduct_obj,first_ele_offset,sub_dim,global_offset);
00509   else if (num_targ_vecs)
00510     targ_vecs[0]->applyOp(op,num_vecs,vecs,num_targ_vecs,targ_vecs,reduct_obj,first_ele_offset,sub_dim,global_offset);
00511 }
00512 
00513 #ifdef __sun
00514 template<class Scalar>
00515 inline
00516 void applyOp(
00517   const RTOpPack::RTOpT<Scalar>   &op
00518   ,const int                      num_vecs
00519   ,const VectorBase<Scalar>*      vecs[]
00520   ,const int                      num_targ_vecs
00521   ,VectorBase<Scalar>*            targ_vecs[]
00522   ,RTOpPack::ReductTarget         *reduct_obj
00523   )
00524 {
00525   applyOp(op,num_vecs,vecs,num_targ_vecs,targ_vecs,reduct_obj,0,-1,0);
00526 }
00527 #endif
00528 
00530 
00531 } // end namespace Thyra
00532 
00533 #endif  // THYRA_VECTOR_BASE_DECL_HPP

Generated on Thu Sep 18 12:32:11 2008 for Fundamental Thyra ANA Operator/Vector Interfaces by doxygen 1.3.9.1