Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs Pages
Rythmos_StepControlStrategyBase.hpp
1 //@HEADER
2 // ***********************************************************************
3 //
4 // Rythmos Package
5 // Copyright (2006) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // This library is free software; you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as
12 // published by the Free Software Foundation; either version 2.1 of the
13 // License, or (at your option) any later version.
14 //
15 // This library is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 // Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public
21 // License along with this library; if not, write to the Free Software
22 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
23 // USA
24 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25 //
26 // ***********************************************************************
27 //@HEADER
28 
29 
30 #ifndef RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP
31 #define RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP
32 
33 
34 #include "Rythmos_StepperBase.hpp"
35 
36 namespace Rythmos {
37 
38 
46 enum AttemptedStepStatusFlag { PREDICT_AGAIN, CONTINUE_ANYWAY, REP_ERR_FAIL, REP_CONV_FAIL };
47 
49 enum StepControlStrategyState { UNINITIALIZED, BEFORE_FIRST_STEP, MID_STEP, AFTER_CORRECTION, READY_FOR_NEXT_STEP };
50 
73 template<class Scalar>
75  : virtual public Teuchos::Describable
76  , virtual public Teuchos::ParameterListAcceptor
77  , virtual public Teuchos::VerboseObject<StepControlStrategyBase<Scalar> >
78 {
79 public:
80 
82  virtual void initialize(const StepperBase<Scalar>& stepper) =0;
83 
85  virtual void setRequestedStepSize(
86  const StepperBase<Scalar>& stepper
87  , const Scalar& stepSize
88  , const StepSizeType& stepSizeType
89  ) = 0;
90 
92  virtual void nextStepSize(
93  const StepperBase<Scalar>& stepper
94  , Scalar* stepSize
95  , StepSizeType* stepSizeType
96  , int* order
97  ) = 0;
98 
100  virtual void setCorrection(
101  const StepperBase<Scalar>& stepper
102  , const RCP<const Thyra::VectorBase<Scalar> >& soln
103  , const RCP<const Thyra::VectorBase<Scalar> >& ee
104  , int solveStatus
105  ) = 0;
106 
108  virtual bool acceptStep(
109  const StepperBase<Scalar>& stepper
110  ,Scalar* LETValue
111  ) = 0;
112 
114  virtual void completeStep(
115  const StepperBase<Scalar>& stepper
116  ) = 0;
117 
119  virtual AttemptedStepStatusFlag rejectStep(
120  const StepperBase<Scalar>& stepper
121  ) = 0;
122 
124  virtual StepControlStrategyState getCurrentState() = 0;
125 
127  virtual int getMaxOrder() const = 0;
128 
130  virtual void setStepControlData(const StepperBase<Scalar>& stepper) = 0;
131 
133  virtual bool supportsCloning() const;
134 
136  virtual RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const;
137 
138 
139 };
140 
141 template<class Scalar>
143 {
144  return false;
145 }
146 
147 
148 template<class Scalar>
149 RCP<StepControlStrategyBase<Scalar> >
151 {
152  return Teuchos::null;
153 }
154 
155 
156 } // namespace Rythmos
157 
158 
159 #endif // RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP
virtual AttemptedStepStatusFlag rejectStep(const StepperBase< Scalar > &stepper)=0
Base class for defining stepper functionality.
virtual void setCorrection(const StepperBase< Scalar > &stepper, const RCP< const Thyra::VectorBase< Scalar > > &soln, const RCP< const Thyra::VectorBase< Scalar > > &ee, int solveStatus)=0
virtual void setRequestedStepSize(const StepperBase< Scalar > &stepper, const Scalar &stepSize, const StepSizeType &stepSizeType)=0
virtual void nextStepSize(const StepperBase< Scalar > &stepper, Scalar *stepSize, StepSizeType *stepSizeType, int *order)=0
The member functions in the StepControlStrategyBase move you between these states in the following fa...
virtual void setStepControlData(const StepperBase< Scalar > &stepper)=0
virtual RCP< StepControlStrategyBase< Scalar > > cloneStepControlStrategyAlgorithm() const
virtual StepControlStrategyState getCurrentState()=0
virtual void completeStep(const StepperBase< Scalar > &stepper)=0
virtual void initialize(const StepperBase< Scalar > &stepper)=0
virtual int getMaxOrder() const =0
virtual bool acceptStep(const StepperBase< Scalar > &stepper, Scalar *LETValue)=0