10 #ifndef THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
11 #define THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
14 #include "Thyra_ModelEvaluatorBase_decl.hpp"
15 #include "Thyra_MultiVectorBase.hpp"
16 #include "Thyra_VectorBase.hpp"
17 #include "Thyra_MultiVectorStdOps.hpp"
18 #include "Thyra_VectorStdOps.hpp"
24 namespace ModelEvaluatorHelperPack {
27 template<
class Scalar>
29 RCP<const Thyra::VectorBase<Scalar> >
36 return vec->clone_v();
40 template<
class Scalar>
42 RCP<const Thyra::MultiVectorBase<Scalar> >
49 return vec->clone_mv();
54 RCP<const Stokhos::ProductEpetraVector >
56 const RCP<const Stokhos::ProductEpetraVector > &vec,
62 printf(
"Warning: clone_v not implemented for ProductEpetraVector: %s %d\n",__FILE__,__LINE__);
76 template<
class Scalar>
78 :modelEvalDescription_(
"WARNING! THIS INARGS OBJECT IS UNINITIALIZED!")
86 step_size_ = ST::zero();
87 stage_number_ = ST::one();
91 template<
class Scalar>
95 template<
class Scalar>
97 {
return g_multiplier_.size(); }
99 template<
class Scalar>
104 ,
"model = \'"<<modelEvalDescription_
105 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
107 return supports_[arg];
110 template<
class Scalar>
114 return supports_p_mp_[l];
117 template<
class Scalar>
123 template<
class Scalar>
128 template<
class Scalar>
135 template<
class Scalar>
141 template<
class Scalar>
145 { assert_supports(
IN_ARG_x); x_ = x; }
148 template<
class Scalar>
151 { assert_supports(
IN_ARG_x);
return x_; }
154 template<
class Scalar>
158 { assert_supports(
IN_ARG_x); x_direction_ = x_direction; }
161 template<
class Scalar>
165 { assert_l(l); p_direction_[l] = p_direction_l; }
168 template<
class Scalar>
171 { assert_supports(
IN_ARG_x);
return x_direction_; }
174 template<
class Scalar>
177 { assert_l(l);
return p_direction_[l]; }
180 template<
class Scalar>
187 template<
class Scalar>
193 template<
class Scalar>
200 template<
class Scalar>
205 template<
class Scalar>
209 { assert_supports(
IN_ARG_x); f_multiplier_ = f_multiplier; }
211 template<
class Scalar>
214 { assert_supports(
IN_ARG_x);
return f_multiplier_; }
216 template<
class Scalar>
223 g_multiplier_[j] = g_multiplier;
226 template<
class Scalar>
232 return g_multiplier_[j];
235 #ifdef HAVE_THYRA_ME_POLYNOMIAL
237 template<
class Scalar>
244 template<
class Scalar>
250 template<
class Scalar>
251 void ModelEvaluatorBase::InArgs<Scalar>::set_x_poly(
257 template<
class Scalar>
258 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
259 ModelEvaluatorBase::InArgs<Scalar>::get_x_poly()
const
263 #endif // HAVE_THYRA_ME_POLYNOMIAL
265 template<
class Scalar>
269 { assert_l(l); p_[l] = p_l; }
272 template<
class Scalar>
275 { assert_l(l);
return p_[l]; }
278 template<
class Scalar>
282 { assert_supports(
IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; }
284 template<
class Scalar>
287 { assert_supports(
IN_ARG_p_mp, l);
return p_mp_[l]; }
290 template<
class Scalar>
292 { assert_supports(
IN_ARG_t); t_ = t; }
295 template<
class Scalar>
298 { assert_supports(
IN_ARG_t);
return t_; }
301 template<
class Scalar>
306 template<
class Scalar>
311 template<
class Scalar>
316 template<
class Scalar>
320 template<
class Scalar>
325 template<
class Scalar>
329 template<
class Scalar>
333 template<
class Scalar>
337 template<
class Scalar>
342 template<
class Scalar>
347 template<
class Scalar>
349 const InArgs<Scalar>& inArgs,
bool ignoreUnsupported,
bool cloneObjects
352 using ModelEvaluatorHelperPack::condCloneVec;
353 using ModelEvaluatorHelperPack::condCloneMultiVec;
354 using ModelEvaluatorHelperPack::condCloneVec_mp;
357 set_x_dot_dot(condCloneVec(inArgs.
get_x_dot_dot(),cloneObjects));
361 set_x_dot(condCloneVec(inArgs.
get_x_dot(),cloneObjects));
365 set_x_dot_mp(condCloneVec_mp(inArgs.
get_x_dot_mp(),cloneObjects));
368 if(supports(
IN_ARG_x) || !ignoreUnsupported)
369 set_x(condCloneVec(inArgs.
get_x(),cloneObjects));
373 set_x_mp(condCloneVec_mp(inArgs.
get_x_mp(),cloneObjects));
376 if(supports(
IN_ARG_x) || !ignoreUnsupported)
377 set_x_direction(condCloneMultiVec(inArgs.
get_x_direction(),cloneObjects));
380 if(supports(
IN_ARG_x) || !ignoreUnsupported)
383 const int min_Ng = TEUCHOS_MIN(this->Ng(),inArgs.
Ng());
384 for (
int j = 0; j < min_Ng; ++j) {
388 #ifdef HAVE_THYRA_ME_POLYNOMIAL
392 cloneObjects &&
"Have not implemented cloning for x_dot_poly yet!" );
393 set_x_dot_poly(inArgs.get_x_dot_poly());
399 cloneObjects &&
"Have not implemented cloning for x_poly yet!" );
400 set_x_poly(inArgs.get_x_poly());
403 #endif // HAVE_THYRA_ME_POLYNOMIAL
404 const int min_Np = TEUCHOS_MIN(this->Np(),inArgs.
Np());
405 for (
int l = 0; l < min_Np; ++l) {
407 set_p(l,condCloneVec(inArgs.
get_p(l),cloneObjects));
409 for (
int l = 0; l < min_Np; ++l) {
411 set_p_direction(l,condCloneMultiVec(inArgs.
get_p_direction(l),cloneObjects));
413 for (
int l = 0; l < min_Np; ++l) {
415 if (
nonnull(inArgs.get_p_mp(l)))
416 set_p_mp(l,condCloneVec_mp(inArgs.get_p_mp(l),cloneObjects));
420 if(supports(
IN_ARG_t) || !ignoreUnsupported)
421 set_t(inArgs.
get_t());
444 if (extended_inargs_.size() > 0)
447 "Extended InArgs does not support cloning!");
448 this->extended_inargs_ = inArgs.extended_inargs_;
452 template<
class Scalar>
459 const std::string inArg_name =
toString(inArg_arg);
461 supports(inArg_arg) != inArgs.
supports(inArg_arg), std::logic_error,
462 "Error, the input argument "<<inArg_name<<
" with support "<<inArgs.
supports(inArg_arg)<<
"\n"
463 "in the InArgs object for the model:\n\n"
465 "is not the same the argument "<<inArg_name<<
" with support "<<supports(inArg_arg)<<
"\n"
466 "in the InArgs object for the model:\n\n"
467 " "<<modelEvalDescription()<<
"\n\n"
468 "and these two InArgs objects are not compatible!"
475 template<
class Scalar>
478 return modelEvalDescription_;
482 template<
class Scalar>
486 std::ostringstream oss;
488 <<
"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<
">"
490 <<
"model="<<modelEvalDescription_
497 template<
class Scalar>
505 using Teuchos::describe;
524 *out <<
"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<
">:\n";
527 *out <<
"model = " << modelEvalDescription_ <<
"\n";
528 *out <<
"Np = " << Np() <<
"\n";
532 *out <<
"x_dot_dot = " << Teuchos::describe(*x_dot_dot,x_verbLevel);
534 *out <<
"||x_dot_dot|| = " << norm(*x_dot_dot) << endl;
539 *out <<
"x_dot = " << Teuchos::describe(*x_dot,x_verbLevel);
541 *out <<
"||x_dot|| = " << norm(*x_dot) << endl;
546 *out <<
"x = " << Teuchos::describe(*x,x_verbLevel);
548 *out <<
"||x|| = " << norm(*x) << endl;
552 for(
int l = 0; l < Np(); ++l ) {
554 if ( !
is_null(p_l = this->get_p(l)) ) {
555 *out <<
"p("<<l<<
") = " << Teuchos::describe(*p_l,p_verbLevel);
557 *out <<
"||p("<<l<<
")|| = " << norm(*p_l) << endl;
564 *out <<
"t = " << t_ << endl;
567 *out <<
"alpha = " << alpha_ << endl;
570 *out <<
"beta = " << beta_ << endl;
573 *out <<
"W_x_dot_dot_coeff = " << W_x_dot_dot_coeff_ << endl;
576 *out <<
"step_size = " << step_size_ << endl;
579 *out <<
"stage_number = " << stage_number_ << endl;
586 template<
class Scalar>
588 const std::string &modelEvalDescription_in
591 modelEvalDescription_ = modelEvalDescription_in;
595 template<
class Scalar>
599 p_direction_.resize(Np_in);
601 supports_p_mp_.resize(Np_in);
602 g_multiplier_.resize(Ng_in);
606 template<
class Scalar>
613 ,
"model = \'"<<modelEvalDescription_
614 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!");
615 supports_[arg] = supports_in;
618 template<
class Scalar>
624 supports_p_mp_[l] = supports_in;
628 template<
class Scalar>
634 &inArgs.supports_[0],
636 this->_set_Np_Ng( Np_in >= 0 ? Np_in : inArgs.
Np(), inArgs.
Ng() );
640 template<
class Scalar>
659 true ,std::logic_error,
660 "Error, can not handle args other than IN_ARG_x yet!"
663 this->_setSupports(arg,
false);
667 template<
class Scalar>
673 !supports_[arg], std::logic_error
674 ,
"Thyra::ModelEvaluatorBase::InArgs<"
676 "model = \'"<<modelEvalDescription_<<
"\': Error, "
677 "The argument arg = " <<
toString(arg) <<
" is not supported!"
681 template<
class Scalar>
688 !supports_p_mp_[l], std::logic_error
689 ,
"Thyra::ModelEvaluatorBase::InArgs<"
691 "model = \'"<<modelEvalDescription_<<
"\': Error, "
692 "The argument p_mp(l) with index l = " << l <<
" is not supported!"
697 template<
class Scalar>
698 void ModelEvaluatorBase::InArgs<Scalar>::assert_l(
int l)
const
701 !( 0 <= l && l < Np() ), std::logic_error
702 ,
"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_l(l):\n\n"
703 " model = \'"<<modelEvalDescription_<<
"\':\n\n"
704 "Error, The parameter l = " << l <<
" is not in the range [0,"<<Np()<<
")!"
708 template<
class Scalar>
709 void ModelEvaluatorBase::InArgs<Scalar>::assert_j(
int j)
const
712 !( 0 <= j && j < Ng() ), std::logic_error
713 ,
"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_j(j):\n\n"
714 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
715 "Error, The auxiliary function g("<<j<<
")"
716 " is not in the range [0,"<<Ng()<<
")!"
725 template<
class Scalar>
729 std::ostringstream oss;
730 oss <<
"DerivativeMultiVector{";
731 if (
is_null(getMultiVector())) {
736 <<
"multiVec=" << getMultiVector()->description()
737 <<
",orientation=" <<
toString(getOrientation());
744 template<
class Scalar>
750 using Teuchos::describe;
752 out <<
"DerivativeMultiVector\n";
756 <<
describe(*getMultiVector(),verbLevel)
758 <<
toString(getOrientation()) << endl;
775 template<
class Scalar>
780 std::ostringstream oss;
781 oss <<
"Derivative{";
785 else if (!
is_null(getLinearOp())) {
786 oss <<
"linearOp=" << getLinearOp()->description();
789 oss <<
"derivMultiVec=" << getDerivativeMultiVector().description();
796 template<
class Scalar>
802 using Teuchos::describe;
804 out <<
"Derivative:";
808 else if (!
is_null(getLinearOp())) {
811 <<
"linearOp = " <<
describe(*getLinearOp(),verbLevel);
816 <<
"derivMultiVec = ";
817 getDerivativeMultiVector().describe(out,verbLevel);
827 template<
class Scalar>
829 :modelEvalDescription_(
"WARNING! THIS OUTARGS OBJECT IS UNINITIALIZED!"),
833 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
834 this->_setHessianSupports(
false);
839 template<
class Scalar>
841 {
return DfDp_.size(); }
844 template<
class Scalar>
846 {
return g_.size(); }
849 template<
class Scalar>
856 ,
"model = \'"<<modelEvalDescription_
857 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
859 return supports_[arg];
863 template<
class Scalar>
870 return supports_DfDp_[l];
874 template<
class Scalar>
881 return supports_DgDx_dot_[j];
885 template<
class Scalar>
892 return supports_DgDx_[j];
896 template<
class Scalar>
904 return supports_DgDp_[ j*Np() + l ];
908 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
910 template<
class Scalar>
912 EOutArgs_hess_vec_prod_f_xx
915 return supports_hess_vec_prod_f_xx_;
918 template<
class Scalar>
920 EOutArgs_hess_vec_prod_f_xp ,
int l
924 return supports_hess_vec_prod_f_xp_[l];
927 template<
class Scalar>
929 EOutArgs_hess_vec_prod_f_px ,
int l
933 return supports_hess_vec_prod_f_px_[l];
936 template<
class Scalar>
938 EOutArgs_hess_vec_prod_f_pp ,
int l1,
int l2
943 return supports_hess_vec_prod_f_pp_[ l1*Np() + l2 ];
946 template<
class Scalar>
948 EOutArgs_hess_vec_prod_g_xx ,
int j
952 return supports_hess_vec_prod_g_xx_[j];
955 template<
class Scalar>
957 EOutArgs_hess_vec_prod_g_xp ,
int j,
int l
962 return supports_hess_vec_prod_g_xp_[ j*Np() + l ];
965 template<
class Scalar>
967 EOutArgs_hess_vec_prod_g_px ,
int j,
int l
972 return supports_hess_vec_prod_g_px_[ j*Np() + l ];
975 template<
class Scalar>
977 EOutArgs_hess_vec_prod_g_pp ,
int j,
int l1,
int l2
983 return supports_hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
986 template<
class Scalar>
991 return supports_hess_f_xx_;
994 template<
class Scalar>
996 EOutArgs_hess_f_xp ,
int l
1000 return supports_hess_f_xp_[l];
1003 template<
class Scalar>
1005 EOutArgs_hess_f_pp ,
int l1,
int l2
1010 return supports_hess_f_pp_[ l1*Np() + l2 ];
1013 template<
class Scalar>
1018 return supports_H_xx_;
1021 template<
class Scalar>
1023 EOutArgs_H_xp ,
int l
1027 return supports_H_xp_[l];
1030 template<
class Scalar>
1032 EOutArgs_H_pp ,
int l1,
int l2
1037 return supports_H_pp_[ l1*Np() + l2 ];
1040 template<
class Scalar>
1042 EOutArgs_hess_g_xx ,
int j
1046 return supports_hess_g_xx_[j];
1049 template<
class Scalar>
1051 EOutArgs_hess_g_xp ,
int j,
int l
1056 return supports_hess_g_xp_[ j*Np() + l ];
1059 template<
class Scalar>
1061 EOutArgs_hess_g_pp ,
int j,
int l1,
int l2
1067 return supports_hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1070 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
1073 template<
class Scalar>
1080 return supports_g_mp_[j];
1083 template<
class Scalar>
1084 const ModelEvaluatorBase::DerivativeSupport&
1090 return supports_DfDp_mp_[l];
1094 template<
class Scalar>
1095 const ModelEvaluatorBase::DerivativeSupport&
1101 return supports_DgDx_dot_mp_[j];
1105 template<
class Scalar>
1106 const ModelEvaluatorBase::DerivativeSupport&
1112 return supports_DgDx_mp_[j];
1116 template<
class Scalar>
1117 const ModelEvaluatorBase::DerivativeSupport&
1124 return supports_DgDp_mp_[ j*Np() + l ];
1129 template<
class Scalar>
1139 template<
class Scalar>
1148 template<
class Scalar>
1158 template<
class Scalar>
1167 template<
class Scalar>
1177 template<
class Scalar>
1186 template<
class Scalar>
1196 template<
class Scalar>
1205 template<
class Scalar>
1215 template<
class Scalar>
1224 template<
class Scalar>
1234 template<
class Scalar>
1243 template<
class Scalar>
1253 template<
class Scalar>
1262 template<
class Scalar>
1272 template<
class Scalar>
1281 template<
class Scalar>
1286 return W_properties_;
1290 template<
class Scalar>
1300 template<
class Scalar>
1309 template<
class Scalar>
1314 return DfDp_properties_[l];
1318 template<
class Scalar>
1324 DfDp_mp_[l] = DfDp_mp_l;
1328 template<
class Scalar>
1337 template<
class Scalar>
1338 ModelEvaluatorBase::DerivativeProperties
1339 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp_mp_properties(
int l)
const
1342 return DfDp_mp_properties_[l];
1346 template<
class Scalar>
1352 DgDx_dot_[j] = DgDx_dot_j;
1356 template<
class Scalar>
1361 return DgDx_dot_[j];
1365 template<
class Scalar>
1370 return DgDx_dot_properties_[j];
1374 template<
class Scalar>
1380 DgDx_dot_mp_[j] = DgDx_dot_mp_j;
1384 template<
class Scalar>
1389 return DgDx_dot_mp_[j];
1393 template<
class Scalar>
1394 ModelEvaluatorBase::DerivativeProperties
1395 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot_mp_properties(
int j)
const
1398 return DgDx_dot_mp_properties_[j];
1402 template<
class Scalar>
1412 template<
class Scalar>
1421 template<
class Scalar>
1426 return DgDx_properties_[j];
1430 template<
class Scalar>
1436 DgDx_mp_[j] = DgDx_mp_j;
1440 template<
class Scalar>
1449 template<
class Scalar>
1450 ModelEvaluatorBase::DerivativeProperties
1451 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_mp_properties(
int j)
const
1454 return DgDx_mp_properties_[j];
1458 template<
class Scalar>
1464 DgDp_[ j*Np() + l ] = DgDp_j_l;
1468 template<
class Scalar>
1473 return DgDp_[ j*Np() + l ];
1477 template<
class Scalar>
1482 return DgDp_properties_[ j*Np() + l ];
1486 template<
class Scalar>
1492 DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l;
1496 template<
class Scalar>
1501 return DgDp_mp_[ j*Np() + l ];
1505 template<
class Scalar>
1506 ModelEvaluatorBase::DerivativeProperties
1507 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp_mp_properties(
int j,
int l)
const
1510 return DgDp_mp_properties_[ j*Np() + l ];
1514 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
1516 template<
class Scalar>
1517 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_xx(
1518 const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_xx
1521 assert_supports(OUT_ARG_hess_vec_prod_f_xx);
1522 hess_vec_prod_f_xx_ = hess_vec_prod_f_xx;
1525 template<
class Scalar>
1526 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_xp(
1527 int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_xp_l
1530 assert_supports(OUT_ARG_hess_vec_prod_f_xp,l);
1531 hess_vec_prod_f_xp_[l] = hess_vec_prod_f_xp_l;
1534 template<
class Scalar>
1535 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_px(
1536 int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_px_l
1539 assert_supports(OUT_ARG_hess_vec_prod_f_px,l);
1540 hess_vec_prod_f_px_[l] = hess_vec_prod_f_px_l;
1543 template<
class Scalar>
1544 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_pp(
1545 int l1,
int l2,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_pp_l1_l2
1548 assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2);
1549 hess_vec_prod_f_pp_[ l1*Np() + l2 ] = hess_vec_prod_f_pp_l1_l2;
1552 template<
class Scalar>
1553 RCP<MultiVectorBase<Scalar> >
1554 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_xx()
const
1556 assert_supports(OUT_ARG_hess_vec_prod_f_xx);
1557 return hess_vec_prod_f_xx_;
1560 template<
class Scalar>
1561 RCP<MultiVectorBase<Scalar> >
1562 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_xp(
int l)
const
1564 assert_supports(OUT_ARG_hess_vec_prod_f_xp,l);
1565 return hess_vec_prod_f_xp_[l];
1568 template<
class Scalar>
1569 RCP<MultiVectorBase<Scalar> >
1570 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_px(
int l)
const
1572 assert_supports(OUT_ARG_hess_vec_prod_f_px,l);
1573 return hess_vec_prod_f_px_[l];
1576 template<
class Scalar>
1577 RCP<MultiVectorBase<Scalar> >
1578 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_pp(
int l1,
int l2)
const
1580 assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2);
1581 return hess_vec_prod_f_pp_[ l1*Np() + l2 ];
1585 template<
class Scalar>
1586 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_xx(
1587 int j,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_xx_j
1590 assert_supports(OUT_ARG_hess_vec_prod_g_xx,j);
1591 hess_vec_prod_g_xx_[j] = hess_vec_prod_g_xx_j;
1594 template<
class Scalar>
1595 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_xp(
1596 int j,
int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_xp_j_l
1599 assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l);
1600 hess_vec_prod_g_xp_[ j*Np() + l ] = hess_vec_prod_g_xp_j_l;
1603 template<
class Scalar>
1604 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_px(
1605 int j,
int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_px_j_l
1608 assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l);
1609 hess_vec_prod_g_px_[ j*Np() + l ] = hess_vec_prod_g_px_j_l;
1612 template<
class Scalar>
1613 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_pp(
1614 int j,
int l1,
int l2,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_pp_j_l1_l2
1617 assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2);
1618 hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ] = hess_vec_prod_g_pp_j_l1_l2;
1621 template<
class Scalar>
1622 RCP<MultiVectorBase<Scalar> >
1623 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_xx(
int j)
const
1625 assert_supports(OUT_ARG_hess_vec_prod_g_xx,j);
1626 return hess_vec_prod_g_xx_[j];
1629 template<
class Scalar>
1630 RCP<MultiVectorBase<Scalar> >
1631 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_xp(
int j,
int l)
const
1633 assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l);
1634 return hess_vec_prod_g_xp_[ j*Np() + l ];
1637 template<
class Scalar>
1638 RCP<MultiVectorBase<Scalar> >
1639 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_px(
int j,
int l)
const
1641 assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l);
1642 return hess_vec_prod_g_px_[ j*Np() + l ];
1645 template<
class Scalar>
1646 RCP<MultiVectorBase<Scalar> >
1647 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_pp(
int j,
int l1,
int l2)
const
1649 assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2);
1650 return hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1653 template<
class Scalar>
1654 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_xx(
1655 const RCP<LinearOpBase<Scalar> > &hess_f_xx
1658 assert_supports(OUT_ARG_hess_f_xx);
1659 hess_f_xx_ = hess_f_xx;
1662 template<
class Scalar>
1663 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_xp(
1664 int l,
const RCP<LinearOpBase<Scalar> > &hess_f_xp_l
1667 assert_supports(OUT_ARG_hess_f_xp,l);
1668 hess_f_xp_[l] = hess_f_xp_l;
1671 template<
class Scalar>
1672 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_pp(
1673 int l1,
int l2,
const RCP<LinearOpBase<Scalar> > &hess_f_pp_l1_l2
1676 assert_supports(OUT_ARG_hess_f_pp,l1,l2);
1677 hess_f_pp_[ l1*Np() + l2 ] = hess_f_pp_l1_l2;
1680 template<
class Scalar>
1681 RCP<LinearOpBase<Scalar> >
1682 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_xx()
const
1684 assert_supports(OUT_ARG_hess_f_xx);
1688 template<
class Scalar>
1689 RCP<LinearOpBase<Scalar> >
1690 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_xp(
int l)
const
1692 assert_supports(OUT_ARG_hess_f_xp,l);
1693 return hess_f_xp_[l];
1696 template<
class Scalar>
1697 RCP<LinearOpBase<Scalar> >
1698 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_pp(
int l1,
int l2)
const
1700 assert_supports(OUT_ARG_hess_f_pp,l1,l2);
1701 return hess_f_pp_[ l1*Np() + l2 ];
1704 template<
class Scalar>
1705 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_xx(
1706 int j,
const RCP<LinearOpBase<Scalar> > &hess_g_xx_j
1709 assert_supports(OUT_ARG_hess_g_xx,j);
1710 hess_g_xx_[j] = hess_g_xx_j;
1713 template<
class Scalar>
1714 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_xp(
1715 int j,
int l,
const RCP<LinearOpBase<Scalar> > &hess_g_xp_j_l
1718 assert_supports(OUT_ARG_hess_g_xp,j,l);
1719 hess_g_xp_[ j*Np() + l ] = hess_g_xp_j_l;
1722 template<
class Scalar>
1723 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_pp(
1724 int j,
int l1,
int l2,
const RCP<LinearOpBase<Scalar> > &hess_g_pp_j_l1_l2
1727 assert_supports(OUT_ARG_hess_g_pp,j,l1,l2);
1728 hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ] = hess_g_pp_j_l1_l2;
1731 template<
class Scalar>
1732 RCP<LinearOpBase<Scalar> >
1733 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_xx(
int j)
const
1735 assert_supports(OUT_ARG_hess_g_xx,j);
1736 return hess_g_xx_[j];
1739 template<
class Scalar>
1740 RCP<LinearOpBase<Scalar> >
1741 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_xp(
int j,
int l)
const
1743 assert_supports(OUT_ARG_hess_g_xp,j,l);
1744 return hess_g_xp_[ j*Np() + l ];
1747 template<
class Scalar>
1748 RCP<LinearOpBase<Scalar> >
1749 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_pp(
int j,
int l1,
int l2)
const
1751 assert_supports(OUT_ARG_hess_g_pp,j,l1,l2);
1752 return hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1755 template<
class Scalar>
1756 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_xx(
1757 const RCP<LinearOpBase<Scalar> > &H_xx
1760 assert_supports(OUT_ARG_H_xx);
1764 template<
class Scalar>
1765 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_xp(
1766 int l,
const RCP<LinearOpBase<Scalar> > &H_xp_l
1769 assert_supports(OUT_ARG_H_xp,l);
1773 template<
class Scalar>
1774 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_pp(
1775 int l1,
int l2,
const RCP<LinearOpBase<Scalar> > &H_pp_l1_l2
1778 assert_supports(OUT_ARG_H_pp,l1,l2);
1779 H_pp_[ l1*Np() + l2 ] = H_pp_l1_l2;
1782 template<
class Scalar>
1783 RCP<LinearOpBase<Scalar> >
1784 ModelEvaluatorBase::OutArgs<Scalar>::get_H_xx()
const
1786 assert_supports(OUT_ARG_H_xx);
1790 template<
class Scalar>
1791 RCP<LinearOpBase<Scalar> >
1792 ModelEvaluatorBase::OutArgs<Scalar>::get_H_xp(
int l)
const
1794 assert_supports(OUT_ARG_H_xp,l);
1798 template<
class Scalar>
1799 RCP<LinearOpBase<Scalar> >
1800 ModelEvaluatorBase::OutArgs<Scalar>::get_H_pp(
int l1,
int l2)
const
1802 assert_supports(OUT_ARG_H_pp,l1,l2);
1803 return H_pp_[ l1*Np() + l2 ];
1806 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
1809 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1812 template<
class Scalar>
1813 void ModelEvaluatorBase::OutArgs<Scalar>::set_f_poly(
1821 template<
class Scalar>
1822 RCP<Teuchos::Polynomial< VectorBase<Scalar> > >
1823 ModelEvaluatorBase::OutArgs<Scalar>::get_f_poly()
const
1829 #endif // HAVE_THYRA_ME_POLYNOMIAL
1832 template<
class Scalar>
1838 const int min_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.
Np());
1839 const int min_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.
Ng());
1842 if ( supports(
OUT_ARG_f) || !ignoreUnsupported )
1843 set_f(inputOutArgs.
get_f());
1849 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1853 set_f_poly(inputOutArgs.get_f_poly());
1855 #endif // HAVE_THYRA_ME_POLYNOMIAL
1857 for (
int j = 0; j < min_Ng; ++j ) {
1859 set_g(j,inputOutArgs.
get_g(j));
1861 for (
int j = 0; j < min_Ng; ++j ) {
1864 set_g_mp(j,inputOutArgs.
get_g_mp(j));
1869 if ( supports(
OUT_ARG_W) || !ignoreUnsupported )
1870 set_W(inputOutArgs.
get_W());
1887 for (
int l = 0; l < min_Np; ++l ) {
1888 MEB::Derivative<Scalar> DfDp_l;
1890 && !(DfDp_l=inputOutArgs.
get_DfDp(l)).isEmpty() )
1892 if ( DfDp_l.isSupportedBy(supports(
OUT_ARG_DfDp,l)) || !ignoreUnsupported )
1896 for (
int l = 0; l < min_Np; ++l ) {
1897 MEB::MPDerivative DfDp_mp_l;
1899 && !(DfDp_mp_l=inputOutArgs.get_DfDp_mp(l)).isEmpty() )
1901 if ( DfDp_mp_l.isSupportedBy(supports(
OUT_ARG_DfDp_mp,l)) || !ignoreUnsupported )
1902 set_DfDp_mp(l,DfDp_mp_l);
1906 for (
int j = 0; j < min_Ng; ++j ) {
1908 MEB::Derivative<Scalar> DgDx_dot_j;
1910 && !(DgDx_dot_j=inputOutArgs.
get_DgDx_dot(j)).isEmpty() )
1912 if( DgDx_dot_j.isSupportedBy(supports(
OUT_ARG_DgDx_dot,j)) || !ignoreUnsupported )
1913 set_DgDx_dot(j,DgDx_dot_j);
1916 MEB::Derivative<Scalar> DgDx_j;
1918 && !(DgDx_j=inputOutArgs.
get_DgDx(j)).isEmpty() ) {
1919 if ( DgDx_j.isSupportedBy(supports(
OUT_ARG_DgDx,j)) || !ignoreUnsupported )
1923 for (
int j = 0; j < min_Ng; ++j ) {
1925 MEB::MPDerivative DgDx_dot_mp_j;
1927 && !(DgDx_dot_mp_j=inputOutArgs.get_DgDx_dot_mp(j)).isEmpty() )
1930 set_DgDx_dot_mp(j,DgDx_dot_mp_j);
1933 MEB::MPDerivative DgDx_mp_j;
1935 && !(DgDx_mp_j=inputOutArgs.get_DgDx_mp(j)).isEmpty() ) {
1936 if ( DgDx_mp_j.isSupportedBy(supports(
OUT_ARG_DgDx_mp,j)) || !ignoreUnsupported )
1937 set_DgDx_mp(j,DgDx_mp_j);
1941 for (
int l = 0; l < min_Np; ++l ) {
1942 for (
int j = 0; j < min_Ng; ++j ) {
1943 MEB::Derivative<Scalar> DgDp_j_l;
1945 && !(DgDp_j_l=inputOutArgs.
get_DgDp(j,l)).isEmpty() )
1947 if ( DgDp_j_l.isSupportedBy(supports(
OUT_ARG_DgDp,j,l)) || !ignoreUnsupported )
1948 set_DgDp(j,l,DgDp_j_l);
1952 for (
int l = 0; l < min_Np; ++l ) {
1953 for (
int j = 0; j < min_Ng; ++j ) {
1954 MEB::MPDerivative DgDp_mp_j_l;
1956 && !(DgDp_mp_j_l=inputOutArgs.get_DgDp_mp(j,l)).isEmpty() )
1958 if ( DgDp_mp_j_l.isSupportedBy(supports(
OUT_ARG_DgDp_mp,j,l)) || !ignoreUnsupported )
1959 set_DgDp_mp(j,l,DgDp_mp_j_l);
1964 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
1967 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_xx) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_xx()) ) {
1968 if ( supports(OUT_ARG_hess_vec_prod_f_xx) || !ignoreUnsupported )
1969 set_hess_vec_prod_f_xx(inputOutArgs.get_hess_vec_prod_f_xx());
1971 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
1972 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_xp,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_xp(l1)) ) {
1973 if ( supports(OUT_ARG_hess_vec_prod_f_xp,l1) || !ignoreUnsupported )
1974 set_hess_vec_prod_f_xp(l1,inputOutArgs.get_hess_vec_prod_f_xp(l1));
1976 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_px,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_px(l1)) ) {
1977 if ( supports(OUT_ARG_hess_vec_prod_f_px,l1) || !ignoreUnsupported )
1978 set_hess_vec_prod_f_px(l1,inputOutArgs.get_hess_vec_prod_f_px(l1));
1980 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
1981 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_pp(l1,l2)) ) {
1982 if ( supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2) || !ignoreUnsupported )
1983 set_hess_vec_prod_f_pp(l1,l2,inputOutArgs.get_hess_vec_prod_f_pp(l1,l2));
1989 for (
int j = 0; j < min_Ng; ++j ) {
1990 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_xx,j) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_xx(j)) ) {
1991 if ( supports(OUT_ARG_hess_vec_prod_g_xx,j) || !ignoreUnsupported )
1992 set_hess_vec_prod_g_xx(j,inputOutArgs.get_hess_vec_prod_g_xx(j));
1994 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
1995 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_xp,j,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_xp(j,l1)) ) {
1996 if ( supports(OUT_ARG_hess_vec_prod_g_xp,j,l1) || !ignoreUnsupported )
1997 set_hess_vec_prod_g_xp(j,l1,inputOutArgs.get_hess_vec_prod_g_xp(j,l1));
1999 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_px,j,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_px(j,l1)) ) {
2000 if ( supports(OUT_ARG_hess_vec_prod_g_px,j,l1) || !ignoreUnsupported )
2001 set_hess_vec_prod_g_px(j,l1,inputOutArgs.get_hess_vec_prod_g_px(j,l1));
2003 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2004 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_pp(j,l1,l2)) ) {
2005 if ( supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2) || !ignoreUnsupported )
2006 set_hess_vec_prod_g_pp(j,l1,l2,inputOutArgs.get_hess_vec_prod_g_pp(j,l1,l2));
2013 if( inputOutArgs.
supports(OUT_ARG_hess_f_xx) &&
nonnull(inputOutArgs.get_hess_f_xx()) ) {
2014 if ( supports(OUT_ARG_hess_f_xx) || !ignoreUnsupported )
2015 set_hess_f_xx(inputOutArgs.get_hess_f_xx());
2017 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2018 if( inputOutArgs.
supports(OUT_ARG_hess_f_xp,l1) &&
nonnull(inputOutArgs.get_hess_f_xp(l1)) ) {
2019 if ( supports(OUT_ARG_hess_f_xp,l1) || !ignoreUnsupported )
2020 set_hess_f_xp(l1,inputOutArgs.get_hess_f_xp(l1));
2022 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2023 if( inputOutArgs.
supports(OUT_ARG_hess_f_pp,l1,l2) &&
nonnull(inputOutArgs.get_hess_f_pp(l1,l2)) ) {
2024 if ( supports(OUT_ARG_hess_f_pp,l1,l2) || !ignoreUnsupported )
2025 set_hess_f_pp(l1,l2,inputOutArgs.get_hess_f_pp(l1,l2));
2031 for (
int j = 0; j < min_Ng; ++j ) {
2032 if( inputOutArgs.
supports(OUT_ARG_hess_g_xx,j) &&
nonnull(inputOutArgs.get_hess_g_xx(j)) ) {
2033 if ( supports(OUT_ARG_hess_g_xx,j) || !ignoreUnsupported )
2034 set_hess_g_xx(j,inputOutArgs.get_hess_g_xx(j));
2036 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2037 if( inputOutArgs.
supports(OUT_ARG_hess_g_xp,j,l1) &&
nonnull(inputOutArgs.get_hess_g_xp(j,l1)) ) {
2038 if ( supports(OUT_ARG_hess_g_xp,j,l1) || !ignoreUnsupported )
2039 set_hess_g_xp(j,l1,inputOutArgs.get_hess_g_xp(j,l1));
2041 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2042 if( inputOutArgs.
supports(OUT_ARG_hess_g_pp,j,l1,l2) &&
nonnull(inputOutArgs.get_hess_g_pp(j,l1,l2)) ) {
2043 if ( supports(OUT_ARG_hess_g_pp,j,l1,l2) || !ignoreUnsupported )
2044 set_hess_g_pp(j,l1,l2,inputOutArgs.get_hess_g_pp(j,l1,l2));
2051 if( inputOutArgs.
supports(OUT_ARG_H_xx) &&
nonnull(inputOutArgs.get_H_xx()) ) {
2052 if ( supports(OUT_ARG_H_xx) || !ignoreUnsupported )
2053 set_H_xx(inputOutArgs.get_H_xx());
2055 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2056 if( inputOutArgs.
supports(OUT_ARG_H_xp,l1) &&
nonnull(inputOutArgs.get_H_xp(l1)) ) {
2057 if ( supports(OUT_ARG_H_xp,l1) || !ignoreUnsupported )
2058 set_H_xp(l1,inputOutArgs.get_H_xp(l1));
2060 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2061 if( inputOutArgs.
supports(OUT_ARG_H_pp,l1,l2) &&
nonnull(inputOutArgs.get_H_pp(l1,l2)) ) {
2062 if ( supports(OUT_ARG_H_pp,l1,l2) || !ignoreUnsupported )
2063 set_H_pp(l1,l2,inputOutArgs.get_H_pp(l1,l2));
2068 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2071 this->extended_outargs_ = inputOutArgs.extended_outargs_;
2077 template<
class Scalar>
2083 assign(this->get_f().ptr(),ST::nan());
2085 for(
int j = 0; j < this->Ng(); ++j ) {
2087 assign(this->get_g(j).ptr(),ST::nan());
2093 template<
class Scalar>
2100 template<
class Scalar>
2109 for (
int l = 0; l < Np(); ++l ) {
2110 if (!DfDp_[l].isEmpty())
2113 #ifdef HAVE_THYRA_ME_POLYNOMIAL
2116 #endif // HAVE_THYRA_ME_POLYNOMIAL
2117 for (
int j = 0; j < Ng(); ++j ) {
2120 if (!DgDx_dot_[j].isEmpty())
2122 if (!DgDx_[j].isEmpty())
2124 for (
int l = 0; l < Np(); ++l ) {
2125 if (!DgDp_[j*Np()+l].isEmpty())
2133 template<
class Scalar>
2141 const std::string outArg_name =
toString(outArg_arg);
2143 supports(outArg_arg) != outArgs.
supports(outArg_arg), std::logic_error,
2144 "Error, the output argument "<<outArg_name<<
" with support "<<outArgs.
supports(outArg_arg)<<
"\n"
2145 "in the OutArgs object for the model:\n\n"
2147 "is not the same the argument "<<outArg_name<<
" with support "<<supports(outArg_arg)<<
"\n"
2148 "in the OutArgs object for the model:\n\n"
2149 " "<<modelEvalDescription()<<
"\n\n"
2150 "and these two OutArgs objects are not compatible!"
2154 const int l_Np = this->Np();
2155 const int l_Ng = this->Ng();
2160 for (
int l = 0; l < l_Np; ++l ) {
2164 "Error, the support for DfDp("<<l<<
") is not the same for the models\n\n"
2167 " "<<modelEvalDescription()<<
"\n\n"
2168 "and these two OutArgs objects are not compatible!"
2173 for (
int j = 0; j < l_Ng; ++j ) {
2177 "Error, the support for DgDx_dot("<<j<<
") is not the same for the models\n\n"
2180 " "<<modelEvalDescription()<<
"\n\n"
2181 "and these two OutArgs objects are not compatible!"
2186 "Error, the support for DgDx("<<j<<
") is not the same for the models\n\n"
2189 " "<<modelEvalDescription()<<
"\n\n"
2190 "and these two OutArgs objects are not compatible!"
2192 for (
int l = 0; l < l_Np; ++l ) {
2196 "Error, the support for DgDp("<<j<<
","<<l<<
") is not the same for the models\n\n"
2199 " "<<modelEvalDescription()<<
"\n\n"
2200 "and these two OutArgs objects are not compatible!"
2207 template<
class Scalar>
2210 return modelEvalDescription_;
2214 template<
class Scalar>
2218 std::ostringstream oss;
2220 <<
"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<
">"
2222 <<
"model="<<modelEvalDescription_
2230 template<
class Scalar>
2237 using Teuchos::describe;
2243 typedef MEB::Derivative<Scalar> Deriv;
2252 *out <<
"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<
">:\n";
2255 *out <<
"model = " << modelEvalDescription_ <<
"\n";
2256 *out <<
"Np = " << Np() <<
"\n";
2257 *out <<
"Ng = " << Ng() <<
"\n";
2261 *out <<
"f = " << Teuchos::describe(*f,verbLevel);
2264 for(
int j = 0; j < Ng(); ++j ) {
2266 if (!
is_null(g_j=this->get_g(j)))
2267 *out <<
"g("<<j<<
") = " << Teuchos::describe(*g_j,verbLevel);
2272 *out <<
"W = " << Teuchos::describe(*W,verbLevel);
2277 *out <<
"W_op = " << Teuchos::describe(*W_op,verbLevel);
2280 for(
int l = 0; l < Np(); ++l ) {
2284 && !(DfDp_l=get_DfDp(l)).isEmpty()
2287 *out <<
"DfDp("<<l<<
") = ";
2288 DfDp_l.describe(*out,verbLevel);
2292 for(
int j = 0; j < Ng(); ++j ) {
2297 && !(DgDx_dot_j=get_DgDx_dot(j)).isEmpty()
2300 *out <<
"DgDx_dot("<<j<<
") = ";
2301 DgDx_dot_j.describe(*out,verbLevel);
2307 && !(DgDx_j=get_DgDx(j)).isEmpty()
2310 *out <<
"DgDx("<<j<<
") = ";
2311 DgDx_j.describe(*out,verbLevel);
2314 for(
int l = 0; l < Np(); ++l ) {
2319 && !(DgDp_j_l=get_DgDp(j,l)).isEmpty()
2322 *out <<
"DgDp("<<j<<
","<<l<<
") = ";
2323 DgDp_j_l.describe(*out,verbLevel);
2337 template<
class Scalar>
2339 const std::string &modelEvalDescription_in
2342 modelEvalDescription_ = modelEvalDescription_in;
2345 template<
class Scalar>
2349 supports_DfDp_.resize(Np_in);
2351 DfDp_properties_.resize(Np_in); std::fill_n(DfDp_properties_.begin(),Np_in,
DerivativeProperties());
2353 supports_DfDp_mp_.resize(Np_in);
2354 DfDp_mp_.resize(Np_in); std::fill_n(DfDp_mp_.begin(),Np_in,
MPDerivative());
2355 DfDp_mp_properties_.resize(Np_in); std::fill_n(DfDp_mp_properties_.begin(),Np_in,
DerivativeProperties());
2358 g_.resize(Ng_in); std::fill_n(g_.begin(),Ng_in,Teuchos::null);
2359 supports_DgDx_dot_.resize(Ng_in);
2361 DgDx_dot_properties_.resize(Ng_in); std::fill_n(DgDx_dot_properties_.begin(),Ng_in,
DerivativeProperties());
2362 supports_DgDx_.resize(Ng_in);
2364 DgDx_properties_.resize(Ng_in); std::fill_n(DgDx_properties_.begin(),Ng_in,
DerivativeProperties());
2366 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2367 supports_hess_vec_prod_g_xx_.resize(Ng_in);
2370 supports_hess_g_xx_.resize(Ng_in);
2372 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2374 g_mp_.resize(Ng_in); std::fill_n(g_mp_.begin(),Ng_in,Teuchos::null);
2375 supports_g_mp_.resize(Ng_in);
2376 supports_DgDx_dot_mp_.resize(Ng_in);
2377 DgDx_dot_mp_.resize(Ng_in); std::fill_n(DgDx_dot_mp_.begin(),Ng_in,
MPDerivative());
2378 DgDx_dot_mp_properties_.resize(Ng_in); std::fill_n(DgDx_dot_mp_properties_.begin(),Ng_in,
DerivativeProperties());
2379 supports_DgDx_mp_.resize(Ng_in);
2380 DgDx_mp_.resize(Ng_in); std::fill_n(DgDx_mp_.begin(),Ng_in,
MPDerivative());
2381 DgDx_mp_properties_.resize(Ng_in); std::fill_n(DgDx_mp_properties_.begin(),Ng_in,
DerivativeProperties());
2383 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2385 const int Np = Np_in;
2386 const int NpNp = Np_in*Np_in;
2388 supports_hess_vec_prod_f_xp_.resize(Np);
2391 supports_hess_vec_prod_f_px_.resize(Np);
2394 supports_hess_vec_prod_f_pp_.resize(NpNp);
2397 supports_hess_f_xp_.resize(Np);
2400 supports_hess_f_pp_.resize(NpNp);
2403 supports_H_xp_.resize(Np);
2406 supports_H_pp_.resize(NpNp);
2409 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2410 if(Np_in && Ng_in) {
2411 const int NpNg = Np_in*Ng_in;
2412 const int NpNpNg = Np_in*Np_in*Ng_in;
2413 supports_DgDp_.resize(NpNg);
2415 DgDp_properties_.resize(NpNg); std::fill_n(DgDp_properties_.begin(),NpNg,
DerivativeProperties());
2417 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2418 supports_hess_vec_prod_g_xp_.resize(NpNg);
2421 supports_hess_vec_prod_g_px_.resize(NpNg);
2424 supports_hess_vec_prod_g_pp_.resize(NpNpNg);
2427 supports_hess_g_xp_.resize(NpNg);
2430 supports_hess_g_pp_.resize(NpNpNg);
2432 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2434 supports_DgDp_mp_.resize(NpNg);
2435 DgDp_mp_.resize(NpNg); std::fill_n(DgDp_mp_.begin(),NpNg,
MPDerivative());
2436 DgDp_mp_properties_.resize(NpNg); std::fill_n(DgDp_mp_properties_.begin(),NpNg,
DerivativeProperties());
2441 template<
class Scalar>
2447 ,
"model = \'"<<modelEvalDescription_
2448 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
2450 supports_[arg] = supports_in;
2454 template<
class Scalar>
2461 supports_DfDp_[l] = supports_in;
2465 template<
class Scalar>
2471 supports_DgDx_dot_[j] = supports_in;
2475 template<
class Scalar>
2481 supports_DgDx_[j] = supports_in;
2485 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2487 template<
class Scalar>
2489 EOutArgs_hess_vec_prod_f_xx ,
bool supports_in
2492 supports_hess_vec_prod_f_xx_ = supports_in;
2495 template<
class Scalar>
2497 EOutArgs_hess_vec_prod_f_xp ,
int l,
bool supports_in
2501 supports_hess_vec_prod_f_xp_[l] = supports_in;
2504 template<
class Scalar>
2506 EOutArgs_hess_vec_prod_f_px ,
int l,
bool supports_in
2510 supports_hess_vec_prod_f_px_[l] = supports_in;
2513 template<
class Scalar>
2515 EOutArgs_hess_vec_prod_f_pp ,
int l1,
int l2,
bool supports_in
2520 supports_hess_vec_prod_f_pp_[ l1*Np()+ l2 ] = supports_in;
2523 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2526 template<
class Scalar>
2533 supports_DgDp_[ j*Np()+ l ] = supports_in;
2537 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2539 template<
class Scalar>
2541 EOutArgs_hess_vec_prod_g_xx ,
int j,
bool supports_in
2545 supports_hess_vec_prod_g_xx_[j] = supports_in;
2548 template<
class Scalar>
2550 EOutArgs_hess_vec_prod_g_xp ,
int j,
int l,
bool supports_in
2555 supports_hess_vec_prod_g_xp_[ j*Np()+ l ] = supports_in;
2558 template<
class Scalar>
2560 EOutArgs_hess_vec_prod_g_px ,
int j,
int l,
bool supports_in
2565 supports_hess_vec_prod_g_px_[ j*Np()+ l ] = supports_in;
2568 template<
class Scalar>
2570 EOutArgs_hess_vec_prod_g_pp ,
int j,
int l1,
int l2,
bool supports_in
2576 supports_hess_vec_prod_g_pp_[ j*Np()*Np()+ l1*Np() + l2 ] = supports_in;
2580 template<
class Scalar>
2582 EOutArgs_hess_f_xx ,
bool supports_in
2585 supports_hess_f_xx_ = supports_in;
2588 template<
class Scalar>
2590 EOutArgs_hess_f_xp ,
int l,
bool supports_in
2594 supports_hess_f_xp_[l] = supports_in;
2597 template<
class Scalar>
2599 EOutArgs_hess_f_pp ,
int l1,
int l2,
bool supports_in
2604 supports_hess_f_pp_[ l1*Np()+ l2 ] = supports_in;
2607 template<
class Scalar>
2609 EOutArgs_hess_g_xx ,
int j,
bool supports_in
2613 supports_hess_g_xx_[j] = supports_in;
2616 template<
class Scalar>
2618 EOutArgs_hess_g_xp ,
int j,
int l,
bool supports_in
2623 supports_hess_g_xp_[ j*Np()+ l ] = supports_in;
2626 template<
class Scalar>
2628 EOutArgs_hess_g_pp ,
int j,
int l1,
int l2,
bool supports_in
2634 supports_hess_g_pp_[ j*Np()*Np()+ l1*Np() + l2 ] = supports_in;
2637 template<
class Scalar>
2639 EOutArgs_H_xx ,
bool supports_in
2642 supports_H_xx_ = supports_in;
2645 template<
class Scalar>
2647 EOutArgs_H_xp ,
int l,
bool supports_in
2651 supports_H_xp_[l] = supports_in;
2654 template<
class Scalar>
2656 EOutArgs_H_pp ,
int l1,
int l2,
bool supports_in
2661 supports_H_pp_[ l1*Np()+ l2 ] = supports_in;
2664 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2667 template<
class Scalar>
2674 supports_g_mp_[j] = supports_in;
2678 template<
class Scalar>
2685 supports_DfDp_mp_[l] = supports_in;
2689 template<
class Scalar>
2695 supports_DgDx_dot_mp_[j] = supports_in;
2699 template<
class Scalar>
2705 supports_DgDx_mp_[j] = supports_in;
2709 template<
class Scalar>
2716 supports_DgDp_mp_[ j*Np()+ l ] = supports_in;
2720 template<
class Scalar>
2725 W_properties_ = properties;
2729 template<
class Scalar>
2735 DfDp_properties_[l] = properties;
2739 template<
class Scalar>
2745 DgDx_dot_properties_[j] = properties;
2749 template<
class Scalar>
2755 DgDx_properties_[j] = properties;
2759 template<
class Scalar>
2765 DgDp_properties_[ j*Np()+ l ] = properties;
2769 template<
class Scalar>
2775 DfDp_mp_properties_[l] = properties;
2779 template<
class Scalar>
2781 int j,
const DerivativeProperties &properties
2785 DgDx_dot_mp_properties_[j] = properties;
2789 template<
class Scalar>
2790 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_mp_properties(
2791 int j,
const DerivativeProperties &properties
2795 DgDx_mp_properties_[j] = properties;
2799 template<
class Scalar>
2800 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDp_mp_properties(
2801 int j,
int l,
const DerivativeProperties &properties
2805 DgDp_mp_properties_[ j*Np()+ l ] = properties;
2809 template<
class Scalar>
2815 const int l_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.
Np());
2816 const int l_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.
Ng());
2818 &inputOutArgs.supports_[0],
2820 for(
int l = 0; l < l_Np; ++l ) {
2823 this->_setSupports(MEB::OUT_ARG_DfDp,l,ds);
2827 for(
int l = 0; l < l_Np; ++l ) {
2830 this->_setSupports(MEB::OUT_ARG_DfDp_mp,l,ds);
2831 this->_set_DfDp_mp_properties(l,inputOutArgs.get_DfDp_mp_properties(l));
2834 for(
int j = 0; j < l_Ng; ++j ) {
2836 this->_setSupports(MEB::OUT_ARG_DgDx_dot,j,ds);
2839 for(
int j = 0; j < l_Ng; ++j ) {
2841 this->_setSupports(MEB::OUT_ARG_DgDx_dot_mp,j,ds);
2842 if(!ds.
none()) this->_set_DgDx_dot_mp_properties(j,inputOutArgs.get_DgDx_dot_mp_properties(j));
2844 for(
int j = 0; j < l_Ng; ++j ) {
2846 this->_setSupports(MEB::OUT_ARG_DgDx,j,ds);
2849 for(
int j = 0; j < l_Ng; ++j ) {
2851 this->_setSupports(MEB::OUT_ARG_DgDx_mp,j,ds);
2852 if(!ds.
none()) this->_set_DgDx_mp_properties(j,inputOutArgs.get_DgDx_mp_properties(j));
2854 for(
int j = 0; j < l_Ng; ++j )
for(
int l = 0; l < l_Np; ++l ) {
2856 this->_setSupports(MEB::OUT_ARG_DgDp,j,l,ds);
2859 for(
int j = 0; j < l_Ng; ++j )
for(
int l = 0; l < l_Np; ++l ) {
2861 this->_setSupports(MEB::OUT_ARG_DgDp_mp,j,l,ds);
2862 if(!ds.
none()) this->_set_DgDp_mp_properties(j,l,inputOutArgs.get_DgDp_mp_properties(j,l));
2869 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2870 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xx,inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_xx));
2871 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2872 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1));
2873 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_px,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_f_px,l1));
2874 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2875 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2));
2878 for(
int j = 0; j < l_Ng; ++j ) {
2879 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xx,j,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_xx,j));
2880 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2881 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1));
2882 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1));
2883 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2884 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2));
2888 this->_setSupports(MEB::OUT_ARG_hess_f_xx,inputOutArgs.
supports(OUT_ARG_hess_f_xx));
2889 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2890 this->_setSupports(MEB::OUT_ARG_hess_f_xp,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_f_xp,l1));
2891 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2892 this->_setSupports(MEB::OUT_ARG_hess_f_pp,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_f_pp,l1,l2));
2895 for(
int j = 0; j < l_Ng; ++j ) {
2896 this->_setSupports(MEB::OUT_ARG_hess_g_xx,j,inputOutArgs.
supports(MEB::OUT_ARG_hess_g_xx,j));
2897 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2898 this->_setSupports(MEB::OUT_ARG_hess_g_xp,j,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_g_xp,j,l1));
2899 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2900 this->_setSupports(MEB::OUT_ARG_hess_g_pp,j,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_g_pp,j,l1,l2));
2904 this->_setSupports(MEB::OUT_ARG_H_xx,inputOutArgs.
supports(OUT_ARG_H_xx));
2905 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2906 this->_setSupports(MEB::OUT_ARG_H_xp,l1,inputOutArgs.
supports(MEB::OUT_ARG_H_xp,l1));
2907 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2908 this->_setSupports(MEB::OUT_ARG_H_pp,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_H_pp,l1,l2));
2911 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2913 extended_outargs_ = inputOutArgs.extended_outargs_;
2917 template<
class Scalar>
2924 const int l_Ng = this->Ng();
2925 for(
int j = 0; j < l_Ng; ++j ) {
2932 const int l_Ng = this->Ng();
2933 for(
int j = 0; j < l_Ng; ++j ) {
2941 true ,std::logic_error,
2942 "Error, can not handle args other than IN_ARG_x yet!"
2948 template<
class Scalar>
2958 const int l_Np = this->Np();
2959 for(
int l = 0; l < l_Np; ++l )
2967 const int l_Np = this->Np();
2968 for(
int l = 0; l < l_Np; ++l )
2974 true ,std::logic_error,
2975 "Error, can not handle args other than OUT_ARG_f yet!"
2978 this->_setSupports(arg,
false);
2981 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2982 template<
class Scalar>
2988 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xx,supports);
2989 this->_setSupports(MEB::OUT_ARG_hess_f_xx,supports);
2990 this->_setSupports(MEB::OUT_ARG_H_xx,supports);
2991 for (
int l1=0; l1<this->Np(); ++l1)
2993 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1,supports);
2994 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_px,l1,supports);
2995 this->_setSupports(MEB::OUT_ARG_hess_f_xp,l1,supports);
2996 this->_setSupports(MEB::OUT_ARG_H_xp,l1,supports);
2997 for (
int l2=0; l2<this->Np(); ++l2)
2999 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2,supports);
3000 this->_setSupports(MEB::OUT_ARG_hess_f_pp,l1,l2,supports);
3001 this->_setSupports(MEB::OUT_ARG_H_pp,l1,l2,supports);
3005 for (
int j=0; j<this->Ng(); ++j)
3007 this->_setSupports(MEB::OUT_ARG_hess_g_xx,j,supports);
3008 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xx,j,supports);
3009 for (
int l1=0; l1<this->Np(); ++l1)
3011 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1,supports);
3012 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1,supports);
3013 this->_setSupports(MEB::OUT_ARG_hess_g_xp,j,l1,supports);
3014 for (
int l2=0; l2<this->Np(); ++l2)
3016 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2,supports);
3017 this->_setSupports(MEB::OUT_ARG_hess_g_pp,j,l1,l2,supports);
3022 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3027 template<
class Scalar>
3028 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
EOutArgsMembers arg)
const
3031 !this->supports(arg), std::logic_error
3032 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(arg):\n\n"
3033 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3034 "Error, The argument arg = " <<
toString(arg) <<
" is not supported!"
3039 template<
class Scalar>
3040 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3041 EOutArgsDfDp arg,
int l,
const Derivative<Scalar> &deriv
3044 const DerivativeSupport derivSupport = this->supports(arg,l);
3046 !deriv.isSupportedBy(derivSupport), std::logic_error,
3047 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp,l):\n\n"
3048 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3049 "Error, The argument DfDp("<<l<<
") = " << deriv.description() <<
"\n"
3050 "is not supported!\n\n"
3051 "The supported types include " << derivSupport.description() <<
"!"
3056 template<
class Scalar>
3057 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3061 const DerivativeSupport derivSupport = this->supports(arg,j);
3063 !deriv.isSupportedBy(derivSupport), std::logic_error,
3064 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot,j):\n\n"
3065 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3066 "Error, The argument DgDx_dot("<<j<<
") = " << deriv.description() <<
"\n"
3067 "is not supported!\n\n"
3068 "The supported types include " << derivSupport.description() <<
"!"
3073 template<
class Scalar>
3074 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3075 EOutArgsDgDx arg,
int j,
const Derivative<Scalar> &deriv
3078 const DerivativeSupport derivSupport = this->supports(arg,j);
3080 !deriv.isSupportedBy(derivSupport), std::logic_error,
3081 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx,j):\n\n"
3082 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3083 "Error, The argument DgDx("<<j<<
") = " << deriv.description() <<
"\n"
3084 "is not supported!\n\n"
3085 "The supported types include " << derivSupport.description() <<
"!"
3090 template<
class Scalar>
3091 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3092 EOutArgsDgDp arg,
int j,
int l,
const Derivative<Scalar> &deriv
3095 const DerivativeSupport derivSupport = this->supports(arg,j,l);
3097 !deriv.isSupportedBy(derivSupport), std::logic_error,
3098 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp,j,l):\n\n"
3099 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3100 "Error, The argument DgDp("<<j<<
","<<l<<
") = " << deriv.description() <<
"\n"
3101 "is not supported!\n\n"
3102 "The supported types include " << derivSupport.description() <<
"!"
3107 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3109 template<
class Scalar>
3110 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3111 EOutArgs_hess_vec_prod_f_xx arg
3114 const bool support = this->supports(arg);
3116 !support, std::logic_error,
3117 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_xx):\n\n"
3118 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3119 "Error, The argument hess_vec_prod_f_xx() is not supported!"
3123 template<
class Scalar>
3124 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3125 EOutArgs_hess_vec_prod_f_xp arg,
int l
3128 const bool support = this->supports(arg,l);
3130 !support, std::logic_error,
3131 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_xp,l):\n\n"
3132 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3133 "Error, The argument hess_vec_prod_f_xp("<<l<<
") is not supported!"
3137 template<
class Scalar>
3138 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3139 EOutArgs_hess_vec_prod_f_px arg,
int l
3142 const bool support = this->supports(arg,l);
3144 !support, std::logic_error,
3145 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_px,l):\n\n"
3146 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3147 "Error, The argument hess_vec_prod_f_px("<<l<<
") is not supported!"
3151 template<
class Scalar>
3152 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3153 EOutArgs_hess_vec_prod_f_pp arg,
int l1,
int l2
3156 const bool support = this->supports(arg,l1,l2);
3158 !support, std::logic_error,
3159 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2):\n\n"
3160 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3161 "Error, The argument hess_vec_prod_f_pp("<<l1<<
","<<l2<<
") is not supported!"
3165 template<
class Scalar>
3166 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3167 EOutArgs_hess_vec_prod_g_xx arg,
int j
3170 const bool support = this->supports(arg,j);
3172 !support, std::logic_error,
3173 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_xx,j):\n\n"
3174 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3175 "Error, The argument hess_vec_prod_g_xx("<<j<<
") is not supported!"
3179 template<
class Scalar>
3180 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3181 EOutArgs_hess_vec_prod_g_xp arg,
int j,
int l
3184 const bool support = this->supports(arg,j,l);
3186 !support, std::logic_error,
3187 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l):\n\n"
3188 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3189 "Error, The argument hess_vec_prod_g_xp("<<j<<
","<<l<<
") is not supported!"
3193 template<
class Scalar>
3194 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3195 EOutArgs_hess_vec_prod_g_px arg,
int j,
int l
3198 const bool support = this->supports(arg,j,l);
3200 !support, std::logic_error,
3201 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l):\n\n"
3202 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3203 "Error, The argument hess_vec_prod_g_px("<<j<<
","<<l<<
") is not supported!"
3207 template<
class Scalar>
3208 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3209 EOutArgs_hess_vec_prod_g_pp arg,
int j,
int l1,
int l2
3212 const bool support = this->supports(arg,j,l1,l2);
3214 !support, std::logic_error,
3215 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2):\n\n"
3216 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3217 "Error, The argument hess_vec_prod_g_pp("<<j<<
","<<l1<<
","<<l2<<
") is not supported!"
3221 template<
class Scalar>
3222 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3223 EOutArgs_hess_f_xx arg
3226 const bool support = this->supports(arg);
3228 !support, std::logic_error,
3229 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_xx):\n\n"
3230 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3231 "Error, The argument hess_f_xx() is not supported!"
3235 template<
class Scalar>
3236 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3237 EOutArgs_hess_f_xp arg,
int l
3240 const bool support = this->supports(arg,l);
3242 !support, std::logic_error,
3243 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_xp,l):\n\n"
3244 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3245 "Error, The argument hess_f_xp() is not supported!"
3249 template<
class Scalar>
3250 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3251 EOutArgs_hess_f_pp arg,
int l1,
int l2
3254 const bool support = this->supports(arg,l1,l2);
3256 !support, std::logic_error,
3257 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_pp,l1,l2):\n\n"
3258 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3259 "Error, The argument hess_f_pp() is not supported!"
3263 template<
class Scalar>
3264 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3265 EOutArgs_hess_g_xx arg,
int j
3268 const bool support = this->supports(arg,j);
3270 !support, std::logic_error,
3271 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_xx,j):\n\n"
3272 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3273 "Error, The argument hess_g_xx() is not supported!"
3277 template<
class Scalar>
3278 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3279 EOutArgs_hess_g_xp arg,
int j,
int l
3282 const bool support = this->supports(arg,j,l);
3284 !support, std::logic_error,
3285 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_xp,j,l):\n\n"
3286 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3287 "Error, The argument hess_g_xp() is not supported!"
3291 template<
class Scalar>
3292 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3293 EOutArgs_hess_g_pp arg,
int j,
int l1,
int l2
3296 const bool support = this->supports(arg,j,l1,l2);
3298 !support, std::logic_error,
3299 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_pp,j,l1,l2):\n\n"
3300 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3301 "Error, The argument hess_g_pp() is not supported!"
3305 template<
class Scalar>
3306 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3310 const bool support = this->supports(arg);
3312 !support, std::logic_error,
3313 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_xx):\n\n"
3314 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3315 "Error, The argument H_xx() is not supported!"
3319 template<
class Scalar>
3320 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3321 EOutArgs_H_xp arg,
int l
3324 const bool support = this->supports(arg,l);
3326 !support, std::logic_error,
3327 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_xp,l):\n\n"
3328 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3329 "Error, The argument H_xp() is not supported!"
3333 template<
class Scalar>
3334 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3335 EOutArgs_H_pp arg,
int l1,
int l2
3338 const bool support = this->supports(arg,l1,l2);
3340 !support, std::logic_error,
3341 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_pp,l1,l2):\n\n"
3342 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3343 "Error, The argument H_pp() is not supported!"
3347 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3350 template<
class Scalar>
3351 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3357 !supports_g_mp_[j], std::logic_error,
3358 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_g_mp,j):\n\n"
3359 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3360 "Error, The argument g_mp("<<j<<
") \n"
3361 "is not supported!\n\n"
3366 template<
class Scalar>
3367 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3371 const DerivativeSupport derivSupport = this->supports(arg,l);
3373 !deriv.isSupportedBy(derivSupport), std::logic_error,
3374 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp_mp,l):\n\n"
3375 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3376 "Error, The argument DfDp_mp("<<l<<
") = " << deriv.description() <<
"\n"
3377 "is not supported!\n\n"
3378 "The supported types include " << derivSupport.description() <<
"!"
3383 template<
class Scalar>
3384 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3388 const DerivativeSupport derivSupport = this->supports(arg,j);
3390 !deriv.isSupportedBy(derivSupport), std::logic_error,
3391 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot_mp,j):\n\n"
3392 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3393 "Error, The argument DgDx_dot_mp("<<j<<
") = " << deriv.description() <<
"\n"
3394 "is not supported!\n\n"
3395 "The supported types include " << derivSupport.description() <<
"!"
3400 template<
class Scalar>
3401 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3405 const DerivativeSupport derivSupport = this->supports(arg,j);
3407 !deriv.isSupportedBy(derivSupport), std::logic_error,
3408 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_mp,j):\n\n"
3409 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3410 "Error, The argument DgDx_mp("<<j<<
") = " << deriv.description() <<
"\n"
3411 "is not supported!\n\n"
3412 "The supported types include " << derivSupport.description() <<
"!"
3417 template<
class Scalar>
3418 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3422 const DerivativeSupport derivSupport = this->supports(arg,j,l);
3424 !deriv.isSupportedBy(derivSupport), std::logic_error,
3425 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp_mp,j,l):\n\n"
3426 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3427 "Error, The argument DgDp_mp("<<j<<
","<<l<<
") = " << deriv.description() <<
"\n"
3428 "is not supported!\n\n"
3429 "The supported types include " << derivSupport.description() <<
"!"
3434 template<
class Scalar>
3435 void ModelEvaluatorBase::OutArgs<Scalar>::assert_l(
int l)
const
3438 !( 0 <= l && l < Np() ), std::logic_error
3439 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_l(l):\n\n"
3440 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3441 "Error, The parameter subvector p("<<l<<
")"
3442 " is not in the range [0,"<<Np()<<
")!"
3447 template<
class Scalar>
3448 void ModelEvaluatorBase::OutArgs<Scalar>::assert_j(
int j)
const
3451 !( 0 <= j && j < Ng() ), std::logic_error
3452 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_j(j):\n\n"
3453 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3454 "Error, The auxiliary function g("<<j<<
")"
3455 " is not in the range [0,"<<Ng()<<
")!"
3465 template<
class Scalar>
3470 template<
class Scalar>
3476 template<
class Scalar>
3478 const std::string &modelEvalDescription_in )
3480 this->_setModelEvalDescription(modelEvalDescription_in);
3484 template<
class Scalar>
3486 { this->_set_Np_Ng(Np_in, 0); }
3488 template<
class Scalar>
3490 { this->_set_Np_Ng(Np_in, Ng_in); }
3492 template<
class Scalar>
3494 { this->_setSupports(arg,supports_in); }
3497 template<
class Scalar>
3499 { this->_setSupports(arg,l,supports_in); }
3502 template<
class Scalar>
3507 this->_setSupports(inArgs, Np_in);
3511 template<
class Scalar>
3516 this->_setUnsupportsAndRelated(arg);
3525 template<
class Scalar>
3530 template<
class Scalar>
3534 :
OutArgs<Scalar>(inputOutArgs)
3538 template<
class Scalar>
3540 const std::string &modelEvalDescription_in
3542 { this->_setModelEvalDescription(modelEvalDescription_in); }
3545 template<
class Scalar>
3547 { this->_set_Np_Ng(Np_in, Ng_in); }
3550 template<
class Scalar>
3554 { this->_setSupports(arg,supports_in); }
3557 template<
class Scalar>
3561 { this->_setSupports(arg,l,supports_in); }
3564 template<
class Scalar>
3568 { this->_setSupports(arg,j,supports_in); }
3571 template<
class Scalar>
3575 { this->_setSupports(arg,j,supports_in); }
3578 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3580 template<
class Scalar>
3582 EOutArgs_hess_vec_prod_f_xx arg,
bool supports_in
3584 { this->_setSupports(arg,supports_in); }
3586 template<
class Scalar>
3588 EOutArgs_hess_vec_prod_f_xp arg,
int l,
bool supports_in
3590 { this->_setSupports(arg,l,supports_in); }
3592 template<
class Scalar>
3594 EOutArgs_hess_vec_prod_f_px arg,
int l,
bool supports_in
3596 { this->_setSupports(arg,l,supports_in); }
3598 template<
class Scalar>
3600 EOutArgs_hess_vec_prod_f_pp arg,
int l1,
int l2,
bool supports_in
3602 { this->_setSupports(arg,l1,l2,supports_in); }
3604 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3607 template<
class Scalar>
3611 { this->_setSupports(arg,j,l,supports_in); }
3614 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3616 template<
class Scalar>
3618 EOutArgs_hess_vec_prod_g_xx arg,
int j,
bool supports_in
3620 { this->_setSupports(arg,j,supports_in); }
3622 template<
class Scalar>
3624 EOutArgs_hess_vec_prod_g_xp arg,
int j,
int l,
bool supports_in
3626 { this->_setSupports(arg,j,l,supports_in); }
3628 template<
class Scalar>
3630 EOutArgs_hess_vec_prod_g_px arg,
int j,
int l,
bool supports_in
3632 { this->_setSupports(arg,j,l,supports_in); }
3634 template<
class Scalar>
3636 EOutArgs_hess_vec_prod_g_pp arg,
int j,
int l1,
int l2,
bool supports_in
3638 { this->_setSupports(arg,j,l1,l2,supports_in); }
3640 template<
class Scalar>
3642 EOutArgs_hess_f_xx arg,
bool supports_in
3644 { this->_setSupports(arg,supports_in); }
3646 template<
class Scalar>
3648 EOutArgs_hess_f_xp arg,
int l,
bool supports_in
3650 { this->_setSupports(arg,l,supports_in); }
3652 template<
class Scalar>
3654 EOutArgs_hess_f_pp arg,
int l1,
int l2,
bool supports_in
3656 { this->_setSupports(arg,l1,l2,supports_in); }
3658 template<
class Scalar>
3660 EOutArgs_hess_g_xx arg,
int j,
bool supports_in
3662 { this->_setSupports(arg,j,supports_in); }
3664 template<
class Scalar>
3666 EOutArgs_hess_g_xp arg,
int j,
int l,
bool supports_in
3668 { this->_setSupports(arg,j,l,supports_in); }
3670 template<
class Scalar>
3672 EOutArgs_hess_g_pp arg,
int j,
int l1,
int l2,
bool supports_in
3674 { this->_setSupports(arg,j,l1,l2,supports_in); }
3676 template<
class Scalar>
3678 EOutArgs_H_xx arg,
bool supports_in
3680 { this->_setSupports(arg,supports_in); }
3682 template<
class Scalar>
3684 EOutArgs_H_xp arg,
int l,
bool supports_in
3686 { this->_setSupports(arg,l,supports_in); }
3688 template<
class Scalar>
3690 EOutArgs_H_pp arg,
int l1,
int l2,
bool supports_in
3692 { this->_setSupports(arg,l1,l2,supports_in); }
3694 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3697 template<
class Scalar>
3701 { this->_setSupports(arg,j,supports_in); }
3704 template<
class Scalar>
3708 { this->_setSupports(arg,l,supports_in); }
3711 template<
class Scalar>
3715 { this->_setSupports(arg,j,supports_in); }
3718 template<
class Scalar>
3722 { this->_setSupports(arg,j,supports_in); }
3725 template<
class Scalar>
3727 EOutArgsDgDp_mp arg,
int j,
int l,
const DerivativeSupport& supports_in
3729 { this->_setSupports(arg,j,l,supports_in); }
3732 template<
class Scalar>
3736 { this->_set_W_properties(properties); }
3739 template<
class Scalar>
3743 { this->_set_DfDp_properties(l,properties); }
3746 template<
class Scalar>
3750 { this->_set_DgDx_dot_properties(j,properties); }
3753 template<
class Scalar>
3757 { this->_set_DgDx_properties(j,properties); }
3760 template<
class Scalar>
3764 { this->_set_DgDp_properties(j,l,properties); }
3767 template<
class Scalar>
3771 { this->_set_DfDp_mp_properties(l,properties); }
3774 template<
class Scalar>
3776 int j,
const DerivativeProperties &properties
3778 { this->_set_DgDx_dot_mp_properties(j,properties); }
3781 template<
class Scalar>
3782 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_mp_properties(
3783 int j,
const DerivativeProperties &properties
3785 { this->_set_DgDx_mp_properties(j,properties); }
3788 template<
class Scalar>
3789 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDp_mp_properties(
3790 int j,
int l,
const DerivativeProperties &properties
3792 { this->_set_DgDp_mp_properties(j,l,properties); }
3795 template<
class Scalar>
3799 { this->_setSupports(inputOutArgs); }
3802 template<
class Scalar>
3806 { this->_setUnsupportsAndRelated(arg); }
3809 template<
class Scalar>
3813 { this->_setUnsupportsAndRelated(arg); }
3816 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3817 template<
class Scalar>
3821 { this->_setHessianSupports(supports); }
3822 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3835 #define THYRA_MODEL_EVALUATOR_BASE_INSTANT(SCALAR) \
3837 template class ModelEvaluatorBase::InArgs<SCALAR >; \
3839 template std::string \
3840 ModelEvaluatorBase::Derivative<SCALAR >::description() const; \
3843 void ModelEvaluatorBase::Derivative<SCALAR >::describe( \
3844 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel \
3847 template class ModelEvaluatorBase::OutArgs<SCALAR >; \
3849 template class ModelEvaluatorBase::InArgsSetup<SCALAR >; \
3851 template class ModelEvaluatorBase::OutArgsSetup<SCALAR >;
3854 #endif // THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
int Ng() const
Return the number of axillary response functions g(j)(...) supported (Ng >= 0).
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Create a more detailed description along about this object and the ModelEvaluator that created it...
void set_DgDx_properties(int j, const DerivativeProperties &properties)
void _set_Np_Ng(int Np, int Ng)
void set_DfDp_properties(int l, const DerivativeProperties &properties)
Base class for all linear operators that can support a high-level solve operation.
bool is_null(const boost::shared_ptr< T > &p)
std::string toString(ModelEvaluatorBase::EInArgsMembers)
void set_step_size(Scalar step_size)
Precondition: supports(IN_ARG_step_size)==true.
Scalar get_beta() const
Precondition: supports(IN_ARG_beta)==true.
RCP< const VectorBase< Scalar > > get_f_multiplier() const
Precondition: supports(IN_ARG_x)==true.
RCP< Stokhos::ProductEpetraVector > get_g_mp(int j) const
Precondition: supports(OUT_ARG_g_mp)==true..
void set_x_dot_dot(const RCP< const VectorBase< Scalar > > &x_dot_dot)
Precondition: supports(IN_ARG_x_dot_dot)==true.
void setArgs(const OutArgs< Scalar > &outArgs, bool ignoreUnsupported=false)
Set all arguments fron outArgs into *this.
basic_OSTab< char > OSTab
bool supports() const
Determines if an extended input argument of type ObjectType is supported.
ScalarMag get_t() const
.Precondition: supports(IN_ARG_t)==true
static const int NUM_E_IN_ARGS_MEMBERS
void _set_DfDp_properties(int l, const DerivativeProperties &properties)
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...
Derivative< Scalar > get_DfDp(int l) const
Precondition: supports(OUT_ARG_DfDp,l)==true.
void set_g(int j, const Evaluation< VectorBase< Scalar > > &g_j)
Precondition: supports(OUT_ARG_g)==true.
RCP< const VectorBase< Scalar > > get_x_dot() const
Precondition: supports(IN_ARG_x_dot)==true.
std::string modelEvalDescription() const
static const int NUM_E_OUT_ARGS_MEMBERS
void setModelEvalDescription(const std::string &modelEvalDescription)
void set_W_mp(const RCP< Stokhos::ProductEpetraOperator > &W_mp)
Precondition: supports(OUT_ARG_W_mp)==true.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
void _set_DgDx_dot_properties(int j, const DerivativeProperties &properties)
void set_W_prec(const RCP< PreconditionerBase< Scalar > > &W_prec)
Precondition: supports(OUT_ARG_W_op)==true.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Create a more detailed description along about this object and the ModelEvaluator that created it...
void set_Np_Ng(int Np, int Ng)
void _setUnsupportsAndRelated(EInArgsMembers arg)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
void set_x_dot_mp(const RCP< const Stokhos::ProductEpetraVector > &x_dot_mp)
Precondition: supports(IN_ARG_x_dot_mp)==true.
void _setUnsupportsAndRelated(EInArgsMembers arg)
Simple aggregate class that stores a derivative object as a general linear operator or as a multi-vec...
Evaluation< VectorBase< Scalar > > get_g(int j) const
Precondition: supports(OUT_ARG_g)==true..
Evaluation< VectorBase< Scalar > > get_f() const
Precondition: supports(OUT_ARG_f)==true.
RCP< const Stokhos::ProductEpetraVector > get_x_mp() const
Precondition: supports(IN_ARG_x_mp)==true.
std::string description() const
void _setSupports(EOutArgsMembers arg, bool supports)
bool supports(EOutArgsMembers arg) const
Determine if an input argument is supported or not.
Simple interface class to access a precreated preconditioner as one or more linear operators objects ...
DerivativeProperties get_DgDx_dot_properties(int j) const
Return the know properties of DgDx_dot(j) (precondition: supports(OUT_ARG_DgDx_dot,j)==true).
Derivative< Scalar > get_DgDp(int j, int l) const
Precondition: supports(OUT_ARG_DgDp,j,l)==true.
DerivativeProperties get_DgDx_properties(int j) const
Return the know properties of DgDx(j) (precondition: supports(OUT_ARG_DgDx,j)==true).
void set_W_properties(const DerivativeProperties &properties)
void setSupports(EInArgsMembers arg, bool supports=true)
int Np() const
Return the number of parameter subvectors p(l) supported (Np >= 0).
void set_stage_number(Scalar stage_number)
Precondition: supports(IN_ARG_stage_number)==true.
void set_x(const RCP< const VectorBase< Scalar > > &x)
Precondition: supports(IN_ARG_x)==true.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void setUnsupportsAndRelated(EInArgsMembers arg)
Interface for a collection of column vectors called a multi-vector.
void setUnsupportsAndRelated(EInArgsMembers arg)
void setArgs(const InArgs< Scalar > &inArgs, bool ignoreUnsupported=false, bool cloneObjects=false)
Set non-null arguments (does not overwrite non-NULLs with NULLs) .
void set_DgDp(int j, int l, const Derivative< Scalar > &DgDp_j_l)
Precondition: supports(OUT_ARG_DgDp,j,l)==true.
void set_DgDp_properties(int j, int l, const DerivativeProperties &properties)
Teuchos::ScalarTraits< Scalar >::magnitudeType ScalarMag
RCP< const Stokhos::ProductEpetraVector > get_x_dot_mp() const
Precondition: supports(IN_ARG_x_dotmp)==true.
void set_g_multiplier(int j, const RCP< const VectorBase< Scalar > > &g_multiplier)
Precondition: supports(IN_ARG_x)==true.
std::string description() const
void _setModelEvalDescription(const std::string &modelEvalDescription)
Abstract interface for finite-dimensional dense vectors.
void set_Np_Ng(int Np, int Ng)
Simple public strict containing properties of a derivative object.
void _setSupports(EInArgsMembers arg, bool supports)
void assertSameSupport(const OutArgs< Scalar > &outArgs) const
Assert that two OutArgs objects have the same support.
Scalar get_W_x_dot_dot_coeff() const
Precondition: supports(IN_ARG_W_x_dot_dot_coeff)==true.
void set_x_dot(const RCP< const VectorBase< Scalar > > &x_dot)
Precondition: supports(IN_ARG_x_dot)==true.
Base class for all linear operators.
RCP< Stokhos::ProductEpetraOperator > get_W_mp() const
Precondition: supports(OUT_ARG_W_mp)==true.
DerivativeProperties get_DgDp_properties(int j, int l) const
Return the know properties of DgDp(j,l) (precondition: supports(OUT_ARG_DgDp,j,l)==true).
TEUCHOSCORE_LIB_DLL_EXPORT bool includesVerbLevel(const EVerbosityLevel verbLevel, const EVerbosityLevel requestedVerbLevel, const bool isDefaultLevel=false)
void set_DgDx_dot_properties(int j, const DerivativeProperties &properties)
bool isFailed() const
Return if the evaluation failed or not.
void _set_DgDx_properties(int j, const DerivativeProperties &properties)
void set_g_mp(int j, const RCP< Stokhos::ProductEpetraVector > &g_mp_j)
Precondition: supports(OUT_ARG_g_mp)==true.
Base subclass for ModelEvaluator that defines some basic types.
void set_t(ScalarMag t)
Precondition: supports(IN_ARG_t)==true.
void set_p_direction(int l, const RCP< const MultiVectorBase< Scalar > > &p_direction_l)
Precondition: supports(IN_ARG_x)==true.
void set_x_mp(const RCP< const Stokhos::ProductEpetraVector > &x_mp)
Precondition: supports(IN_ARG_x_mp)==true.
void set_DgDx_dot(int j, const Derivative< Scalar > &DgDx_dot_j)
Precondition: supports(OUT_ARG_DgDx_dot,j)==true.
bool nonnull(const boost::shared_ptr< T > &p)
void assertSameSupport(const InArgs< Scalar > &inArgs) const
Assert that two InArgs objects have the same support.
void set_p(int l, const RCP< const VectorBase< Scalar > > &p_l)
Set p(l) where 0 <= l && l < this->Np().
void setSupports(EOutArgsMembers arg, bool supports=true)
RCP< LinearOpWithSolveBase< Scalar > > get_W() const
Precondition: supports(OUT_ARG_W)==true.
void _set_DgDp_properties(int j, int l, const DerivativeProperties &properties)
void set_W(const RCP< LinearOpWithSolveBase< Scalar > > &W)
Precondition: supports(OUT_ARG_W)==true.
int Ng() const
Return the number of axillary response functions g(j)(...) supported (Ng >= 0).
Scalar get_alpha() const
Precondition: supports(IN_ARG_alpha)==true.
void setFailed() const
Set that the evaluation as a whole failed.
bool supports() const
Determines if an extended output argument of type ObjectType is supported.
void _set_Np_Ng(int Np, int Ng)
Scalar get_stage_number() const
Precondition: supports(IN_ARG_stage_number)==true.
std::string description() const
RCP< Stokhos::ProductEpetraVector > get_f_mp() const
Precondition: supports(OUT_ARG_f_mp)==true.
void set_alpha(Scalar alpha)
Precondition: supports(IN_ARG_alpha)==true.
void set_f_multiplier(const RCP< const VectorBase< Scalar > > &f_multiplier)
Precondition: supports(IN_ARG_x)==true.
void _set_W_properties(const DerivativeProperties &properties)
Derivative< Scalar > get_DgDx_dot(int j) const
Precondition: supports(OUT_ARG_DgDx_dot,j)==true.
void set_DfDp(int l, const Derivative< Scalar > &DfDp_l)
Precondition: supports(OUT_ARG_DfDp,l)==true.
RCP< PreconditionerBase< Scalar > > get_W_prec() const
Precondition: supports(OUT_ARG_W_op)==true.
void set_f_mp(const RCP< Stokhos::ProductEpetraVector > &f_mp)
Precondition: supports(OUT_ARG_f_mp)==true.
void set_x_direction(const RCP< const MultiVectorBase< Scalar > > &x_direction)
Precondition: supports(IN_ARG_x)==true.
Determines the forms of a general derivative that are supported.
std::string description() const
int Np() const
Return the number of parameter subvectors p(l) supported (Np >= 0).
Scalar get_step_size() const
Precondition: supports(IN_ARG_step_size)==true.
RCP< const MultiVectorBase< Scalar > > get_p_direction(int l) const
Get p(l) where 0 <= l && l < this->Np().
RCP< const VectorBase< Scalar > > get_x_dot_dot() const
Precondition: supports(IN_ARG_x_dot_dot)==true.
RCP< const VectorBase< Scalar > > get_g_multiplier(int j) const
Precondition: supports(IN_ARG_x)==true.
void set_f(const Evaluation< VectorBase< Scalar > > &f)
Precondition: supports(OUT_ARG_f)==true.
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
void set_beta(Scalar beta)
Precondition: supports(IN_ARG_beta)==true.
void set_DgDx(int j, const Derivative< Scalar > &DgDx_j)
Precondition: supports(OUT_ARG_DgDx,j)==true.
void setModelEvalDescription(const std::string &modelEvalDescription)
Type to embed evaluation accuracy with an RCP-managed object.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
bool supports(EInArgsMembers arg) const
Determines if an input argument is supported or not.
std::string modelEvalDescription() const
Simple aggregate class that stores a derivative object as a general linear operator or as a multi-vec...
void set_W_x_dot_dot_coeff(Scalar W_x_dot_dot_coeff)
Precondition: supports(IN_ARG_W_x_dot_dot_coeff)==true.
RCP< LinearOpBase< Scalar > > get_W_op() const
Precondition: supports(OUT_ARG_W_op)==true.
RCP< const MultiVectorBase< Scalar > > get_x_direction() const
Precondition: supports(IN_ARG_x)==true.
void set_W_op(const RCP< LinearOpBase< Scalar > > &W_op)
Precondition: supports(OUT_ARG_W_op)==true.
DerivativeProperties get_DfDp_properties(int l) const
Return the know properties of DfDp(l) (precondition: supports(OUT_ARG_DfDp,l)==true).
RCP< const VectorBase< Scalar > > get_x() const
Precondition: supports(IN_ARG_x)==true.
void _setModelEvalDescription(const std::string &modelEvalDescription)
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
virtual void describe(FancyOStream &out, const EVerbosityLevel verbLevel=verbLevel_default) const
RCP< const VectorBase< Scalar > > get_p(int l) const
Get p(l) where 0 <= l && l < this->Np().
Protected subclass of OutArgs that only ModelEvaluator subclasses can access to set up the selection ...
DerivativeProperties get_W_properties() const
Return the known properties of W (precondition: supports(OUT_ARG_f)==true).
Derivative< Scalar > get_DgDx(int j) const
Precondition: supports(OUT_ARG_DgDx,j)==true.
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object...