00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
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 }
00157
00158
00159 #endif // RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP