Rythmos_StepperBase.hpp

00001 //@HEADER
00002 // ***********************************************************************
00003 //
00004 //                           Rythmos Package
00005 //                 Copyright (2006) 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 Todd S. Coffey (tscoffe@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 
00029 #ifndef Rythmos_STEPPER_BASE_H
00030 #define Rythmos_STEPPER_BASE_H
00031 
00032 
00033 #include "Rythmos_InterpolationBufferBase.hpp"
00034 #include "Rythmos_StepperSupportTypes.hpp"
00035 #include "Thyra_VectorBase.hpp"
00036 #include "Teuchos_Describable.hpp"
00037 #include "Teuchos_RCP.hpp"
00038 #include "Thyra_ModelEvaluator.hpp"
00039 
00040 
00041 namespace Rythmos {
00042 
00043 
00059 template<class Scalar> 
00060 class StepperBase : virtual public InterpolationBufferBase<Scalar>
00061 {
00062 public:
00063 
00071   virtual bool supportsCloning() const;
00072 
00093   virtual RCP<StepperBase<Scalar> > cloneStepperAlgorithm() const;
00094 
00100   virtual bool isImplicit() const;
00101 
00112   virtual bool acceptsModel() const;
00113     
00142   virtual void setModel(
00143     const RCP<const Thyra::ModelEvaluator<Scalar> > &model
00144     ) = 0;
00145     
00153   virtual RCP<const Thyra::ModelEvaluator<Scalar> >
00154   getModel() const = 0;
00155 
00168   virtual void setInitialCondition(
00169     const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
00170     );
00171   
00194   virtual Scalar takeStep(Scalar dt, StepSizeType stepType) = 0;
00195 
00201   virtual const StepStatus<Scalar> getStepStatus() const = 0;
00202 
00210   virtual void setStepControlData(const StepperBase & stepper);
00211 
00221 };
00222 
00223 
00224 // ///////////////////////////////
00225 // Implementations
00226 
00227 
00228 template<class Scalar>
00229 bool StepperBase<Scalar>::isImplicit() const
00230 {
00231   return false;
00232 }
00233 
00234 
00235 template<class Scalar>
00236 bool StepperBase<Scalar>::acceptsModel() const
00237 {
00238   return true;
00239 }
00240 
00241 
00242 template<class Scalar>
00243 bool StepperBase<Scalar>::supportsCloning() const
00244 {
00245   return false;
00246 }
00247 
00248 
00249 template<class Scalar>
00250 RCP<StepperBase<Scalar> >
00251 StepperBase<Scalar>::cloneStepperAlgorithm() const
00252 {
00253   return Teuchos::null;
00254 }
00255 
00256 
00257 template<class Scalar>
00258 void StepperBase<Scalar>::setInitialCondition(
00259   const Thyra::ModelEvaluatorBase::InArgs<Scalar> &initialCondition
00260   )
00261 {
00262   TEST_FOR_EXCEPTION(
00263     true, std::logic_error,
00264     "Error, the function setIntialCondition(...) is not implemented\n"
00265     "in the class \"" << Teuchos::typeName(*this) << "\"!" );
00266   // ToDo: Remove this default implementation and make every concrete
00267   // subclass implement this!
00268 }
00269 
00270 template<class Scalar>
00271 void StepperBase<Scalar>::setStepControlData(const StepperBase & stepper)
00272 {
00273 }
00274 
00275 } // namespace Rythmos
00276 
00277 #endif //Rythmos_STEPPER_BASE_H

Generated on Tue Oct 20 12:46:08 2009 for Rythmos - Transient Integration for Differential Equations by doxygen 1.4.7