Rythmos - Transient Integration for Differential Equations Version of the Day
Loading...
Searching...
No Matches
Rythmos_SimpleStepControlStrategy_decl.hpp
1//@HEADER
2// ***********************************************************************
3//
4// Rythmos Package
5// Copyright (2006) Sandia Corporation
6//
7// Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8// license for use of this work by or on behalf of the U.S. Government.
9//
10// This library is free software; you can redistribute it and/or modify
11// it under the terms of the GNU Lesser General Public License as
12// published by the Free Software Foundation; either version 2.1 of the
13// License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful, but
16// WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23// USA
24// Questions? Contact Todd S. Coffey (tscoffe@sandia.gov)
25//
26// ***********************************************************************
27//@HEADER
28
29#ifndef Rythmos_SIMPLE_STEP_CONTROL_STRATEGY_DECL_H
30#define Rythmos_SIMPLE_STEP_CONTROL_STRATEGY_DECL_H
31
32#include "Rythmos_StepControlStrategyBase.hpp"
33
34namespace Rythmos {
35
36// Step Control Strategy object for SimpleStepControlStrategy
37//
38// Order of calls:
39// setRequestedStepSize()
40// nextStepSize()
41// optional: nextStepOrder()
42// setCorrection
43// acceptStep
44// completeStep or rejectStep
45// repeat
46//
47template<class Scalar>
48class SimpleStepControlStrategy
49 : virtual public StepControlStrategyBase<Scalar>
50{
51 public:
52
53 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
54
58 void setRequestedStepSize(const StepperBase<Scalar>& stepper,
59 const Scalar& stepSize, const StepSizeType& stepSizeType);
60
62 void nextStepSize(const StepperBase<Scalar>& stepper, Scalar* stepSize,
63 StepSizeType* stepSizeType, int* order);
64
66 void setCorrection(
67 const StepperBase<Scalar>& stepper
68 ,const RCP<const Thyra::VectorBase<Scalar> >& soln
69 ,const RCP<const Thyra::VectorBase<Scalar> >& ee
70 ,int solveStatus
71 );
72
74 bool acceptStep(const StepperBase<Scalar>& stepper, Scalar* LETValue);
75
77 void completeStep(const StepperBase<Scalar>& stepper);
78
80 AttemptedStepStatusFlag rejectStep(const StepperBase<Scalar>& stepper);
81
83 StepControlStrategyState getCurrentState();
84
86 int getMaxOrder() const;
87
89 void setStepControlData(const StepperBase<Scalar>& stepper);
90
92 bool supportsCloning() const;
93
95 RCP<StepControlStrategyBase<Scalar> > cloneStepControlStrategyAlgorithm() const;
96
98
99 SimpleStepControlStrategy();
100
104 void describe(
105 Teuchos::FancyOStream &out,
106 const Teuchos::EVerbosityLevel verbLevel
107 ) const;
109
113 void setParameterList(RCP<Teuchos::ParameterList> const& paramList);
114
116 RCP<Teuchos::ParameterList> getNonconstParameterList();
117
119 RCP<Teuchos::ParameterList> unsetParameterList();
120
122 RCP<const Teuchos::ParameterList> getValidParameters() const;
123
125
126 void initialize(const StepperBase<Scalar>& stepper);
127
128
129 private:
130
131 // Private data members
132
133 void defaultInitializeAllData_();
134
135 StepControlStrategyState stepControlState_;
136
137 RCP<Teuchos::ParameterList> parameterList_;
138
139 Scalar initialStepSize_;
140 Scalar requestedStepSize_;
141 Scalar currentStepSize_;
142 Scalar nextStepSize_;
143 StepSizeType stepSizeType_;
144
145 Scalar minStepSize_;
146 Scalar maxStepSize_;
147 Scalar stepSizeIncreaseFactor_;
148 Scalar stepSizeDecreaseFactor_;
149 int numStepFailures_;
150 int maxStepFailures_;
151 int maxOrder_;
152 Scalar dxRelativeTolerance_;
153 Scalar dxAbsoluteTolerance_;
154 int solveStatus_;
155
156 RCP<const Thyra::VectorBase<Scalar> > x_;
157 RCP<const Thyra::VectorBase<Scalar> > dx_;
158
159
160 static const std::string initialStepSizeName_;
161 static const double initialStepSizeDefault_;
162
163 static const std::string minStepSizeName_;
164 static const double minStepSizeDefault_;
165
166 static const std::string maxStepSizeName_;
167 static const double maxStepSizeDefault_;
168
169 static const std::string stepSizeIncreaseFactorName_;
170 static const double stepSizeIncreaseFactorDefault_;
171
172 static const std::string stepSizeDecreaseFactorName_;
173 static const double stepSizeDecreaseFactorDefault_;
174
175 static const std::string maxStepFailuresName_;
176 static const int maxStepFailuresDefault_;
177
178 static const std::string dxRelativeToleranceName_;
179 static const double dxRelativeToleranceDefault_;
180
181 static const std::string dxAbsoluteToleranceName_;
182 static const double dxAbsoluteToleranceDefault_;
183
184
185 // Private member functions
186
187 void setStepControlState_(StepControlStrategyState state);
188
189};
190
191} // namespace Rythmos
192
193#endif // Rythmos_SIMPLE_STEP_CONTROL_STRATEGY_DECL_H
194