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
00030 #ifndef THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP
00031 #define THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP
00032
00033
00034 #include "Thyra_SingleScalarLinearOpWithSolveBase.hpp"
00035
00036
00037 namespace Thyra {
00038
00039
00051 template <class Scalar>
00052 class DelayedLinearOpWithSolve
00053 : virtual public LinearOpWithSolveBase<Scalar>
00054 , virtual protected SingleScalarLinearOpWithSolveBase<Scalar>
00055 {
00056 public:
00057
00060
00062 DelayedLinearOpWithSolve();
00063
00065 void initialize(
00066 const RCP<const LinearOpSourceBase<Scalar> > &fwdOpSrc,
00067 const RCP<const PreconditionerBase<Scalar> > &prec,
00068 const RCP<const LinearOpSourceBase<Scalar> > &approxFwdOpSrc,
00069 const ESupportSolveUse supportSolveUse,
00070 const RCP<LinearOpWithSolveFactoryBase<Scalar> > &lowsf
00071 );
00072
00074 RCP<const LinearOpSourceBase<Scalar> > getFwdOpSrc() const;
00075
00077 RCP<const PreconditionerBase<Scalar> > getPrec() const;
00078
00080 RCP<const LinearOpSourceBase<Scalar> > getApproxFwdOpSrc() const;
00081
00083 ESupportSolveUse getSupportSolveUse() const;
00084
00086
00089
00091 std::string description() const;
00092
00094
00097
00099 RCP< const VectorSpaceBase<Scalar> > range() const;
00101 RCP< const VectorSpaceBase<Scalar> > domain() const;
00103 RCP<const LinearOpBase<Scalar> > clone() const;
00104
00106
00107 protected:
00108
00111
00113 void informUpdatedVerbosityState() const;
00114
00116
00119
00121 virtual bool opSupported(ETransp M_trans) const;
00123 virtual void apply(
00124 const ETransp M_trans,
00125 const MultiVectorBase<Scalar> &X,
00126 MultiVectorBase<Scalar> *Y,
00127 const Scalar alpha,
00128 const Scalar beta
00129 ) const;
00130
00132
00135
00137 virtual bool solveSupportsTrans(ETransp M_trans) const;
00139 virtual bool solveSupportsSolveMeasureType(
00140 ETransp M_trans, const SolveMeasureType& solveMeasureType
00141 ) const;
00143 virtual void solve(
00144 const ETransp M_trans,
00145 const MultiVectorBase<Scalar> &B,
00146 MultiVectorBase<Scalar> *X,
00147 const int numBlocks,
00148 const BlockSolveCriteria<Scalar> blockSolveCriteria[],
00149 SolveStatus<Scalar> blockSolveStatus[]
00150 ) const;
00151
00153
00154 private:
00155
00156
00157
00158
00159 RCP<const LinearOpSourceBase<Scalar> > fwdOpSrc_;
00160 RCP<const PreconditionerBase<Scalar> > prec_;
00161 RCP<const LinearOpSourceBase<Scalar> > approxFwdOpSrc_;
00162 ESupportSolveUse supportSolveUse_;
00163 RCP<LinearOpWithSolveFactoryBase<Scalar> > lowsf_;
00164
00165 RCP<const LinearOpBase<Scalar> > fwdOp_;
00166
00167 mutable bool lows_is_valid_;
00168 mutable RCP<LinearOpWithSolveBase<Scalar> > lows_;
00169
00170
00171
00172
00173 void updateSolver() const;
00174
00175 };
00176
00177
00178 }
00179
00180
00181 #endif // THYRA_DELAYED_LINEAR_OP_WITH_SOLVE_DECL_HPP