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_LINEAR_OP_WITH_SOLVE_DECL_HPP
00030 #define THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP
00031
00032
00033 #include "Thyra_DefaultDiagonalLinearOpDecl.hpp"
00034 #include "Thyra_LinearOpWithSolveBaseDecl.hpp"
00035 #include "Thyra_SingleRhsLinearOpWithSolveBaseDecl.hpp"
00036 #include "Thyra_DefaultMultiVectorProductVectorSpaceDecl.hpp"
00037 #include "Teuchos_ConstNonconstObjectContainer.hpp"
00038
00039
00040 namespace Thyra {
00041
00042
00048 template<class Scalar>
00049 class DefaultMultiVectorLinearOpWithSolve
00050 : virtual public LinearOpWithSolveBase<Scalar>,
00051 virtual protected SingleRhsLinearOpWithSolveBase<Scalar>
00052
00053
00054
00055
00056 {
00057 public:
00058
00061
00063 DefaultMultiVectorLinearOpWithSolve();
00064
00066 void initialize(
00067 const Teuchos::RCP<LinearOpWithSolveBase<Scalar> > &lows,
00068 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
00069 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
00070 );
00071
00073 void initialize(
00074 const Teuchos::RCP<const LinearOpWithSolveBase<Scalar> > &lows,
00075 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
00076 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
00077 );
00078
00080 Teuchos::RCP<LinearOpWithSolveBase<Scalar> >
00081 getNonconstLinearOpWithSolve();
00082
00084 Teuchos::RCP<const LinearOpWithSolveBase<Scalar> >
00085 getLinearOpWithSolve() const;
00086
00087
00088
00089
00091 void uninitialize();
00092
00094
00097
00099 Teuchos::RCP< const VectorSpaceBase<Scalar> > range() const;
00100
00102 Teuchos::RCP< const VectorSpaceBase<Scalar> > domain() const;
00103
00105 Teuchos::RCP<const LinearOpBase<Scalar> > clone() const;
00106
00108
00109 protected:
00110
00113
00115 bool opSupported(ETransp M_trans) const;
00116
00118
00121
00123 void apply(
00124 const ETransp M_trans,
00125 const VectorBase<Scalar> &x,
00126 VectorBase<Scalar> *y,
00127 const Scalar alpha,
00128 const Scalar beta
00129 ) const;
00130
00132
00135
00137 bool solveSupportsTrans(ETransp M_trans) const;
00138
00140 bool solveSupportsSolveMeasureType(
00141 ETransp M_trans, const SolveMeasureType& solveMeasureType
00142 ) const;
00143
00145
00148
00150 SolveStatus<Scalar> solve(
00151 const ETransp M_trans,
00152 const VectorBase<Scalar> &b,
00153 VectorBase<Scalar> *x,
00154 const SolveCriteria<Scalar> *solveCriteria
00155 ) const;
00156
00158
00159 private:
00160
00161
00162
00163
00164 typedef Teuchos::ConstNonconstObjectContainer<LinearOpWithSolveBase<Scalar> > CNLOWS;
00165
00166
00167
00168
00169 CNLOWS lows_;
00170 Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > multiVecRange_;
00171 Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > multiVecDomain_;
00172
00173
00174
00175
00176 static void validateInitialize(
00177 const Teuchos::RCP<const LinearOpWithSolveBase<Scalar> > &lows,
00178 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
00179 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
00180 );
00181
00182
00183 };
00184
00185
00190 template<class Scalar>
00191 Teuchos::RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> >
00192 multiVectorLinearOpWithSolve()
00193 {
00194 return Teuchos::rcp(new DefaultMultiVectorLinearOpWithSolve<Scalar>());
00195 }
00196
00197
00202 template<class Scalar>
00203 Teuchos::RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> >
00204 multiVectorLinearOpWithSolve(
00205 const Teuchos::RCP<LinearOpWithSolveBase<Scalar> > &lows,
00206 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
00207 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
00208 )
00209 {
00210 Teuchos::RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> >
00211 mvlows = Teuchos::rcp(new DefaultMultiVectorLinearOpWithSolve<Scalar>());
00212 mvlows->initialize(lows,multiVecRange,multiVecDomain);
00213 return mvlows;
00214 }
00215
00216
00221 template<class Scalar>
00222 Teuchos::RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> >
00223 multiVectorLinearOpWithSolve(
00224 const Teuchos::RCP<const LinearOpWithSolveBase<Scalar> > &lows,
00225 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecRange,
00226 const Teuchos::RCP<const DefaultMultiVectorProductVectorSpace<Scalar> > &multiVecDomain
00227 )
00228 {
00229 Teuchos::RCP<DefaultMultiVectorLinearOpWithSolve<Scalar> >
00230 mvlows = Teuchos::rcp(new DefaultMultiVectorLinearOpWithSolve<Scalar>());
00231 mvlows->initialize(lows,multiVecRange,multiVecDomain);
00232 return mvlows;
00233 }
00234
00235
00236 }
00237
00238
00239 #endif // THYRA_MULTI_VECTOR_LINEAR_OP_WITH_SOLVE_DECL_HPP