Thyra Package Browser (Single Doxygen Collection) Version of the Day
Thyra_MultiVectorBase_def.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_HPP
00030 #define THYRA_MULTI_VECTOR_BASE_HPP
00031 
00032 #include "Thyra_MultiVectorBase_decl.hpp"
00033 #include "Thyra_LinearOpBase.hpp"
00034 #include "Thyra_VectorSpaceBase.hpp"
00035 
00036 
00037 namespace Thyra {
00038 
00039 
00040 // Provide access to the columns as VectorBase objects
00041 
00042 
00043 template<class Scalar>
00044 RCP<const VectorBase<Scalar> >
00045 MultiVectorBase<Scalar>::colImpl(Ordinal j) const
00046 {
00047   return const_cast<MultiVectorBase*>(this)->nonconstColImpl(j);
00048 }
00049 
00050 
00051 // Overridden methods from LinearOpBase
00052 
00053 
00054 template<class Scalar>
00055 RCP<const LinearOpBase<Scalar> >
00056 MultiVectorBase<Scalar>::clone() const
00057 {
00058   return this->clone_mv();
00059 }
00060 
00061 
00062 //
00063 // Deprecated public function
00064 //
00065 
00066 
00067 template<class Scalar>
00068 void MultiVectorBase<Scalar>::applyOp(
00069   const RTOpPack::RTOpT<Scalar> &primary_op,
00070   const int num_multi_vecs,
00071   const MultiVectorBase<Scalar>*const multi_vecs_in[],
00072   const int num_targ_multi_vecs,
00073   MultiVectorBase<Scalar>*const targ_multi_vecs_inout[],
00074   RTOpPack::ReductTarget*const reduct_objs_inout[],
00075   const Ordinal primary_global_offset
00076   ) const
00077 {
00078   Array<Ptr<const MultiVectorBase<Scalar> > > multi_vecs;
00079   for (int k = 0; k < num_multi_vecs; ++k)
00080     multi_vecs.push_back(Teuchos::ptr(multi_vecs_in[k]));
00081   Array<Ptr<MultiVectorBase<Scalar> > > targ_multi_vecs;
00082   for (int k = 0; k < num_targ_multi_vecs; ++k)
00083     targ_multi_vecs.push_back(Teuchos::ptr(targ_multi_vecs_inout[k]));
00084   Array<Ptr<RTOpPack::ReductTarget> > reduct_objs;
00085   if (reduct_objs_inout) {
00086     const int secondary_sub_dim = ( num_multi_vecs
00087       ? multi_vecs[0]->domain() : targ_multi_vecs[0]->domain()
00088       )->dim();
00089     for (int k = 0; k < secondary_sub_dim; ++k)
00090       reduct_objs.push_back(Teuchos::ptr(reduct_objs_inout[k]));
00091   }
00092   mvMultiReductApplyOpImpl(
00093     primary_op,
00094     multi_vecs, targ_multi_vecs,
00095     reduct_objs, primary_global_offset);
00096 }
00097 
00098 
00099 template<class Scalar>
00100 void MultiVectorBase<Scalar>::applyOp(
00101   const RTOpPack::RTOpT<Scalar> &primary_op,
00102   const RTOpPack::RTOpT<Scalar> &secondary_op,
00103   const int num_multi_vecs,
00104   const MultiVectorBase<Scalar>*const multi_vecs_in[],
00105   const int num_targ_multi_vecs,
00106   MultiVectorBase<Scalar>*const targ_multi_vecs_inout[],
00107   RTOpPack::ReductTarget* reduct_obj,
00108   const Ordinal primary_global_offset
00109   ) const
00110 {
00111   Array<Ptr<const MultiVectorBase<Scalar> > > multi_vecs;
00112   for (int k = 0; k < num_multi_vecs; ++k)
00113     multi_vecs.push_back(Teuchos::ptr(multi_vecs_in[k]));
00114   Array<Ptr<MultiVectorBase<Scalar> > > targ_multi_vecs;
00115   for (int k = 0; k < num_targ_multi_vecs; ++k)
00116     targ_multi_vecs.push_back(Teuchos::ptr(targ_multi_vecs_inout[k]));
00117   mvSingleReductApplyOpImpl(
00118     primary_op, secondary_op,
00119     multi_vecs, targ_multi_vecs,
00120     Teuchos::ptr(reduct_obj),
00121     primary_global_offset);
00122 }
00123 
00124 
00125 } // end namespace Thyra
00126 
00127 
00128 #endif // THYRA_MULTI_VECTOR_BASE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines