Rythmos - Transient Integration for Differential Equations  Version of the Day
 All Classes Functions Variables Typedefs
Rythmos_SimpleStepControlStrategy_decl.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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
00023 // USA
00024 // Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
00025 //
00026 // ***********************************************************************
00027 //@HEADER
00028 
00029 #ifndef Rythmos_SIMPLE_STEP_CONTROL_STRATEGY_DECL_H
00030 #define Rythmos_SIMPLE_STEP_CONTROL_STRATEGY_DECL_H
00031 
00032 #include "Rythmos_StepControlStrategyBase.hpp"
00033 
00034 namespace Rythmos {
00035 
00036 // Step Control Strategy object for SimpleStepControlStrategy
00037 //
00038 // Order of calls:
00039 // setRequestedStepSize()
00040 // nextStepSize()
00041 // optional:  nextStepOrder()
00042 // setCorrection
00043 // acceptStep
00044 // completeStep or rejectStep
00045 // repeat
00046 //
00047 template<class Scalar>
00048 class SimpleStepControlStrategy
00049   : virtual public StepControlStrategyBase<Scalar>
00050 {
00051   public:
00052 
00053     typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00054 
00058     void setRequestedStepSize(const StepperBase<Scalar>& stepper,
00059       const Scalar& stepSize, const StepSizeType& stepSizeType);
00060 
00062     void nextStepSize(const StepperBase<Scalar>& stepper, Scalar* stepSize,
00063       StepSizeType* stepSizeType, int* order);
00064 
00066     void setCorrection(
00067          const StepperBase<Scalar>& stepper
00068         ,const RCP<const Thyra::VectorBase<Scalar> >& soln
00069         ,const RCP<const Thyra::VectorBase<Scalar> >& ee
00070         ,int solveStatus
00071         );
00072 
00074     bool acceptStep(const StepperBase<Scalar>& stepper, Scalar* LETValue);
00075 
00077     void completeStep(const StepperBase<Scalar>& stepper);
00078 
00080     AttemptedStepStatusFlag rejectStep(const StepperBase<Scalar>& stepper);
00081 
00083     StepControlStrategyState getCurrentState();
00084 
00086     int getMaxOrder() const;
00087 
00089     void setStepControlData(const StepperBase<Scalar>& stepper);
00090 
00092     bool supportsCloning() const;
00093 
00095     RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const;
00096 
00098 
00099     SimpleStepControlStrategy();
00100 
00104     void describe(
00105       Teuchos::FancyOStream &out,
00106       const Teuchos::EVerbosityLevel verbLevel
00107       ) const;
00109 
00113     void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
00114 
00116     RCP<Teuchos::ParameterList> getNonconstParameterList();
00117 
00119     RCP<Teuchos::ParameterList> unsetParameterList();
00120 
00122     RCP<const Teuchos::ParameterList> getValidParameters() const;
00123 
00125 
00126     void initialize(const StepperBase<Scalar>& stepper);
00127 
00128 
00129   private:
00130 
00131     // Private data members
00132 
00133     void defaultInitializeAllData_();
00134 
00135     StepControlStrategyState stepControlState_;
00136 
00137     RCP<Teuchos::ParameterList> parameterList_;
00138 
00139     Scalar initialStepSize_;
00140     Scalar requestedStepSize_;
00141     Scalar currentStepSize_;
00142     Scalar nextStepSize_;
00143     StepSizeType stepSizeType_;
00144 
00145     Scalar minStepSize_;
00146     Scalar maxStepSize_;
00147     Scalar stepSizeIncreaseFactor_;
00148     Scalar stepSizeDecreaseFactor_;
00149     int numStepFailures_;
00150     int maxStepFailures_;
00151     int maxOrder_;
00152     Scalar dxRelativeTolerance_;
00153     Scalar dxAbsoluteTolerance_;
00154     int solveStatus_;
00155 
00156     RCP<const Thyra::VectorBase<Scalar> > x_;
00157     RCP<const Thyra::VectorBase<Scalar> > dx_;
00158 
00159 
00160     static const std::string initialStepSizeName_;
00161     static const double initialStepSizeDefault_;
00162 
00163     static const std::string minStepSizeName_;
00164     static const double minStepSizeDefault_;
00165 
00166     static const std::string maxStepSizeName_;
00167     static const double maxStepSizeDefault_;
00168 
00169     static const std::string stepSizeIncreaseFactorName_;
00170     static const double stepSizeIncreaseFactorDefault_;
00171 
00172     static const std::string stepSizeDecreaseFactorName_;
00173     static const double stepSizeDecreaseFactorDefault_;
00174 
00175     static const std::string maxStepFailuresName_;
00176     static const int maxStepFailuresDefault_;
00177 
00178     static const std::string dxRelativeToleranceName_;
00179     static const double dxRelativeToleranceDefault_;
00180 
00181     static const std::string dxAbsoluteToleranceName_;
00182     static const double dxAbsoluteToleranceDefault_;
00183 
00184 
00185     // Private member functions
00186 
00187     void setStepControlState_(StepControlStrategyState state);
00188 
00189 };
00190 
00191 } // namespace Rythmos
00192 
00193 #endif // Rythmos_SIMPLE_STEP_CONTROL_STRATEGY_DECL_H
00194 
 All Classes Functions Variables Typedefs