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();
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");
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>
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>
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>
76 return this->implicitModel_->get_x_space();
79 template <
typename Scalar>
84 return this->implicitModel_->get_g_space(i);
87 template <
typename Scalar>
92 return this->implicitModel_->get_p_space(i);
95 template <
typename Scalar>
101 MEB::InArgsSetup<Scalar> inArgs = this->createInArgs();
102 return std::move(inArgs);
105 template <
typename Scalar>
112 MEB::InArgsSetup<Scalar> inArgs(implicitModel_->getNominalValues());
113 inArgs.setModelEvalDescription(this->description());
114 return std::move(inArgs);
117 template <
typename Scalar>
123 MEB::OutArgsSetup<Scalar> outArgs(implicitModel_->createOutArgs());
124 outArgs.setModelEvalDescription(this->description());
125 return std::move(outArgs);
128 template <
typename Scalar>
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
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Evaluation< VectorBase< Scalar > > get_f() 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.
RCP< LinearOpBase< Scalar > > get_W_op() const
RCP< const VectorBase< Scalar > > get_x() const
RCP< const VectorBase< Scalar > > get_p(int l) const