52simpleIntegrationControlStrategy(
const RCP<ParameterList> ¶mList )
54 RCP<SimpleIntegrationControlStrategy<Scalar> >
55 integrationControl = Teuchos::rcp(
new SimpleIntegrationControlStrategy<Scalar>());
56 integrationControl->setParameterList(paramList);
57 return integrationControl;
130 RCP<ParameterList>
const& paramList
135 typedef Teuchos::ScalarTraits<Scalar> ST;
136 TEUCHOS_TEST_FOR_EXCEPT(is_null(paramList));
137 paramList->validateParameters(*getValidParameters());
138 this->setMyParamList(paramList);
139 takeVariableSteps_ = paramList->get(
140 takeVariableSteps_name_, takeVariableSteps_ );
141 if (!takeVariableSteps_) {
142 numTimeSteps_ = paramList->get(numTimeSteps_name_,numTimeSteps_);
143 fixed_dt_ = paramList->get(fixed_dt_name_,fixed_dt_default_);
144 TEUCHOS_TEST_FOR_EXCEPTION(
145 numTimeSteps_ < 0 && fixed_dt_ <= ST::zero(), std::logic_error,
146 "Error, when taking fixed steps, the user must set the parameters "
147 "\""<<numTimeSteps_name_<<
"\" > 0 or \""<<fixed_dt_name_<<
"\" > 0.0!" );
150 max_dt_ = paramList->get(max_dt_name_,max_dt_);
152 Teuchos::readVerboseObjectSublist(&*paramList,
this);
160 static RCP<const ParameterList> validPL;
161 if (is_null(validPL) ) {
162 RCP<ParameterList> pl = Teuchos::parameterList();
164 takeVariableSteps_name_, takeVariableSteps_default_,
165 "Take variable time steps or fixed time steps.\n"
166 "If set to false, then the parameter \"" + fixed_dt_name_ +
"\"\n"
167 "or \"" + numTimeSteps_name_ +
"\" must be set!"
170 max_dt_name_, max_dt_default_,
171 "Gives the max size of the variable time steps. This is only read and used if\n"
172 "\"" + takeVariableSteps_name_ +
"\" is set to true."
175 numTimeSteps_name_, numTimeSteps_default_,
176 "Gives the number of fixed time steps. The actual step size gets computed\n"
177 "on the fly given the size of the time domain.\n"
178 "This is only read and used if \"" + takeVariableSteps_name_ +
"\" is set to false\n"
179 "and \"" + fixed_dt_name_ +
"\" is set to < 0.0."
182 fixed_dt_name_, fixed_dt_default_,
183 "Gives the size of the fixed time steps. This is only read and used if\n"
184 "\"" + takeVariableSteps_name_ +
"\" is set to false."
186 Teuchos::setupVerboseObjectSublist(&*pl);
200 RCP<SimpleIntegrationControlStrategy<Scalar> >
201 integrCtrlStry = simpleIntegrationControlStrategy<Scalar>();
202 const RCP<const ParameterList> paramList = this->getParameterList();
203 if (!is_null(paramList))
204 integrCtrlStry->setParameterList(Teuchos::parameterList(*paramList));
205 integrCtrlStry->takeVariableSteps_ = takeVariableSteps_;
206 integrCtrlStry->max_dt_ = max_dt_;
207 integrCtrlStry->numTimeSteps_ = numTimeSteps_;
208 integrCtrlStry->fixed_dt_ = fixed_dt_;
209 return integrCtrlStry;
216 const TimeRange<Scalar> &integrationTimeDomain
219 typedef Teuchos::ScalarTraits<Scalar> ST;
220#ifdef HAVE_RYTHMOS_DEBUG
221 TEUCHOS_ASSERT(integrationTimeDomain.length() >= ST::zero());
223 integrationTimeDomain_ = integrationTimeDomain;
224 if (takeVariableSteps_) {
225 if (max_dt_ < ST::zero()) {
226 max_dt_ = integrationTimeDomain_.length();
230 if (fixed_dt_ < ST::zero()) {
231#ifdef HAVE_RYTHMOS_DEBUG
232 TEUCHOS_ASSERT(numTimeSteps_ > 0);
234 fixed_dt_ = integrationTimeDomain_.length()/numTimeSteps_;
243 const StepperBase<Scalar> &,
244 const StepControlInfo<Scalar> &,
249#ifdef HAVE_RYTHMOS_DEBUG
250 typedef Teuchos::ScalarTraits<Scalar> ST;
251 TEUCHOS_ASSERT(integrationTimeDomain_.length() >= ST::zero());
254 StepControlInfo<Scalar> trialStepCtrlInfo;
256 if (takeVariableSteps_) {
257 trialStepCtrlInfo.stepType = STEP_TYPE_VARIABLE;
258 trialStepCtrlInfo.stepSize = max_dt_;
261 trialStepCtrlInfo.stepType = STEP_TYPE_FIXED;
262 trialStepCtrlInfo.stepSize = fixed_dt_;
265 return trialStepCtrlInfo;