00001
00002 #ifndef RYTHMOS_STEPPER_HELPERS_HPP
00003 #define RYTHMOS_STEPPER_HELPERS_HPP
00004
00005
00006 #include "Rythmos_StepperBase.hpp"
00007
00008
00009 namespace Rythmos {
00010
00011
00019 template<class Scalar>
00020 void restart( StepperBase<Scalar> *stepper )
00021 {
00022 #ifdef TEUCHOS_DEBUG
00023 TEST_FOR_EXCEPT(0==stepper);
00024 #endif // TEUCHOS_DEBUG
00025 typedef Thyra::ModelEvaluatorBase MEB;
00026 const Rythmos::StepStatus<double>
00027 stepStatus = stepper->getStepStatus();
00028 const RCP<const Thyra::ModelEvaluator<Scalar> >
00029 model = stepper->getModel();
00030
00031 MEB::InArgs<double> initialCondition = model->createInArgs();
00032 initialCondition.setArgs(model->getNominalValues());
00033
00034 RCP<const Thyra::VectorBase<double> > x, x_dot;
00035 Rythmos::get_x_and_x_dot(*stepper,stepStatus.time,&x,&x_dot);
00036 initialCondition.set_x(x);
00037 initialCondition.set_x_dot(x_dot);
00038 initialCondition.set_t(stepStatus.time);
00039
00040
00041 stepper->setInitialCondition(initialCondition);
00042 }
00043
00044
00045
00046 }
00047
00048
00049 #endif // RYTHMOS_STEPPER_HELPERS_HPP