Stratimikos Package Browser (Single Doxygen Collection) Version of the Day
Thyra_AmesosLinearOpWithSolve.hpp
Go to the documentation of this file.
00001 /*
00002 // @HEADER
00003 // ***********************************************************************
00004 // 
00005 //                Amesos: Direct Sparse Solver Package
00006 //                 Copyright (2004) Sandia Corporation
00007 // 
00008 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
00009 // license for use of this work by or on behalf of the U.S. Government.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //  
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA
00025 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 
00026 // 
00027 // ***********************************************************************
00028 // @HEADER
00029 */
00030 
00031 #ifndef THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP
00032 #define THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP
00033 
00034 #include "Thyra_LinearOpWithSolveBase.hpp"
00035 #include "Thyra_LinearOpSourceBase.hpp"
00036 #include "Thyra_EpetraLinearOpBase.hpp"
00037 #include "Epetra_LinearProblem.h"
00038 #include "Amesos_BaseSolver.h"
00039 
00040 
00041 namespace Thyra {
00042 
00043 
00057 class AmesosLinearOpWithSolve : virtual public LinearOpWithSolveBase<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 EOpTransp 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 EOpTransp 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   EOpTransp 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     EOpTransp *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   virtual bool opSupportedImpl(EOpTransp M_trans) const;
00194   virtual void applyImpl(
00195     const EOpTransp M_trans,
00196     const MultiVectorBase<double> &X,
00197     const Ptr<MultiVectorBase<double> > &Y,
00198     const double alpha,
00199     const double beta
00200     ) const;
00202 
00206   virtual bool solveSupportsImpl(EOpTransp M_trans) const;
00208   virtual bool solveSupportsSolveMeasureTypeImpl(
00209     EOpTransp M_trans, const SolveMeasureType& solveMeasureType
00210     ) const;
00212   SolveStatus<double> solveImpl(
00213     const EOpTransp M_trans,
00214     const MultiVectorBase<double> &B,
00215     const Ptr<MultiVectorBase<double> > &X,
00216     const Ptr<const SolveCriteria<double> > solveCriteria
00217     ) const;
00219 
00220 private:
00221 
00222   Teuchos::RCP<const LinearOpBase<double> > fwdOp_;
00223   Teuchos::RCP<const LinearOpSourceBase<double> > fwdOpSrc_;
00224   Teuchos::RCP<Epetra_LinearProblem> epetraLP_;
00225   Teuchos::RCP<Amesos_BaseSolver> amesosSolver_;
00226   EOpTransp amesosSolverTransp_;
00227   double amesosSolverScalar_;
00228 
00229   void assertInitialized() const;
00230 
00231 };
00232 
00233 // ///////////////////////////
00234 // Inline members
00235 
00236 inline
00237 Teuchos::RCP<const LinearOpBase<double> >
00238 AmesosLinearOpWithSolve::get_fwdOp() const
00239 {
00240   return fwdOp_;
00241 }
00242 
00243 inline
00244 Teuchos::RCP<const LinearOpSourceBase<double> >
00245 AmesosLinearOpWithSolve::get_fwdOpSrc() const
00246 {
00247   return fwdOpSrc_;
00248 }
00249 
00250 inline
00251 Teuchos::RCP<Epetra_LinearProblem>
00252 AmesosLinearOpWithSolve::get_epetraLP() const
00253 {
00254   return epetraLP_;
00255 }
00256 
00257 inline
00258 Teuchos::RCP<Amesos_BaseSolver>
00259 AmesosLinearOpWithSolve::get_amesosSolver() const
00260 {
00261   return amesosSolver_;
00262 }
00263 
00264 inline
00265 EOpTransp AmesosLinearOpWithSolve::get_amesosSolverTransp() const
00266 {
00267   return amesosSolverTransp_;
00268 }
00269 
00270 inline
00271 double AmesosLinearOpWithSolve::get_amesosSolverScalar() const
00272 {
00273   return amesosSolverScalar_;
00274 }
00275 
00276 } // namespace Thyra
00277 
00278 #endif  // THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines