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_SERIAL_MULTI_VECTOR_BASE_DECL_HPP
00030 #define THYRA_SERIAL_MULTI_VECTOR_BASE_DECL_HPP
00031
00032 #include "Thyra_MultiVectorDefaultBaseDecl.hpp"
00033 #include "Thyra_SingleScalarEuclideanLinearOpBaseDecl.hpp"
00034 #include "Teuchos_BLAS.hpp"
00035
00036 namespace Thyra {
00037
00065 template<class Scalar>
00066 class SerialMultiVectorBase
00067 : virtual public MultiVectorDefaultBase<Scalar>
00068 , virtual protected SingleScalarEuclideanLinearOpBase<Scalar>
00069 {
00070 public:
00071
00073 using SingleScalarEuclideanLinearOpBase<Scalar>::euclideanApply;
00075 using MultiVectorDefaultBase<Scalar>::applyOp;
00076
00079
00081 SerialMultiVectorBase();
00082
00084
00087
00097 virtual void getData( const Scalar **values, Index *leadingDim ) const = 0;
00098
00104 virtual void freeData( const Scalar *values ) const = 0;
00105
00117 virtual void getData( Scalar **values, Index *leadingDim ) = 0;
00118
00124 virtual void commitData( Scalar *values ) = 0;
00125
00127
00130
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00144
00148 void applyOp(
00149 const RTOpPack::RTOpT<Scalar> &primary_op
00150 ,const int num_multi_vecs
00151 ,const MultiVectorBase<Scalar>* multi_vecs[]
00152 ,const int num_targ_multi_vecs
00153 ,MultiVectorBase<Scalar>* targ_multi_vecs[]
00154 ,RTOpPack::ReductTarget* reduct_objs[]
00155 ,const Index primary_first_ele
00156 ,const Index primary_sub_dim
00157 ,const Index primary_global_offset
00158 ,const Index secondary_first_ele
00159 ,const Index secondary_sub_dim
00160 ) const;
00162 void getSubMultiVector(
00163 const Range1D &rowRng
00164 ,const Range1D &colRng
00165 ,RTOpPack::SubMultiVectorT<Scalar> *sub_mv
00166 ) const;
00168 void freeSubMultiVector( RTOpPack::SubMultiVectorT<Scalar>* sub_mv ) const;
00170 void getSubMultiVector(
00171 const Range1D &rowRng
00172 ,const Range1D &colRng
00173 ,RTOpPack::MutableSubMultiVectorT<Scalar> *sub_mv
00174 );
00176 void commitSubMultiVector( RTOpPack::MutableSubMultiVectorT<Scalar>* sub_mv );
00178
00179 protected:
00180
00183
00188 bool opSupported(ETransp M_trans) const;
00189
00194 void euclideanApply(
00195 const ETransp M_trans
00196 ,const MultiVectorBase<Scalar> &X
00197 ,MultiVectorBase<Scalar> *Y
00198 ,const Scalar alpha
00199 ,const Scalar beta
00200 ) const;
00201
00203
00206
00214 virtual void updateSpace();
00215
00220 Range1D validateRowRange( const Range1D& rowRng ) const;
00221
00226 Range1D validateColRange( const Range1D& rowCol ) const;
00227
00229
00230 private:
00231
00232
00233
00234
00235 mutable bool in_applyOp_;
00236
00237 mutable Teuchos::BLAS<int,Scalar> blas_;
00238
00239
00240 Index numRows_;
00241 Index numCols_;
00242
00243 };
00244
00245 }
00246
00247 #endif // THYRA_SERIAL_MULTI_VECTOR_BASE_DECL_HPP