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_MultiVectorBaseDecl.hpp"
00033 #include "Thyra_LinearOpBase.hpp"
00034
00035
00036 namespace Thyra {
00037
00038
00039
00040
00041
00042 template<class Scalar>
00043 RCP<const VectorBase<Scalar> >
00044 MultiVectorBase<Scalar>::colImpl(Index j) const
00045 {
00046 return const_cast<MultiVectorBase*>(this)->nonconstColImpl(j);
00047 }
00048
00049
00050
00051
00052
00053 template<class Scalar>
00054 RCP<const LinearOpBase<Scalar> >
00055 MultiVectorBase<Scalar>::clone() const
00056 {
00057 return this->clone_mv();
00058 }
00059
00060
00061
00062
00063
00064
00065
00066 template<class Scalar>
00067 void MultiVectorBase<Scalar>::applyOp(
00068 const RTOpPack::RTOpT<Scalar> &primary_op,
00069 const int num_multi_vecs,
00070 const MultiVectorBase<Scalar>*const multi_vecs_in[],
00071 const int num_targ_multi_vecs,
00072 MultiVectorBase<Scalar>*const targ_multi_vecs_inout[],
00073 RTOpPack::ReductTarget*const reduct_objs_inout[],
00074 const Index primary_first_ele_offset,
00075 const Index primary_sub_dim,
00076 const Index primary_global_offset,
00077 const Index secondary_first_ele_offset,
00078 const Index secondary_sub_dim_in
00079 ) const
00080 {
00081 Array<Ptr<const MultiVectorBase<Scalar> > > multi_vecs;
00082 for (int k = 0; k < num_multi_vecs; ++k)
00083 multi_vecs.push_back(Teuchos::ptr(multi_vecs_in[k]));
00084 Array<Ptr<MultiVectorBase<Scalar> > > targ_multi_vecs;
00085 for (int k = 0; k < num_targ_multi_vecs; ++k)
00086 targ_multi_vecs.push_back(Teuchos::ptr(targ_multi_vecs_inout[k]));
00087 Array<Ptr<RTOpPack::ReductTarget> > reduct_objs;
00088 if (reduct_objs_inout) {
00089 const int secondary_sub_dim =
00090 (
00091 secondary_sub_dim_in >= 0
00092 ? secondary_sub_dim_in
00093 : ( num_multi_vecs ? multi_vecs[0]->domain() : targ_multi_vecs[0]->domain() )->dim()
00094 );
00095 const int num_reduct_objs = ( secondary_sub_dim - secondary_first_ele_offset );
00096 for (int k = 0; k < num_reduct_objs; ++k)
00097 reduct_objs.push_back(Teuchos::ptr(reduct_objs_inout[k]));
00098 }
00099 mvMultiReductApplyOpImpl(
00100 primary_op
00101 ,multi_vecs,targ_multi_vecs
00102 ,reduct_objs,primary_first_ele_offset,primary_sub_dim,primary_global_offset
00103 ,secondary_first_ele_offset,secondary_sub_dim_in
00104 );
00105 }
00106
00107
00108 template<class Scalar>
00109 void MultiVectorBase<Scalar>::applyOp(
00110 const RTOpPack::RTOpT<Scalar> &primary_op,
00111 const RTOpPack::RTOpT<Scalar> &secondary_op,
00112 const int num_multi_vecs,
00113 const MultiVectorBase<Scalar>*const multi_vecs_in[],
00114 const int num_targ_multi_vecs,
00115 MultiVectorBase<Scalar>*const targ_multi_vecs_inout[],
00116 RTOpPack::ReductTarget* reduct_obj,
00117 const Index primary_first_ele_offset,
00118 const Index primary_sub_dim,
00119 const Index primary_global_offset,
00120 const Index secondary_first_ele_offset,
00121 const Index secondary_sub_dim
00122 ) const
00123 {
00124 Array<Ptr<const MultiVectorBase<Scalar> > > multi_vecs;
00125 for (int k = 0; k < num_multi_vecs; ++k)
00126 multi_vecs.push_back(Teuchos::ptr(multi_vecs_in[k]));
00127 Array<Ptr<MultiVectorBase<Scalar> > > targ_multi_vecs;
00128 for (int k = 0; k < num_targ_multi_vecs; ++k)
00129 targ_multi_vecs.push_back(Teuchos::ptr(targ_multi_vecs_inout[k]));
00130 mvSingleReductApplyOpImpl(
00131 primary_op, secondary_op
00132 ,multi_vecs,targ_multi_vecs
00133 ,Teuchos::ptr(reduct_obj)
00134 ,primary_first_ele_offset,primary_sub_dim,primary_global_offset
00135 ,secondary_first_ele_offset,secondary_sub_dim
00136 );
00137 }
00138
00139
00140 }
00141
00142
00143 #endif // THYRA_MULTI_VECTOR_BASE_HPP