Thyra_NonlinearSolverBase.hpp

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_NONLINEAR_SOLVER_BASE_HPP
00030 #define THYRA_NONLINEAR_SOLVER_BASE_HPP
00031 
00032 #include "Thyra_LinearOpWithSolveBaseDecl.hpp"
00033 #include "Thyra_ModelEvaluator.hpp"
00034 #include "Teuchos_Describable.hpp"
00035 #include "Teuchos_VerboseObject.hpp"
00036 #include "Teuchos_ParameterListAcceptor.hpp"
00037 
00038 namespace Thyra {
00039 
00058 template <class Scalar>
00059 class NonlinearSolverBase
00060   : virtual public Teuchos::Describable
00061   , virtual public Teuchos::VerboseObject<NonlinearSolverBase<Scalar> >
00062   , virtual public Teuchos::ParameterListAcceptor
00063 {
00064 public:
00065   
00068 
00076   virtual void setModel(
00077     const RCP<const ModelEvaluator<Scalar> > &model
00078     ) = 0;
00079   
00081   virtual RCP<const ModelEvaluator<Scalar> > getModel() const = 0;
00082   
00102   virtual SolveStatus<Scalar> solve(
00103     VectorBase<Scalar> *x,
00104     const SolveCriteria<Scalar> *solveCriteria = NULL,
00105     VectorBase<Scalar> *delta = NULL
00106     ) = 0;
00107   
00109   
00112 
00117   virtual bool supportsCloning() const;
00118 
00139   virtual RCP<NonlinearSolverBase<Scalar> > cloneNonlinearSolver() const;
00140   
00146   virtual RCP<const VectorBase<Scalar> > get_current_x() const;
00147 
00153   virtual bool is_W_current() const;
00154 
00170   virtual RCP<LinearOpWithSolveBase<Scalar> >
00171   get_nonconst_W( const bool forceUpToDate = false );
00172 
00180   virtual RCP<const LinearOpWithSolveBase<Scalar> > get_W() const;
00181 
00191   virtual void set_W_is_current(bool W_is_current);
00192 
00194 
00195 };
00196 
00197 // ///////////////////////////////
00198 // Implementations
00199 
00200 template <class Scalar>
00201 bool NonlinearSolverBase<Scalar>::supportsCloning() const
00202 {
00203   return false;
00204 }
00205 
00206 template <class Scalar>
00207 RCP<NonlinearSolverBase<Scalar> >
00208 NonlinearSolverBase<Scalar>::cloneNonlinearSolver() const
00209 {
00210   return Teuchos::null;
00211 }
00212 
00213 template <class Scalar>
00214 RCP<const VectorBase<Scalar> >
00215 NonlinearSolverBase<Scalar>::get_current_x() const
00216 {
00217   return Teuchos::null;
00218 }
00219 
00220 template <class Scalar>
00221 bool NonlinearSolverBase<Scalar>::is_W_current() const
00222 {
00223   return false;
00224 }
00225 
00226 template <class Scalar>
00227 RCP<LinearOpWithSolveBase<Scalar> >
00228 NonlinearSolverBase<Scalar>::get_nonconst_W(const bool forceUpToDate)
00229 {
00230   return Teuchos::null;
00231 }
00232 
00233 template <class Scalar>
00234 RCP<const LinearOpWithSolveBase<Scalar> >
00235 NonlinearSolverBase<Scalar>::get_W() const
00236 {
00237   return Teuchos::null;
00238 }
00239 
00240 template <class Scalar>
00241 void NonlinearSolverBase<Scalar>::set_W_is_current(bool W_is_current)
00242 {
00243   TEST_FOR_EXCEPTION(
00244     true, std::logic_error,
00245     "Error, the subclass object described as " << this->description() << " did not"
00246     " override this function!"
00247     );
00248 }
00249 
00250 } // namespace Thyra
00251 
00252 #endif // THYRA_NONLINEAR_SOLVER_BASE_HPP

Generated on Tue Oct 20 12:46:55 2009 for Thyra ANA Nonlinear Solver Interfaces by doxygen 1.4.7