9 #ifndef Tempus_ModelEvaluatorIMEXPair_Basic_impl_hpp
10 #define Tempus_ModelEvaluatorIMEXPair_Basic_impl_hpp
12 #include "Thyra_ProductVectorBase.hpp"
13 #include "Thyra_ProductVectorSpaceBase.hpp"
18 template <
typename Scalar>
25 wrapperImplicitInArgs_ = this->createInArgs();
26 wrapperImplicitOutArgs_ = this->createOutArgs();
29 TEUCHOS_TEST_FOR_EXCEPTION( !(explicitModel_->get_x_space()->isCompatible(
30 *(implicitModel_->get_x_space()))),
32 "Error - WrapperModelEvaluatorPairIMEX_Basic::initialize()\n"
33 " Explicit and Implicit vector x spaces are incompatible!\n"
34 " Explicit vector x space = " << *(explicitModel_->get_x_space())<<
"\n"
35 " Implicit vector x space = " << *(implicitModel_->get_x_space())<<
"\n");
38 TEUCHOS_TEST_FOR_EXCEPTION( !(explicitModel_->get_f_space()->isCompatible(
39 *(implicitModel_->get_f_space()))),
41 "Error - WrapperModelEvaluatorPairIMEX_Basic::initialize()\n"
42 " Explicit and Implicit vector f spaces are incompatible!\n"
43 " Explicit vector f space = " << *(explicitModel_->get_f_space())<<
"\n"
44 " Implicit vector f space = " << *(implicitModel_->get_f_space())<<
"\n");
47 template <
typename Scalar>
51 const Teuchos::RCP<
const Thyra::ModelEvaluator<Scalar> > & )
53 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
54 "Error - WrapperModelEvaluatorPairIMEX_Basic<Scalar>::setAppModel\n"
55 " should not be used. One should instead use setExplicitModel,\n"
56 " setImplicitModel, or create a new WrapperModelEvaluatorPairIMEX.\n");
59 template <
typename Scalar>
60 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >
64 TEUCHOS_TEST_FOR_EXCEPTION(
true, std::logic_error,
65 "Error - WrapperModelEvaluatorPairIMEX_Basic<Scalar>::getAppModel\n"
66 " should not be used. One should instead use getExplicitModel,\n"
67 " getImplicitModel, or directly use this WrapperModelEvaluatorPairIMEX\n"
71 template <
typename Scalar>
72 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> >
76 return this->implicitModel_->get_x_space();
79 template <
typename Scalar>
80 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> >
84 return this->implicitModel_->get_g_space(i);
87 template <
typename Scalar>
88 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> >
92 return this->implicitModel_->get_p_space(i);
95 template <
typename Scalar>
96 Thyra::ModelEvaluatorBase::InArgs<Scalar>
100 typedef Thyra::ModelEvaluatorBase MEB;
101 MEB::InArgsSetup<Scalar> inArgs = this->createInArgs();
105 template <
typename Scalar>
106 Thyra::ModelEvaluatorBase::InArgs<Scalar>
110 typedef Thyra::ModelEvaluatorBase MEB;
112 MEB::InArgsSetup<Scalar> inArgs(implicitModel_->getNominalValues());
113 inArgs.setModelEvalDescription(this->description());
117 template <
typename Scalar>
118 Thyra::ModelEvaluatorBase::OutArgs<Scalar>
122 typedef Thyra::ModelEvaluatorBase MEB;
123 MEB::OutArgsSetup<Scalar> outArgs(implicitModel_->createOutArgs());
124 outArgs.setModelEvalDescription(this->description());
128 template <
typename Scalar>
131 const Thyra::ModelEvaluatorBase::OutArgs<Scalar> & outArgs)
const
133 typedef Thyra::ModelEvaluatorBase MEB;
136 RCP<const Thyra::VectorBase<Scalar> > x = inArgs.get_x();
137 RCP<Thyra::VectorBase<Scalar> > x_dot = Thyra::createMember(get_x_space());
138 timeDer_->compute(x, x_dot);
140 MEB::InArgs<Scalar> appImplicitInArgs (wrapperImplicitInArgs_);
141 MEB::OutArgs<Scalar> appImplicitOutArgs(wrapperImplicitOutArgs_);
142 appImplicitInArgs.set_x(x);
143 appImplicitInArgs.set_x_dot(x_dot);
144 for (
int i=0; i<implicitModel_->Np(); ++i) {
145 if (inArgs.get_p(i) != Teuchos::null)
146 appImplicitInArgs.set_p(i, inArgs.get_p(i));
149 appImplicitOutArgs.set_f(outArgs.get_f());
150 appImplicitOutArgs.set_W_op(outArgs.get_W_op());
152 implicitModel_->evalModel(appImplicitInArgs,appImplicitOutArgs);
157 #endif // Tempus_ModelEvaluatorIMEXPair_Basic_impl_hpp
virtual Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getAppModel() const
Get the underlying application ModelEvaluator.
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int i) const
Get the g space.
virtual void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &in, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &out) const
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
virtual void initialize()
Initialize after setting member data.
virtual void setAppModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &me)
Set the underlying application ModelEvaluator.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int i) const
Get the p space.
virtual Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Get the x-solution space.