00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Thyra: Interfaces and Support for Abstract Numerical Algorithms 00005 // Copyright (2004) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 00028 00029 #ifndef THYRA_LINEAR_SOLVER_BUILDING_BASE 00030 #define THYRA_LINEAR_SOLVER_BUILDING_BASE 00031 00032 #include "Teuchos_ParameterListAcceptor.hpp" 00033 #include "Thyra_LinearOpWithSolveFactoryBase.hpp" 00034 00035 namespace Thyra { 00036 00044 template<class Scalar> 00045 class LinearSolverBuilderBase : virtual public Teuchos::ParameterListAcceptor 00046 { 00047 public: 00048 00061 virtual Teuchos::RCP<LinearOpWithSolveFactoryBase<Scalar> > 00062 createLinearSolveStrategy( 00063 const std::string &linearSolveStrategyName ) const = 0; 00064 00077 virtual Teuchos::RCP<PreconditionerFactoryBase<Scalar> > 00078 createPreconditioningStrategy( 00079 const std::string &preconditioningStrategyName ) const = 0; 00080 00081 /* \brief Create a new LinearOpWithSolveFactory object given a typical 00082 * forward linear operator and a typical solve criteria. 00083 * 00084 * \param typicalFwdOp 00085 * [in] A typical forward linear operator that represents the types of 00086 * operator that will be used to solve linear system. 00087 * \param typicalSolveCriteria 00088 * [in] A typical solve criteria that will be used to solve for linear 00089 * systems. 00090 * \param typicalSolveUse 00091 * [in] Determines how the solver will be used. 00092 * \param solveStrategy 00093 * [out] The LOWSF object that was determined to be the best suited for solving 00094 * the typical system given above. 00095 * \param initialLOWS 00096 * [out] The LOWS object that was created that is consistent with the returned 00097 * solve strategy. If <tt>initialLOWS->get()==NULL</tt> on return then there is no 00098 * such object returned. 00099 * \param setupTime 00100 * [out] The amount of time it took to setup the solver <tt>*initalLOWS</tt> before 00101 * a solve was performed. 00102 * \param solveTime 00103 * [out] The amount of time it took to solve a typical linear system for the 00104 * returned <tt>*initalLOWS</tt> object. 00105 * 00106 * ToDo: Finish documentation! 00107 */ 00108 /* 00109 virtual void createSmartSolveStrategy( 00110 const Teuchos::RCP<LinearOpBase<Scalar> &typicalFwdOp 00111 ,const SolveCritiera<Scalar> &typicalSolveCriteria 00112 ,const ESupportSolveUse &typicalSolveUse 00113 ,Teuchos::RCP<LinearOpWithSolveFactoryBase<Scalar> > *solveStrategy 00114 ,Teuchos::RCP<Teuchos::ParameterList> *solveStrategyParameters 00115 ,Teuchos::RCP<LinearOpWithSolveBase<Scalar> > *initialLOWS 00116 ,double *setupTime 00117 ,double *solveTime 00118 ) const = 0; 00119 */ 00120 00121 }; 00122 00123 00128 template<class Scalar> 00129 Teuchos::RCP<LinearOpWithSolveFactoryBase<Scalar> > 00130 createLinearSolveStrategy( 00131 const LinearSolverBuilderBase<Scalar> &linearSolverBuilder, 00132 const std::string &linearSolveStrategyName = "" 00133 ) 00134 { 00135 return linearSolverBuilder.createLinearSolveStrategy( 00136 linearSolveStrategyName ); 00137 } 00138 00139 00144 template<class Scalar> 00145 Teuchos::RCP<PreconditionerFactoryBase<Scalar> > 00146 createPreconditioningStrategy( 00147 const LinearSolverBuilderBase<Scalar> &linearSolverBuilder, 00148 const std::string &preconditioningStrategyName = "" 00149 ) 00150 { 00151 return linearSolverBuilder.createPreconditioningStrategy( 00152 preconditioningStrategyName ); 00153 } 00154 00155 00156 } // namespace Thyra 00157 00158 #endif // THYRA_LINEAR_SOLVER_BUILDING_BASE
1.4.7