Rythmos_StepControlInfo.hpp

00001 
00002 #ifndef RYTHMOS_STEP_CONTROL_INFO_HPP
00003 #define RYTHMOS_STEP_CONTROL_INFO_HPP
00004 
00005 #include "Rythmos_StepperSupportTypes.hpp"
00006 
00007 namespace Rythmos {
00008 
00009 
00012 template<class Scalar>
00013 struct StepControlInfo {
00015   Scalar stepSize;
00017   StepSizeType stepType;
00019   bool limitedByBreakPoint;
00022   EBreakPointType breakPointType;
00024   StepControlInfo()
00025     :stepSize(-1.0), stepType(STEP_TYPE_FIXED),
00026      limitedByBreakPoint(false),
00027      breakPointType(BREAK_POINT_TYPE_SOFT)
00028     {}
00029 };
00030 
00031 
00033 template<class Scalar>
00034 std::ostream& operator<<(
00035   std::ostream &out, const StepControlInfo<Scalar> &stepCtrlInfo
00036   )
00037 {
00038   using std::endl;
00039   out
00040     << "stepType = " << toString(stepCtrlInfo.stepType) << endl
00041     << "stepSize = " << stepCtrlInfo.stepSize << endl
00042     << "limitedByBreakPoint = " << stepCtrlInfo.limitedByBreakPoint << endl
00043     << "breakPointType = " << toString(stepCtrlInfo.breakPointType) << endl;
00044   return out;
00045 }
00046 
00047 
00055 template<class Scalar>
00056 StepControlInfo<Scalar>
00057 stepCtrlInfoTaken( 
00058   const StepControlInfo<Scalar> &trialStepCtrlInfo,
00059   const Scalar &stepSizeTaken
00060   )
00061 {
00062   typedef Teuchos::ScalarTraits<Scalar> ST;
00063   const Scalar zero = ST::zero();
00064   StepControlInfo<Scalar> stepCtrlInfo = trialStepCtrlInfo;
00065   stepCtrlInfo.stepSize = stepSizeTaken;
00066   if ( trialStepCtrlInfo.stepSize > zero && stepSizeTaken > zero ) {
00067     if (stepSizeTaken < trialStepCtrlInfo.stepSize) {
00068       stepCtrlInfo.limitedByBreakPoint = false;
00069     }
00070   }
00071   else {
00072     stepCtrlInfo.limitedByBreakPoint = false;
00073   }
00074   return stepCtrlInfo;
00075 }
00076 
00077 
00078 // 2007/09/14: rabartl: ToDo: Above: Move this function into
00079 // Rythmos_IntegratorBaseHelpers.hpp once created!
00080 
00081 
00082 } // namespace Rythmos
00083 
00084 
00085 #endif // RYTHMOS_STEP_CONTROL_INFO_HPP

Generated on Tue Jul 13 09:23:54 2010 for Rythmos - Transient Integration for Differential Equations by  doxygen 1.4.7