00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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
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
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
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 }
00142
00143
00144 #endif // THYRA_MULTI_VECTOR_BASE_HPP