10 #ifndef Tempus_ModelEvaluatorIMEXPair_Basic_impl_hpp
11 #define Tempus_ModelEvaluatorIMEXPair_Basic_impl_hpp
13 #include "Thyra_ProductVectorBase.hpp"
14 #include "Thyra_ProductVectorSpaceBase.hpp"
18 template <
typename Scalar>
22 using Teuchos::rcp_const_cast;
28 MEB::InArgs<Scalar> inArgs = implicitModel_->getNominalValues();
31 if (inArgs.supports(MEB::IN_ARG_x_dot)) {
35 xDot_ = Teuchos::null;
40 !(explicitModel_->get_x_space()->isCompatible(
41 *(implicitModel_->get_x_space()))),
43 "Error - WrapperModelEvaluatorPairIMEX_Basic::initialize()\n"
44 <<
" Explicit and Implicit vector x spaces are incompatible!\n"
45 <<
" Explicit vector x space = "
46 << *(explicitModel_->get_x_space())
47 <<
"\n Implicit vector x space = "
48 << *(implicitModel_->get_x_space()) <<
"\n");
52 !(explicitModel_->get_f_space()->isCompatible(
53 *(implicitModel_->get_f_space()))),
55 "Error - WrapperModelEvaluatorPairIMEX_Basic::initialize()\n"
56 <<
" Explicit and Implicit vector f spaces are incompatible!\n"
57 <<
" Explicit vector f space = "
58 << *(explicitModel_->get_f_space())
59 <<
"\n Implicit vector f space = "
60 << *(implicitModel_->get_f_space()) <<
"\n");
63 template <
typename Scalar>
68 true, std::logic_error,
69 "Error - WrapperModelEvaluatorPairIMEX_Basic<Scalar>::setAppModel\n"
70 " should not be used. One should instead use setExplicitModel,\n"
71 " setImplicitModel, or create a new WrapperModelEvaluatorPairIMEX.\n");
74 template <
typename Scalar>
79 true, std::logic_error,
80 "Error - WrapperModelEvaluatorPairIMEX_Basic<Scalar>::getAppModel\n"
81 " should not be used. One should instead use getExplicitModel,\n"
82 " getImplicitModel, or directly use this WrapperModelEvaluatorPairIMEX\n"
86 template <
typename Scalar>
90 return this->implicitModel_->get_x_space();
93 template <
typename Scalar>
97 return this->implicitModel_->get_g_space(i);
100 template <
typename Scalar>
104 return this->implicitModel_->get_p_space(i);
107 template <
typename Scalar>
112 MEB::InArgsSetup<Scalar> inArgs = this->createInArgs();
113 return std::move(inArgs);
116 template <
typename Scalar>
122 MEB::InArgsSetup<Scalar> inArgs(implicitModel_->getNominalValues());
125 if (y_ != Teuchos::null) inArgs.set_p(index_, y_);
126 if (inArgs.supports(MEB::IN_ARG_x_dot)) inArgs.set_x_dot(xDot_);
127 if (inArgs.supports(MEB::IN_ARG_t)) inArgs.set_t(time_);
128 if (inArgs.supports(MEB::IN_ARG_step_size))
129 inArgs.set_step_size(p_->timeStepSize_);
130 if (inArgs.supports(MEB::IN_ARG_alpha)) inArgs.set_alpha(p_->alpha_);
131 if (inArgs.supports(MEB::IN_ARG_beta)) inArgs.set_beta(p_->beta_);
132 if (inArgs.supports(MEB::IN_ARG_stage_number))
133 inArgs.set_stage_number(p_->stageNumber_);
135 inArgs.setModelEvalDescription(this->description());
136 return std::move(inArgs);
139 template <
typename Scalar>
144 MEB::OutArgsSetup<Scalar> outArgs(implicitModel_->createOutArgs());
145 outArgs.setModelEvalDescription(this->description());
146 return std::move(outArgs);
149 template <
typename Scalar>
157 RCP<const Thyra::VectorBase<Scalar> > x = inArgs.
get_x();
158 RCP<Thyra::VectorBase<Scalar> > x_dot = Thyra::createMember(get_x_space());
159 timeDer_->compute(x, x_dot);
161 MEB::InArgs<Scalar> appImplicitInArgs(inArgs);
162 MEB::OutArgs<Scalar> appImplicitOutArgs(outArgs);
163 appImplicitInArgs.set_x_dot(x_dot);
165 implicitModel_->evalModel(appImplicitInArgs, appImplicitOutArgs);
170 #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)
virtual Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
virtual void initialize()
Initialize after setting member data.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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< const VectorBase< Scalar > > get_x() const