10 #ifndef Tempus_AuxiliaryIntegralModelEvaluator_impl_hpp
11 #define Tempus_AuxiliaryIntegralModelEvaluator_impl_hpp
15 #include "Thyra_VectorStdOps.hpp"
19 template <
typename Scalar>
25 t_interp_(Teuchos::ScalarTraits<Scalar>::rmax())
31 MEB::InArgs<Scalar> me_inArgs =
model_->createInArgs();
32 MEB::InArgsSetup<Scalar> inArgs;
33 inArgs.setModelEvalDescription(this->
description());
34 inArgs.setSupports(MEB::IN_ARG_x);
35 inArgs.setSupports(MEB::IN_ARG_t);
36 if (me_inArgs.supports(MEB::IN_ARG_x_dot))
37 inArgs.setSupports(MEB::IN_ARG_x_dot);
38 inArgs.setSupports(MEB::IN_ARG_alpha);
39 inArgs.setSupports(MEB::IN_ARG_beta);
40 inArgs.set_Np(me_inArgs.Np());
43 MEB::OutArgs<Scalar> me_outArgs =
model_->createOutArgs();
44 MEB::OutArgsSetup<Scalar> outArgs;
45 outArgs.setModelEvalDescription(this->
description());
46 outArgs.set_Np_Ng(me_inArgs.Np(), 0);
47 outArgs.setSupports(MEB::OUT_ARG_f);
48 outArgs.setSupports(MEB::OUT_ARG_W_op);
52 template <
typename Scalar>
58 forward_state_ = Teuchos::null;
61 template <
typename Scalar>
66 return model_->get_p_space(p);
69 template <
typename Scalar>
74 return model_->get_p_names(p);
77 template <
typename Scalar>
84 template <
typename Scalar>
91 template <
typename Scalar>
95 return Thyra::scaledIdentity(space_, Scalar(1.0));
98 template <
typename Scalar>
102 return Thyra::scaledIdentitySolveFactory(space_, Scalar(1.0));
105 template <
typename Scalar>
109 return prototypeInArgs_;
112 template <
typename Scalar>
118 using Teuchos::rcp_dynamic_cast;
120 MEB::InArgs<Scalar> me_nominal = model_->getNominalValues();
121 MEB::InArgs<Scalar> nominal = this->createInArgs();
126 RCP<Thyra::VectorBase<Scalar> > x = Thyra::createMember(*space_);
127 Thyra::assign(x.ptr(), zero);
130 if (me_nominal.supports(MEB::IN_ARG_x_dot)) {
131 RCP<Thyra::VectorBase<Scalar> > x_dot = Thyra::createMember(*space_);
132 Thyra::assign(x_dot.ptr(), zero);
133 nominal.set_x_dot(x_dot);
136 const int np = model_->Np();
137 for (
int i = 0; i < np; ++i) nominal.set_p(i, me_nominal.get_p(i));
142 template <
typename Scalar>
146 return prototypeOutArgs_;
149 template <
typename Scalar>
156 using Teuchos::rcp_dynamic_cast;
161 const Scalar t = inArgs.
get_t();
162 if (forward_state_ == Teuchos::null || t_interp_ != t) {
163 if (forward_state_ == Teuchos::null)
164 forward_state_ = sh_->interpolateState(t);
166 sh_->interpolateState(t, forward_state_.get());
171 RCP<Thyra::VectorBase<Scalar> > f = outArgs.
get_f();
172 if (f != Teuchos::null) {
173 MEB::InArgs<Scalar> me_inArgs = model_->getNominalValues();
174 me_inArgs.set_x(forward_state_->getX());
175 if (me_inArgs.supports(MEB::IN_ARG_x_dot))
176 me_inArgs.set_x_dot(forward_state_->getXDot());
177 if (me_inArgs.supports(MEB::IN_ARG_t)) me_inArgs.set_t(t);
178 const int np = me_inArgs.Np();
179 for (
int i = 0; i < np; ++i) me_inArgs.set_p(i, inArgs.
get_p(i));
181 MEB::OutArgs<Scalar> me_outArgs = model_->createOutArgs();
182 me_outArgs.set_g(g_index_, f);
184 model_->evalModel(me_inArgs, me_outArgs);
188 if (inArgs.
supports(MEB::IN_ARG_x_dot)) {
189 RCP<const Thyra::VectorBase<Scalar> > x_dot = inArgs.
get_x_dot();
190 if (x_dot != Teuchos::null) Thyra::V_VmV(f.ptr(), *x_dot, *f);
195 RCP<Thyra::LinearOpBase<Scalar> > op = outArgs.
get_W_op();
196 if (op != Teuchos::null) {
198 RCP<Thyra::ScaledIdentityLinearOpWithSolve<Scalar> > si_op =
Implicit concrete LinearOpBase subclass that takes a flattended out multi-vector and performs a multi...
AuxiliaryIntegralModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const int g_index)
Constructor.
void setScale(const Scalar &s)
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
RCP< const VectorBase< Scalar > > get_x_dot() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > prototypeInArgs_
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Evaluation< VectorBase< Scalar > > get_f() const
static magnitudeType rmax()
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
void setForwardSolutionHistory(const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &sh)
Set solution history from forward evaluation.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > space_
virtual std::string description() const
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int p) const
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Thyra::ModelEvaluatorBase::OutArgs< Scalar > prototypeOutArgs_
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int p) const
#define TEUCHOS_ASSERT(assertion_test)
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > model_
bool supports(EInArgsMembers arg) const
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
RCP< LinearOpBase< Scalar > > get_W_op() const
RCP< const VectorBase< Scalar > > get_p(int l) const