|
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 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 00052 inline 00053 const char* toString( const StepControlStrategyState stepControlStrategyState ) 00054 { 00055 switch(stepControlStrategyState) { 00056 case UNINITIALIZED: 00057 return "UNINITIALIZED"; 00058 case BEFORE_FIRST_STEP: 00059 return "BEFORE_FIRST_STEP"; 00060 case MID_STEP: 00061 return "MID_STEP"; 00062 case AFTER_CORRECTION: 00063 return "AFTER_CORRECTION"; 00064 case READY_FOR_NEXT_STEP: 00065 return "READY_FOR_NEXT_STEP"; 00066 #ifdef HAVE_RYTHMOS_DEBUG 00067 default: 00068 TEUCHOS_TEST_FOR_EXCEPT("Invalid enum value!"); 00069 #endif 00070 } 00071 return 0; // Should never get here! 00072 } 00073 00096 template<class Scalar> 00097 class StepControlStrategyBase 00098 : virtual public Teuchos::Describable 00099 , virtual public Teuchos::ParameterListAcceptor 00100 , virtual public Teuchos::VerboseObject<StepControlStrategyBase<Scalar> > 00101 { 00102 public: 00103 00105 virtual void initialize(const StepperBase<Scalar>& stepper) =0; 00106 00108 virtual void setRequestedStepSize( 00109 const StepperBase<Scalar>& stepper 00110 , const Scalar& stepSize 00111 , const StepSizeType& stepSizeType 00112 ) = 0; 00113 00115 virtual void nextStepSize( 00116 const StepperBase<Scalar>& stepper 00117 , Scalar* stepSize 00118 , StepSizeType* stepSizeType 00119 , int* order 00120 ) = 0; 00121 00123 virtual void setCorrection( 00124 const StepperBase<Scalar>& stepper 00125 , const RCP<const Thyra::VectorBase<Scalar> >& soln 00126 , const RCP<const Thyra::VectorBase<Scalar> >& ee 00127 , int solveStatus 00128 ) = 0; 00129 00131 virtual bool acceptStep( 00132 const StepperBase<Scalar>& stepper 00133 ,Scalar* LETValue 00134 ) = 0; 00135 00137 virtual void completeStep( 00138 const StepperBase<Scalar>& stepper 00139 ) = 0; 00140 00142 virtual AttemptedStepStatusFlag rejectStep( 00143 const StepperBase<Scalar>& stepper 00144 ) = 0; 00145 00147 virtual StepControlStrategyState getCurrentState() = 0; 00148 00150 virtual int getMaxOrder() const = 0; 00151 00153 virtual void setStepControlData(const StepperBase<Scalar>& stepper) = 0; 00154 00156 virtual bool supportsCloning() const; 00157 00159 virtual RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const; 00160 00161 00162 }; 00163 00164 template<class Scalar> 00165 bool StepControlStrategyBase<Scalar>::supportsCloning() const 00166 { 00167 return false; 00168 } 00169 00170 00171 template<class Scalar> 00172 RCP<StepControlStrategyBase<Scalar> > 00173 StepControlStrategyBase<Scalar>::cloneStepControlStrategyAlgorithm() const 00174 { 00175 return Teuchos::null; 00176 } 00177 00178 00179 } // namespace Rythmos 00180 00181 00182 #endif // RYTHMOS_STEP_CONTROL_STRATEGY_BASE_HPP
1.7.6.1