29 #ifndef Rythmos_STEPPER_BUILDER_NEWNEW_H
30 #define Rythmos_STEPPER_BUILDER_NEWNEW_H
32 #include "Rythmos_Types.hpp"
33 #include "Rythmos_StepperBase.hpp"
35 #include "Teuchos_ObjectBuilder.hpp"
36 #include "Teuchos_ParameterList.hpp"
38 #include "Rythmos_BackwardEulerStepper.hpp"
39 #include "Rythmos_ImplicitBDFStepper.hpp"
40 #include "Rythmos_ForwardEulerStepper.hpp"
41 #include "Rythmos_ExplicitRKStepper.hpp"
42 #include "Rythmos_ImplicitRKStepper.hpp"
43 #ifdef HAVE_THYRA_ME_POLYNOMIAL
44 # include "Rythmos_ExplicitTaylorPolynomialStepper.hpp"
45 #endif // HAVE_THYRA_ME_POLYNOMIAL
46 #ifdef HAVE_RYTHMOS_EXPERIMENTAL
47 #include "Rythmos_ThetaStepper.hpp"
48 #endif // HAVE_RYTHMOS_EXPERIMENTAL
53 template<
class Scalar>
54 class StepperBuilder :
virtual public Teuchos::ParameterListAcceptor
65 void setStepperFactory(
66 const RCP<
const Teuchos::AbstractFactory<StepperBase<Scalar> > > &stepperFactory,
67 const std::string &stepperFactoryName
73 std::string getStepperName()
const;
76 RCP<StepperBase<Scalar> > create(
77 const std::string &stepperName =
""
84 void setParameterList(
const RCP<Teuchos::ParameterList> & paramList);
87 RCP<Teuchos::ParameterList> getNonconstParameterList();
90 RCP<Teuchos::ParameterList> unsetParameterList();
93 RCP<const ParameterList> getParameterList()
const;
96 RCP<const Teuchos::ParameterList> getValidParameters()
const;
105 Teuchos::ObjectBuilder<StepperBase<Scalar> > builder_;
110 void initializeDefaults_();
116 template<
class Scalar>
117 RCP<StepperBuilder<Scalar> > stepperBuilder()
119 RCP<StepperBuilder<Scalar> > sb = rcp(
new StepperBuilder<Scalar> );
123 template<
class Scalar>
124 StepperBuilder<Scalar>::StepperBuilder()
126 this->initializeDefaults_();
130 template<
class Scalar>
131 RCP<StepperBase<Scalar> > createStepper(
const std::string &stepperName)
133 RCP<StepperBuilder<Scalar> > sb = stepperBuilder<Scalar>();
134 RCP<StepperBase<Scalar> > stepper = sb->create(stepperName);
138 template<
class Scalar>
139 StepperBuilder<Scalar>::~StepperBuilder()
144 template<
class Scalar>
145 void StepperBuilder<Scalar>::setStepperFactory(
146 const RCP<
const Teuchos::AbstractFactory<StepperBase<Scalar> > > &stepperFactory,
147 const std::string &stepperName
150 builder_.setObjectFactory(stepperFactory, stepperName);
154 template<
class Scalar>
156 StepperBuilder<Scalar>::getStepperName()
const
158 return builder_.getObjectName();
162 template<
class Scalar>
163 void StepperBuilder<Scalar>::setParameterList(
164 RCP<Teuchos::ParameterList>
const& paramList
167 builder_.setParameterList(paramList);
171 template<
class Scalar>
172 RCP<Teuchos::ParameterList>
173 StepperBuilder<Scalar>::getNonconstParameterList()
175 return builder_.getNonconstParameterList();
179 template<
class Scalar>
180 RCP<Teuchos::ParameterList>
181 StepperBuilder<Scalar>::unsetParameterList()
183 return builder_.unsetParameterList();
187 template<
class Scalar>
188 RCP<const Teuchos::ParameterList>
189 StepperBuilder<Scalar>::getParameterList()
const
191 return builder_.getParameterList();
195 template<
class Scalar>
196 RCP<const Teuchos::ParameterList>
197 StepperBuilder<Scalar>::getValidParameters()
const
199 return builder_.getValidParameters();
203 template<
class Scalar>
204 RCP<StepperBase<Scalar> >
205 StepperBuilder<Scalar>::create(
206 const std::string &stepperName
209 return builder_.create(stepperName);
213 template<
class Scalar>
214 void StepperBuilder<Scalar>::initializeDefaults_()
217 using Teuchos::abstractFactoryStd;
219 builder_.setObjectName(
"Rythmos::Stepper");
220 builder_.setObjectTypeName(
"Stepper Type");
226 builder_.setObjectFactory(
227 abstractFactoryStd< StepperBase<Scalar>, ForwardEulerStepper<Scalar> >(),
231 builder_.setObjectFactory(
232 abstractFactoryStd< StepperBase<Scalar>, BackwardEulerStepper<Scalar> >(),
236 builder_.setObjectFactory(
237 abstractFactoryStd< StepperBase<Scalar>, ImplicitBDFStepper<Scalar> >(),
241 builder_.setObjectFactory(
242 abstractFactoryStd< StepperBase<Scalar>, ExplicitRKStepper<Scalar> >(),
246 builder_.setObjectFactory(
247 abstractFactoryStd< StepperBase<Scalar>, ImplicitRKStepper<Scalar> >(),
251 #ifdef HAVE_THYRA_ME_POLYNOMIAL
252 builder_.setObjectFactory(
253 abstractFactoryStd< StepperBase<Scalar>, ExplicitTaylorPolynomialStepper<Scalar> >(),
254 "Explicit Taylor Polynomial"
256 #endif // HAVE_THYRA_ME_POLYNOMIAL
258 #ifdef HAVE_RYTHMOS_EXPERIMENTAL
259 builder_.setObjectFactory(
260 abstractFactoryStd< StepperBase<Scalar>, ThetaStepper<Scalar> >(),
263 #endif // HAVE_RYTHMOS_EXPERIMENTAL
265 builder_.setDefaultObject(
"Backward Euler");
273 #endif //Rythmos_STEPPER_BUILDER_NEWNEW_H