Thyra_AmesosLinearOpWithSolve.hpp
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
00031 #ifndef THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP
00032 #define THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP
00033
00034 #include "Thyra_SingleScalarLinearOpWithSolveBase.hpp"
00035 #include "Thyra_LinearOpSourceBase.hpp"
00036 #include "Thyra_EpetraLinearOpBase.hpp"
00037 #include "Epetra_LinearProblem.h"
00038 #include "Amesos_BaseSolver.h"
00039
00040 namespace Thyra {
00041
00055 class AmesosLinearOpWithSolve
00056 : virtual public LinearOpWithSolveBase<double>
00057 , virtual protected SingleScalarLinearOpWithSolveBase<double>
00058 {
00059 public:
00060
00063
00065 AmesosLinearOpWithSolve();
00066
00068 AmesosLinearOpWithSolve(
00069 const Teuchos::RCP<const LinearOpBase<double> > &fwdOp,
00070 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
00071 const Teuchos::RCP<Epetra_LinearProblem> &epetraLP,
00072 const Teuchos::RCP<Amesos_BaseSolver> &amesosSolver,
00073 const ETransp amesosSolverTransp,
00074 const double amesosSolverScalar
00075 );
00076
00117 void initialize(
00118 const Teuchos::RCP<const LinearOpBase<double> > &fwdOp,
00119 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc,
00120 const Teuchos::RCP<Epetra_LinearProblem> &epetraLP,
00121 const Teuchos::RCP<Amesos_BaseSolver> &amesosSolver,
00122 const ETransp amesosSolverTransp,
00123 const double amesosSolverScalar
00124 );
00125
00133 Teuchos::RCP<const LinearOpSourceBase<double> > extract_fwdOpSrc();
00134
00136 Teuchos::RCP<const LinearOpBase<double> > get_fwdOp() const;
00137
00139 Teuchos::RCP<const LinearOpSourceBase<double> > get_fwdOpSrc() const;
00140
00142 Teuchos::RCP<Epetra_LinearProblem> get_epetraLP() const;
00143
00145 Teuchos::RCP<Amesos_BaseSolver> get_amesosSolver() const;
00146
00148 ETransp get_amesosSolverTransp() const;
00149
00151 double get_amesosSolverScalar() const;
00152
00155 void uninitialize(
00156 Teuchos::RCP<const LinearOpBase<double> > *fwdOp = NULL,
00157 Teuchos::RCP<const LinearOpSourceBase<double> > *fwdOpSrc = NULL,
00158 Teuchos::RCP<Epetra_LinearProblem> *epetraLP = NULL,
00159 Teuchos::RCP<Amesos_BaseSolver> *amesosSolver = NULL,
00160 ETransp *amesosSolverTransp = NULL,
00161 double *amesosSolverScalar = NULL
00162 );
00163
00165
00169 Teuchos::RCP< const VectorSpaceBase<double> > range() const;
00171 Teuchos::RCP< const VectorSpaceBase<double> > domain() const;
00173 Teuchos::RCP<const LinearOpBase<double> > clone() const;
00175
00179 std::string description() const;
00181 void describe(
00182 Teuchos::FancyOStream &out,
00183 const Teuchos::EVerbosityLevel verbLevel
00184 ) const;
00186
00187 protected:
00188
00192 bool opSupported(ETransp M_trans) const;
00194 void apply(
00195 const ETransp M_trans,
00196 const MultiVectorBase<double> &X,
00197 MultiVectorBase<double> *Y,
00198 const double alpha,
00199 const double beta
00200 ) const;
00202
00206 bool solveSupportsTrans(ETransp M_trans) const;
00208 bool solveSupportsSolveMeasureType(
00209 ETransp M_trans, const SolveMeasureType& solveMeasureType
00210 ) const;
00212 void solve(
00213 const ETransp M_trans,
00214 const MultiVectorBase<double> &B,
00215 MultiVectorBase<double> *X,
00216 const int numBlocks,
00217 const BlockSolveCriteria<double> blockSolveCriteria[],
00218 SolveStatus<double> blockSolveStatus[]
00219 ) const;
00221
00222 private:
00223
00224 Teuchos::RCP<const LinearOpBase<double> > fwdOp_;
00225 Teuchos::RCP<const LinearOpSourceBase<double> > fwdOpSrc_;
00226 Teuchos::RCP<Epetra_LinearProblem> epetraLP_;
00227 Teuchos::RCP<Amesos_BaseSolver> amesosSolver_;
00228 ETransp amesosSolverTransp_;
00229 double amesosSolverScalar_;
00230
00231 void assertInitialized() const;
00232
00233 };
00234
00235
00236
00237
00238 inline
00239 Teuchos::RCP<const LinearOpBase<double> >
00240 AmesosLinearOpWithSolve::get_fwdOp() const
00241 {
00242 return fwdOp_;
00243 }
00244
00245 inline
00246 Teuchos::RCP<const LinearOpSourceBase<double> >
00247 AmesosLinearOpWithSolve::get_fwdOpSrc() const
00248 {
00249 return fwdOpSrc_;
00250 }
00251
00252 inline
00253 Teuchos::RCP<Epetra_LinearProblem>
00254 AmesosLinearOpWithSolve::get_epetraLP() const
00255 {
00256 return epetraLP_;
00257 }
00258
00259 inline
00260 Teuchos::RCP<Amesos_BaseSolver>
00261 AmesosLinearOpWithSolve::get_amesosSolver() const
00262 {
00263 return amesosSolver_;
00264 }
00265
00266 inline
00267 ETransp AmesosLinearOpWithSolve::get_amesosSolverTransp() const
00268 {
00269 return amesosSolverTransp_;
00270 }
00271
00272 inline
00273 double AmesosLinearOpWithSolve::get_amesosSolverScalar() const
00274 {
00275 return amesosSolverScalar_;
00276 }
00277
00278 }
00279
00280 #endif // THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP