TSFMultiVector.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 /* ***********************************************************************
00003 // 
00004 //           TSFExtended: Trilinos Solver Framework Extended
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 TSFMULTIVECTOR_HPP
00030 #define TSFMULTIVECTOR_HPP
00031 
00032 #include "SundanceDefs.hpp"
00033 #include "SundanceHandle.hpp"
00034 #include "Thyra_MultiVectorBase.hpp"
00035 #include "Thyra_VectorSpaceBase.hpp"
00036 #include "TSFVectorSpaceDecl.hpp"
00037 #include "TSFLoadableVector.hpp"
00038 #include "TSFAccessibleVector.hpp"
00039 #include "Thyra_VectorStdOps.hpp"
00040 #include "Teuchos_TimeMonitor.hpp"
00041 #include "Range1D.hpp"
00042 #include "Teuchos_RefCountPtr.hpp"
00043 #include "TSFLinearOperatorDecl.hpp"
00044 
00045 
00046 
00047 namespace TSFExtended
00048 {
00049   using Thyra::Index;
00050   using Thyra::Range1D;
00051   using Thyra::EOpTransp;
00052   using namespace Teuchos;
00053   
00054 
00055   template <class Scalar>
00056   class MultiVector : public Sundance::Handle<Thyra::MultiVectorBase<Scalar> >
00057     {
00058     public:
00059 
00060       HANDLE_CTORS(MultiVector<Scalar>, Thyra::MultiVectorBase<Scalar>);
00061       
00062       /** Provide access to the columns as <\tt> Vector<\tt> objects */
00063 
00064 
00065       /** Get mutable view of column vector  */
00066       //      virtual Teuchos::RCP<Vector<Scalar> > col(Index j) const;
00067       virtual Vector<Scalar> col(Index j) const;
00068 
00069 
00070 
00071       /** Get nonmutable view of column vector  */
00072       //virtual Teuchos::RCP<const Vector<Scalar> > col(Index j) const;
00073       virtual const Vector<Scalar> col(Index j) const;
00074 
00075 
00076 
00077       /** Clone the multivector, if supported  */
00078       //virtual Teuchos::RCP<MultiVector<Scalar> > clone_mv() const;
00079       virtual MultiVector<Scalar> clone_mv() const;
00080 
00081 
00082         /** Returns a const sub-view of a contiguous set of columns of
00083       the this multi-vector. */
00084 //        virtual Teuchos::RCP<const MultiVector<Scalar> > 
00085 //               subView( const Range1D& col_rng ) const;
00086        virtual const MultiVector<Scalar> subView(const Range1D& col_rng) const;
00087 
00088 
00089        /** Returns a non-const sub-view of a contiguous set of columns
00090      of the t his multi-vector. */
00091 //        virtual Teuchos::RCP<MultiVector<Scalar> > 
00092 //               subView( const Range1D& col_rng );
00093        virtual MultiVector<Scalar> subView(const Range1D& col_rng);
00094 
00095         /** Returns a const sub-view of a non-contiguous set of columns of this
00096       multi-vector. */
00097 //       virtual Teuchos::RCP<const MultiVector<Scalar> > 
00098 //             subView( const int numCols, const int cols[] ) const;
00099        virtual const MultiVector<Scalar> subView( const int numCols, 
00100 
00101               const int cols[] ) const;
00102      
00103 
00104        /** Apply a reduction/transformation operator column by column
00105      and return an array of the reduction objects.  */
00106 
00107 //        virtual void applyOp(
00108 //                 const RTOpPack::RTOpT<Scalar>   &primary_op
00109 //                 ,const int                   num_multi_vecs
00110 //                 ,const MultiVector<Scalar>*     multi_vecs[]
00111 //                 ,const int                   num_targ_multi_vecs
00112 //                 ,MultiVector<Scalar>*           targ_multi_vecs[]
00113 //                 ,RTOpPack::ReductTarget*        reduct_objs[]
00114 //                 ,const Index                    primary_first_ele
00115 //                ,const Index                    primary_sub_dim
00116 //                 ,const Index                    primary_global_offset
00117 //                 ,const Index                    secondary_first_ele
00118 //                 ,const Index                    secondary_sub_dim
00119 //                 ) const;
00120 
00121        virtual void applyOp(
00122                 const RTOpPack::RTOpT<Scalar>   &primary_op
00123                 ,const int                   num_multi_vecs
00124                 ,const MultiVector<Scalar>*     multi_vecs[]
00125                 ,const int                   num_targ_multi_vecs
00126                 ,MultiVector<Scalar>*           targ_multi_vecs[]
00127                 ,RTOpPack::ReductTarget*        reduct_objs[]
00128                 ,const Index                    primary_first_ele
00129                ,const Index                    primary_sub_dim
00130                 ,const Index                    primary_global_offset
00131                 ,const Index                    secondary_first_ele
00132                 ,const Index                    secondary_sub_dim
00133                 ) const;
00134 
00135 
00136         /** Apply a reduction/transformation operator column by column
00137             and reduce the intermediate reduction objects into one
00138             reduction object. */
00139 
00140 
00141        virtual void applyOp(
00142                 const RTOpPack::RTOpT<Scalar>   &primary_op
00143                 ,const RTOpPack::RTOpT<Scalar>  &secondary_op
00144                 ,const int                   num_multi_vecs
00145                 ,const MultiVector<Scalar>*     multi_vecs[]
00146                 ,const int                   num_targ_multi_vecs
00147                 ,MultiVector<Scalar>*           targ_multi_vecs[]
00148                 ,RTOpPack::ReductTarget         *reduct_obj
00149                 ,const Index                    primary_first_ele
00150                 ,const Index                    primary_sub_dim
00151                 ,const Index                    primary_global_offset
00152                 ,const Index                    secondary_first_ele
00153                 ,const Index                    secondary_sub_dim
00154                 ) const;
00155 
00156       /** Get a non-mutable explicit view of a sub-multi-vector. */
00157          
00158        virtual void getSubMultiVector(
00159                 const Range1D                       &rowRng
00160                 ,const Range1D                      &colRng
00161                 ,RTOpPack::SubMultiVectorT<Scalar>  *sub_mv
00162                 ) const;
00163 
00164 
00165 
00166       /** Free an explicit view of a sub-multi-vector. */
00167        virtual void freeSubMultiVector( RTOpPack::SubMultiVectorT<Scalar>* 
00168           sub_mv ) const;
00169 
00170 
00171 
00172 
00173       /** Get a mutable explicit view of a sub-multi-vector. */
00174         virtual void getSubMultiVector(
00175                 const Range1D                                &rowRng
00176                 ,const Range1D                               &colRng
00177                 ,RTOpPack::MutableSubMultiVectorT<Scalar>    *sub_mv
00178                 );
00179 
00180 
00181 
00182 
00183       /** Commit changes for a mutable explicit view of a sub-multi-vector. */
00184         virtual void commitSubMultiVector(
00185           RTOpPack::MutableSubMultiVectorT<Scalar>* sub_mv );
00186 
00187 
00188        /** @name Overridden methods from LinearOp */
00189         //@{
00190 
00191         ///
00192         /** This method is implemented in terms of the mulit-vector
00193       <tt>applyOp( )</tt> method. */
00194        void apply( 
00195                 const EOpTransp            M_trans 
00196                 ,const Vector<Scalar>    &x 
00197                 ,Vector<Scalar>          *y 
00198                 ,const Scalar            alpha 
00199                 ,const Scalar            beta 
00200                 ) const; 
00201 
00202     /// This method is simply overridden to return <tt>this->clone_lons()</tt>.
00203 
00204        //Teuchos::RCP<const LinearOp<Scalar> > clone() const;
00205         LinearOperator<Scalar> clone() const;
00206 
00207         //@}
00208       
00209   };
00210   
00211 }
00212 
00213  
00214 #endif   

Site Contact