Thyra_MultiVectorBase_def.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_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_first_ele_offset,
00076   const Ordinal primary_sub_dim,
00077   const Ordinal primary_global_offset,
00078     const Ordinal secondary_first_ele_offset,
00079   const Ordinal secondary_sub_dim_in
00080   ) const
00081 {
00082   Array<Ptr<const MultiVectorBase<Scalar> > > multi_vecs;
00083   for (int k = 0; k < num_multi_vecs; ++k)
00084     multi_vecs.push_back(Teuchos::ptr(multi_vecs_in[k]));
00085   Array<Ptr<MultiVectorBase<Scalar> > > targ_multi_vecs;
00086   for (int k = 0; k < num_targ_multi_vecs; ++k)
00087     targ_multi_vecs.push_back(Teuchos::ptr(targ_multi_vecs_inout[k]));
00088   Array<Ptr<RTOpPack::ReductTarget> > reduct_objs;
00089   if (reduct_objs_inout) {
00090     const int secondary_sub_dim =
00091       (
00092         secondary_sub_dim_in >= 0
00093         ? secondary_sub_dim_in
00094         : ( num_multi_vecs ? multi_vecs[0]->domain() : targ_multi_vecs[0]->domain() )->dim()
00095         );
00096     const int num_reduct_objs = ( secondary_sub_dim - secondary_first_ele_offset );
00097     for (int k = 0; k < num_reduct_objs; ++k)
00098       reduct_objs.push_back(Teuchos::ptr(reduct_objs_inout[k]));
00099   }
00100   mvMultiReductApplyOpImpl(
00101     primary_op
00102     ,multi_vecs,targ_multi_vecs
00103     ,reduct_objs,primary_first_ele_offset,primary_sub_dim,primary_global_offset
00104     ,secondary_first_ele_offset,secondary_sub_dim_in
00105     );
00106 }
00107 
00108 
00109 template<class Scalar>
00110 void MultiVectorBase<Scalar>::applyOp(
00111   const RTOpPack::RTOpT<Scalar> &primary_op,
00112   const RTOpPack::RTOpT<Scalar> &secondary_op,
00113   const int num_multi_vecs,
00114   const MultiVectorBase<Scalar>*const multi_vecs_in[],
00115   const int num_targ_multi_vecs,
00116   MultiVectorBase<Scalar>*const targ_multi_vecs_inout[],
00117   RTOpPack::ReductTarget* reduct_obj,
00118   const Ordinal primary_first_ele_offset,
00119   const Ordinal primary_sub_dim,
00120   const Ordinal primary_global_offset,
00121   const Ordinal secondary_first_ele_offset,
00122   const Ordinal secondary_sub_dim
00123   ) const
00124 {
00125   Array<Ptr<const MultiVectorBase<Scalar> > > multi_vecs;
00126   for (int k = 0; k < num_multi_vecs; ++k)
00127     multi_vecs.push_back(Teuchos::ptr(multi_vecs_in[k]));
00128   Array<Ptr<MultiVectorBase<Scalar> > > targ_multi_vecs;
00129   for (int k = 0; k < num_targ_multi_vecs; ++k)
00130     targ_multi_vecs.push_back(Teuchos::ptr(targ_multi_vecs_inout[k]));
00131   mvSingleReductApplyOpImpl(
00132     primary_op, secondary_op
00133     ,multi_vecs,targ_multi_vecs
00134     ,Teuchos::ptr(reduct_obj)
00135     ,primary_first_ele_offset,primary_sub_dim,primary_global_offset
00136     ,secondary_first_ele_offset,secondary_sub_dim
00137     );
00138 }
00139 
00140 
00141 } // end namespace Thyra
00142 
00143 
00144 #endif // THYRA_MULTI_VECTOR_BASE_HPP

Generated on Wed Feb 10 16:27:51 2010 for Fundamental Thyra ANA Operator/Vector Interfaces by  doxygen 1.4.7