|
Rythmos - Transient Integration for Differential Equations
Version of the Day
|
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_FIRSTORDERERROR_STEP_CONTROL_STRATEGY_DECL_H 00030 #define Rythmos_FIRSTORDERERROR_STEP_CONTROL_STRATEGY_DECL_H 00031 00032 #include "Rythmos_StepControlStrategyBase.hpp" 00033 #include "Thyra_VectorBase.hpp" 00034 #include "Teuchos_VerboseObject.hpp" 00035 00036 namespace Rythmos { 00037 00038 // Step Control Strategy object for FirstOrderErrorStepControlStrategy 00039 // 00040 // Order of calls: 00041 // setRequestedStepSize() 00042 // nextStepSize() 00043 // optional: nextStepOrder() 00044 // setCorrection 00045 // acceptStep 00046 // completeStep or rejectStep 00047 // repeat 00048 // 00100 template<class Scalar> 00101 class FirstOrderErrorStepControlStrategy 00102 : virtual public StepControlStrategyBase<Scalar> 00103 { 00104 public: 00105 00106 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag; 00107 00111 void setRequestedStepSize(const StepperBase<Scalar>& stepper, 00112 const Scalar& stepSize, const StepSizeType& stepSizeType); 00113 00115 void nextStepSize(const StepperBase<Scalar>& stepper, Scalar* stepSize, 00116 StepSizeType* stepSizeType, int* order); 00117 00119 void setCorrection( 00120 const StepperBase<Scalar>& stepper 00121 ,const RCP<const Thyra::VectorBase<Scalar> >& soln 00122 ,const RCP<const Thyra::VectorBase<Scalar> >& ee 00123 ,int solveStatus 00124 ); 00125 00127 bool acceptStep(const StepperBase<Scalar>& stepper, Scalar* LETValue); 00128 00130 void completeStep(const StepperBase<Scalar>& stepper); 00131 00133 AttemptedStepStatusFlag rejectStep(const StepperBase<Scalar>& stepper); 00134 00136 StepControlStrategyState getCurrentState(); 00137 00139 int getMaxOrder() const; 00140 00142 void setStepControlData(const StepperBase<Scalar>& stepper); 00143 00145 bool supportsCloning() const; 00146 00148 RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const; 00149 00151 00152 FirstOrderErrorStepControlStrategy(); 00153 00157 void describe( 00158 Teuchos::FancyOStream &out, 00159 const Teuchos::EVerbosityLevel verbLevel 00160 ) const; 00162 00166 void setParameterList(RCP<Teuchos::ParameterList> const& paramList); 00167 00169 RCP<Teuchos::ParameterList> getNonconstParameterList(); 00170 00172 RCP<Teuchos::ParameterList> unsetParameterList(); 00173 00175 RCP<const Teuchos::ParameterList> getValidParameters() const; 00176 00178 00179 void initialize(const StepperBase<Scalar>& stepper); 00180 00181 00182 private: 00183 00184 // Private data members 00185 00186 void defaultInitializeAllData_(); 00187 00188 StepControlStrategyState stepControlState_; 00189 00190 RCP<Teuchos::ParameterList> parameterList_; 00191 00192 Scalar initialStepSize_; 00193 Scalar requestedStepSize_; 00194 Scalar currentStepSize_; 00195 Scalar nextStepSize_; 00196 Scalar stepSizeFactor_; 00197 StepSizeType stepSizeType_; 00198 00199 Scalar minStepSize_; 00200 Scalar maxStepSize_; 00201 Scalar maxStepSizeIncreaseFactor_; 00202 Scalar minStepSizeDecreaseFactor_; 00203 int numStepFailures_; 00204 int maxStepFailures_; 00205 int maxOrder_; 00206 Scalar errorRelativeTolerance_; 00207 Scalar errorAbsoluteTolerance_; 00208 int solveStatus_; 00209 00210 RCP<const Thyra::VectorBase<Scalar> > x_; 00211 RCP<const Thyra::VectorBase<Scalar> > dx_; 00212 RCP<Thyra::VectorBase<Scalar> > errWtVec_; 00213 00214 00215 static const std::string initialStepSizeName_; 00216 static const double initialStepSizeDefault_; 00217 00218 static const std::string minStepSizeName_; 00219 static const double minStepSizeDefault_; 00220 00221 static const std::string maxStepSizeName_; 00222 static const double maxStepSizeDefault_; 00223 00224 static const std::string maxStepSizeIncreaseFactorName_; 00225 static const double maxStepSizeIncreaseFactorDefault_; 00226 00227 static const std::string minStepSizeDecreaseFactorName_; 00228 static const double minStepSizeDecreaseFactorDefault_; 00229 00230 static const std::string maxStepFailuresName_; 00231 static const int maxStepFailuresDefault_; 00232 00233 static const std::string errorRelativeToleranceName_; 00234 static const double errorRelativeToleranceDefault_; 00235 00236 static const std::string errorAbsoluteToleranceName_; 00237 static const double errorAbsoluteToleranceDefault_; 00238 00239 00240 // Private member functions 00241 00242 void setStepControlState_(StepControlStrategyState state); 00243 00244 }; 00245 00246 } // namespace Rythmos 00247 00248 #endif // Rythmos_FIRSTORDERERROR_STEP_CONTROL_STRATEGY_DECL_H 00249
1.7.6.1