|
Stratimikos Package Browser (Single Doxygen Collection)
Version of the Day
|
00001 /* 00002 // @HEADER 00003 // *********************************************************************** 00004 // 00005 // Stratimikos: Thyra-based strategies for linear solvers 00006 // Copyright (2006) 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 // Redistribution and use in source and binary forms, with or without 00012 // modification, are permitted provided that the following conditions are 00013 // met: 00014 // 00015 // 1. Redistributions of source code must retain the above copyright 00016 // notice, this list of conditions and the following disclaimer. 00017 // 00018 // 2. Redistributions in binary form must reproduce the above copyright 00019 // notice, this list of conditions and the following disclaimer in the 00020 // documentation and/or other materials provided with the distribution. 00021 // 00022 // 3. Neither the name of the Corporation nor the names of the 00023 // contributors may be used to endorse or promote products derived from 00024 // this software without specific prior written permission. 00025 // 00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 // 00038 // Questions? Contact Roscoe A. Bartlett (rabartl@sandia.gov) 00039 // 00040 // *********************************************************************** 00041 // @HEADER 00042 */ 00043 00044 #ifndef THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP 00045 #define THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP 00046 00047 #include "Thyra_LinearOpWithSolveBase.hpp" 00048 #include "Thyra_LinearOpSourceBase.hpp" 00049 #include "Thyra_EpetraLinearOpBase.hpp" 00050 #include "Epetra_LinearProblem.h" 00051 #include "Amesos_BaseSolver.h" 00052 00053 00054 namespace Thyra { 00055 00056 00070 class AmesosLinearOpWithSolve : virtual public LinearOpWithSolveBase<double> 00071 { 00072 public: 00073 00076 00078 AmesosLinearOpWithSolve(); 00079 00081 AmesosLinearOpWithSolve( 00082 const Teuchos::RCP<const LinearOpBase<double> > &fwdOp, 00083 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc, 00084 const Teuchos::RCP<Epetra_LinearProblem> &epetraLP, 00085 const Teuchos::RCP<Amesos_BaseSolver> &amesosSolver, 00086 const EOpTransp amesosSolverTransp, 00087 const double amesosSolverScalar 00088 ); 00089 00130 void initialize( 00131 const Teuchos::RCP<const LinearOpBase<double> > &fwdOp, 00132 const Teuchos::RCP<const LinearOpSourceBase<double> > &fwdOpSrc, 00133 const Teuchos::RCP<Epetra_LinearProblem> &epetraLP, 00134 const Teuchos::RCP<Amesos_BaseSolver> &amesosSolver, 00135 const EOpTransp amesosSolverTransp, 00136 const double amesosSolverScalar 00137 ); 00138 00146 Teuchos::RCP<const LinearOpSourceBase<double> > extract_fwdOpSrc(); 00147 00149 Teuchos::RCP<const LinearOpBase<double> > get_fwdOp() const; 00150 00152 Teuchos::RCP<const LinearOpSourceBase<double> > get_fwdOpSrc() const; 00153 00155 Teuchos::RCP<Epetra_LinearProblem> get_epetraLP() const; 00156 00158 Teuchos::RCP<Amesos_BaseSolver> get_amesosSolver() const; 00159 00161 EOpTransp get_amesosSolverTransp() const; 00162 00164 double get_amesosSolverScalar() const; 00165 00168 void uninitialize( 00169 Teuchos::RCP<const LinearOpBase<double> > *fwdOp = NULL, 00170 Teuchos::RCP<const LinearOpSourceBase<double> > *fwdOpSrc = NULL, 00171 Teuchos::RCP<Epetra_LinearProblem> *epetraLP = NULL, 00172 Teuchos::RCP<Amesos_BaseSolver> *amesosSolver = NULL, 00173 EOpTransp *amesosSolverTransp = NULL, 00174 double *amesosSolverScalar = NULL 00175 ); 00176 00178 00182 Teuchos::RCP< const VectorSpaceBase<double> > range() const; 00184 Teuchos::RCP< const VectorSpaceBase<double> > domain() const; 00186 Teuchos::RCP<const LinearOpBase<double> > clone() const; 00188 00192 std::string description() const; 00194 void describe( 00195 Teuchos::FancyOStream &out, 00196 const Teuchos::EVerbosityLevel verbLevel 00197 ) const; 00199 00200 protected: 00201 00205 virtual bool opSupportedImpl(EOpTransp M_trans) const; 00207 virtual void applyImpl( 00208 const EOpTransp M_trans, 00209 const MultiVectorBase<double> &X, 00210 const Ptr<MultiVectorBase<double> > &Y, 00211 const double alpha, 00212 const double beta 00213 ) const; 00215 00219 virtual bool solveSupportsImpl(EOpTransp M_trans) const; 00221 virtual bool solveSupportsSolveMeasureTypeImpl( 00222 EOpTransp M_trans, const SolveMeasureType& solveMeasureType 00223 ) const; 00225 SolveStatus<double> solveImpl( 00226 const EOpTransp M_trans, 00227 const MultiVectorBase<double> &B, 00228 const Ptr<MultiVectorBase<double> > &X, 00229 const Ptr<const SolveCriteria<double> > solveCriteria 00230 ) const; 00232 00233 private: 00234 00235 Teuchos::RCP<const LinearOpBase<double> > fwdOp_; 00236 Teuchos::RCP<const LinearOpSourceBase<double> > fwdOpSrc_; 00237 Teuchos::RCP<Epetra_LinearProblem> epetraLP_; 00238 Teuchos::RCP<Amesos_BaseSolver> amesosSolver_; 00239 EOpTransp amesosSolverTransp_; 00240 double amesosSolverScalar_; 00241 00242 void assertInitialized() const; 00243 00244 }; 00245 00246 // /////////////////////////// 00247 // Inline members 00248 00249 inline 00250 Teuchos::RCP<const LinearOpBase<double> > 00251 AmesosLinearOpWithSolve::get_fwdOp() const 00252 { 00253 return fwdOp_; 00254 } 00255 00256 inline 00257 Teuchos::RCP<const LinearOpSourceBase<double> > 00258 AmesosLinearOpWithSolve::get_fwdOpSrc() const 00259 { 00260 return fwdOpSrc_; 00261 } 00262 00263 inline 00264 Teuchos::RCP<Epetra_LinearProblem> 00265 AmesosLinearOpWithSolve::get_epetraLP() const 00266 { 00267 return epetraLP_; 00268 } 00269 00270 inline 00271 Teuchos::RCP<Amesos_BaseSolver> 00272 AmesosLinearOpWithSolve::get_amesosSolver() const 00273 { 00274 return amesosSolver_; 00275 } 00276 00277 inline 00278 EOpTransp AmesosLinearOpWithSolve::get_amesosSolverTransp() const 00279 { 00280 return amesosSolverTransp_; 00281 } 00282 00283 inline 00284 double AmesosLinearOpWithSolve::get_amesosSolverScalar() const 00285 { 00286 return amesosSolverScalar_; 00287 } 00288 00289 } // namespace Thyra 00290 00291 #endif // THYRA_AMESOS_LINEAR_OP_WITH_SOLVE_HPP
1.7.6.1