Thyra_NonlinearSolverBase.hpp

Go to the documentation of this file.
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 "Teuchos_Describable.hpp"
00033 #include "Thyra_LinearOpWithSolveBaseDecl.hpp"
00034 #include "Thyra_ModelEvaluator.hpp"
00035 
00036 namespace Thyra {
00037 
00056 template <class Scalar>
00057 class NonlinearSolverBase
00058   : virtual public Teuchos::Describable
00059   , virtual public Teuchos::VerboseObject<NonlinearSolverBase<Scalar> >
00060 {
00061 public:
00062   
00065 
00073   virtual void setModel(
00074     const Teuchos::RefCountPtr<const ModelEvaluator<Scalar> > &model
00075     ) = 0;
00076   
00078   virtual Teuchos::RefCountPtr<const ModelEvaluator<Scalar> > getModel() const = 0;
00079   
00098   virtual SolveStatus<Scalar> solve(
00099     VectorBase<Scalar>             *x
00100     ,const SolveCriteria<Scalar>   *solveCriteria = NULL
00101     ,VectorBase<Scalar>            *delta = NULL
00102     ) = 0;
00103   
00105   
00108   
00114   virtual Teuchos::RefCountPtr<const VectorBase<Scalar> > get_current_x() const;
00115 
00121   virtual bool is_W_current() const;
00122 
00127   virtual Teuchos::RefCountPtr<LinearOpWithSolveBase<Scalar> > get_nonconst_W();
00128 
00133   virtual Teuchos::RefCountPtr<const LinearOpWithSolveBase<Scalar> > get_W() const;
00134 
00144   virtual void set_W_is_current(bool W_is_current);
00145 
00147 
00148 };
00149 
00150 // ///////////////////////////////
00151 // Implementations
00152 
00153 template <class Scalar>
00154 Teuchos::RefCountPtr<const VectorBase<Scalar> >
00155 NonlinearSolverBase<Scalar>::get_current_x() const
00156 {
00157   return Teuchos::null;
00158 }
00159 
00160 template <class Scalar>
00161 bool NonlinearSolverBase<Scalar>::is_W_current() const
00162 {
00163   return false;
00164 }
00165 
00166 template <class Scalar>
00167 Teuchos::RefCountPtr<LinearOpWithSolveBase<Scalar> >
00168 NonlinearSolverBase<Scalar>::get_nonconst_W()
00169 {
00170   return Teuchos::null;
00171 }
00172 
00173 template <class Scalar>
00174 Teuchos::RefCountPtr<const LinearOpWithSolveBase<Scalar> >
00175 NonlinearSolverBase<Scalar>::get_W() const
00176 {
00177   return Teuchos::null;
00178 }
00179 
00180 template <class Scalar>
00181 void NonlinearSolverBase<Scalar>::set_W_is_current(bool W_is_current)
00182 {
00183   TEST_FOR_EXCEPTION(
00184     true,std::logic_error
00185     ,"Error, the subclass object described as " << this->description() << " did not"
00186     " override this function!"
00187     );
00188 }
00189 
00190 } // namespace Thyra
00191 
00192 #endif // THYRA_NONLINEAR_SOLVER_BASE_HPP

Generated on Thu Sep 18 12:33:03 2008 for Thyra Package Browser (Single Doxygen Collection) by doxygen 1.3.9.1