Rythmos_StepControlStrategyBase.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 
00030 #ifndef RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP
00031 #define RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP
00032 
00033 
00034 #include "Rythmos_StepperBase.hpp"
00035 
00036 namespace Rythmos {
00037 
00038 
00046 enum AttemptedStepStatusFlag { PREDICT_AGAIN, CONTINUE_ANYWAY, REP_ERR_FAIL, REP_CONV_FAIL };
00047 
00049 enum StepControlStrategyState { UNINITIALIZED, BEFORE_FIRST_STEP, MID_STEP, AFTER_CORRECTION, READY_FOR_NEXT_STEP };
00050 
00073 template<class Scalar>
00074 class StepControlStrategyBase
00075   : virtual public Teuchos::Describable
00076   , virtual public Teuchos::ParameterListAcceptor
00077   , virtual public Teuchos::VerboseObject<StepControlStrategyBase<Scalar> >
00078 {
00079 public:
00080 
00082   virtual void initialize(const StepperBase<Scalar>& stepper) =0;
00083 
00085   virtual void setRequestedStepSize(
00086       const StepperBase<Scalar>& stepper
00087       , const Scalar& stepSize
00088       , const StepSizeType& stepSizeType
00089       ) = 0;
00090 
00092   virtual void nextStepSize(
00093       const StepperBase<Scalar>& stepper
00094       , Scalar* stepSize
00095       , StepSizeType* stepSizeType
00096       , int* order 
00097       ) = 0;
00098 
00100   virtual void setCorrection(
00101       const StepperBase<Scalar>& stepper
00102       , const RCP<const Thyra::VectorBase<Scalar> >& soln
00103       , const RCP<const Thyra::VectorBase<Scalar> >& ee
00104       , int solveStatus
00105       ) = 0; 
00106 
00108   virtual bool acceptStep(
00109       const StepperBase<Scalar>& stepper
00110       ,Scalar* LETValue
00111       ) = 0;
00112 
00114   virtual void completeStep(
00115       const StepperBase<Scalar>& stepper
00116       ) = 0;
00117 
00119   virtual AttemptedStepStatusFlag rejectStep(
00120       const StepperBase<Scalar>& stepper
00121       ) = 0;
00122 
00124   virtual StepControlStrategyState getCurrentState() = 0;
00125 
00127   virtual int getMaxOrder() const = 0;
00128 
00130   virtual void setStepControlData(const StepperBase<Scalar>& stepper) = 0;
00131 
00133   virtual bool supportsCloning() const;
00134 
00136   virtual RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const;
00137 
00138 
00139 };
00140 
00141 template<class Scalar>
00142 bool StepControlStrategyBase<Scalar>::supportsCloning() const
00143 {
00144   return false;
00145 }
00146 
00147 
00148 template<class Scalar>
00149 RCP<StepControlStrategyBase<Scalar> >
00150 StepControlStrategyBase<Scalar>::cloneStepControlStrategyAlgorithm() const
00151 {
00152   return Teuchos::null;
00153 }
00154 
00155 
00156 } // namespace Rythmos
00157 
00158 
00159 #endif // RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP

Generated on Wed May 12 21:25:44 2010 for Rythmos - Transient Integration for Differential Equations by  doxygen 1.4.7