Rythmos - Transient Integration for Differential Equations  Version of the Day
Rythmos_StepControlInfo.hpp
1 
2 #ifndef RYTHMOS_STEP_CONTROL_INFO_HPP
3 #define RYTHMOS_STEP_CONTROL_INFO_HPP
4 
5 #include "Rythmos_StepperSupportTypes.hpp"
6 
7 namespace Rythmos {
8 
9 
12 template<class Scalar>
13 struct StepControlInfo {
15  Scalar stepSize;
17  StepSizeType stepType;
22  EBreakPointType breakPointType;
25  :stepSize(-1.0), stepType(STEP_TYPE_FIXED),
26  limitedByBreakPoint(false),
27  breakPointType(BREAK_POINT_TYPE_SOFT)
28  {}
29 };
30 
31 
33 template<class Scalar>
34 std::ostream& operator<<(
35  std::ostream &out, const StepControlInfo<Scalar> &stepCtrlInfo
36  )
37 {
38  using std::endl;
39  out
40  << "stepType = " << toString(stepCtrlInfo.stepType) << endl
41  << "stepSize = " << stepCtrlInfo.stepSize << endl
42  << "limitedByBreakPoint = " << stepCtrlInfo.limitedByBreakPoint << endl
43  << "breakPointType = " << toString(stepCtrlInfo.breakPointType) << endl;
44  return out;
45 }
46 
47 
55 template<class Scalar>
58  const StepControlInfo<Scalar> &trialStepCtrlInfo,
59  const Scalar &stepSizeTaken
60  )
61 {
62  typedef Teuchos::ScalarTraits<Scalar> ST;
63  const Scalar zero = ST::zero();
64  StepControlInfo<Scalar> stepCtrlInfo = trialStepCtrlInfo;
65  stepCtrlInfo.stepSize = stepSizeTaken;
66  if ( trialStepCtrlInfo.stepSize > zero && stepSizeTaken > zero ) {
67  if (stepSizeTaken < trialStepCtrlInfo.stepSize) {
68  stepCtrlInfo.limitedByBreakPoint = false;
69  }
70  }
71  else {
72  stepCtrlInfo.limitedByBreakPoint = false;
73  }
74  return stepCtrlInfo;
75 }
76 
77 
78 // 2007/09/14: rabartl: ToDo: Above: Move this function into
79 // Rythmos_IntegratorBaseHelpers.hpp once created!
80 
81 
82 } // namespace Rythmos
83 
84 
85 #endif // RYTHMOS_STEP_CONTROL_INFO_HPP
StepControlInfo()
Initalize to invalid state.
StepControlInfo< Scalar > stepCtrlInfoTaken(const StepControlInfo< Scalar > &trialStepCtrlInfo, const Scalar &stepSizeTaken)
Return a step control info object for a step actually taken.
Simple strict to aggregate integration/stepper control information.
Scalar stepSize
The size of the time step.
EBreakPointType breakPointType
True if the time integrator should restart when passing over the breakpoint.
bool limitedByBreakPoint
True if step size is limited by a breakpoint.
StepSizeType stepType
The type of time step.