42 #ifndef THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
43 #define THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
46 #include "Thyra_ModelEvaluatorBase_decl.hpp"
47 #include "Thyra_MultiVectorBase.hpp"
48 #include "Thyra_VectorBase.hpp"
49 #include "Thyra_MultiVectorStdOps.hpp"
50 #include "Thyra_VectorStdOps.hpp"
56 namespace ModelEvaluatorHelperPack {
59 template<
class Scalar>
61 RCP<const Thyra::VectorBase<Scalar> >
68 return vec->clone_v();
72 template<
class Scalar>
74 RCP<const Thyra::MultiVectorBase<Scalar> >
81 return vec->clone_mv();
86 RCP<const Stokhos::ProductEpetraVector >
88 const RCP<const Stokhos::ProductEpetraVector > &vec,
94 printf(
"Warning: clone_v not implemented for ProductEpetraVector: %s %d\n",__FILE__,__LINE__);
108 template<
class Scalar>
110 :modelEvalDescription_(
"WARNING! THIS INARGS OBJECT IS UNINITIALIZED!")
118 step_size_ = ST::zero();
119 stage_number_ = ST::one();
123 template<
class Scalar>
125 {
return p_.size(); }
127 template<
class Scalar>
129 {
return g_multiplier_.size(); }
131 template<
class Scalar>
136 ,
"model = \'"<<modelEvalDescription_
137 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
139 return supports_[arg];
142 template<
class Scalar>
146 return supports_p_mp_[l];
149 template<
class Scalar>
155 template<
class Scalar>
160 template<
class Scalar>
167 template<
class Scalar>
173 template<
class Scalar>
177 { assert_supports(
IN_ARG_x); x_ = x; }
180 template<
class Scalar>
183 { assert_supports(
IN_ARG_x);
return x_; }
186 template<
class Scalar>
190 { assert_supports(
IN_ARG_x); x_direction_ = x_direction; }
193 template<
class Scalar>
197 { assert_l(l); p_direction_[l] = p_direction_l; }
200 template<
class Scalar>
203 { assert_supports(
IN_ARG_x);
return x_direction_; }
206 template<
class Scalar>
209 { assert_l(l);
return p_direction_[l]; }
212 template<
class Scalar>
219 template<
class Scalar>
225 template<
class Scalar>
232 template<
class Scalar>
237 template<
class Scalar>
241 { assert_supports(
IN_ARG_x); f_multiplier_ = f_multiplier; }
243 template<
class Scalar>
246 { assert_supports(
IN_ARG_x);
return f_multiplier_; }
248 template<
class Scalar>
255 g_multiplier_[j] = g_multiplier;
258 template<
class Scalar>
264 return g_multiplier_[j];
267 #ifdef HAVE_THYRA_ME_POLYNOMIAL
269 template<
class Scalar>
276 template<
class Scalar>
282 template<
class Scalar>
283 void ModelEvaluatorBase::InArgs<Scalar>::set_x_poly(
289 template<
class Scalar>
290 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
291 ModelEvaluatorBase::InArgs<Scalar>::get_x_poly()
const
295 #endif // HAVE_THYRA_ME_POLYNOMIAL
297 template<
class Scalar>
301 { assert_l(l); p_[l] = p_l; }
304 template<
class Scalar>
307 { assert_l(l);
return p_[l]; }
310 template<
class Scalar>
314 { assert_supports(
IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; }
316 template<
class Scalar>
319 { assert_supports(
IN_ARG_p_mp, l);
return p_mp_[l]; }
322 template<
class Scalar>
324 { assert_supports(
IN_ARG_t); t_ = t; }
327 template<
class Scalar>
330 { assert_supports(
IN_ARG_t);
return t_; }
333 template<
class Scalar>
338 template<
class Scalar>
343 template<
class Scalar>
348 template<
class Scalar>
352 template<
class Scalar>
357 template<
class Scalar>
361 template<
class Scalar>
365 template<
class Scalar>
369 template<
class Scalar>
374 template<
class Scalar>
379 template<
class Scalar>
381 const InArgs<Scalar>& inArgs,
bool ignoreUnsupported,
bool cloneObjects
384 using ModelEvaluatorHelperPack::condCloneVec;
385 using ModelEvaluatorHelperPack::condCloneMultiVec;
386 using ModelEvaluatorHelperPack::condCloneVec_mp;
389 set_x_dot_dot(condCloneVec(inArgs.
get_x_dot_dot(),cloneObjects));
393 set_x_dot(condCloneVec(inArgs.
get_x_dot(),cloneObjects));
397 set_x_dot_mp(condCloneVec_mp(inArgs.
get_x_dot_mp(),cloneObjects));
400 if(supports(
IN_ARG_x) || !ignoreUnsupported)
401 set_x(condCloneVec(inArgs.
get_x(),cloneObjects));
405 set_x_mp(condCloneVec_mp(inArgs.
get_x_mp(),cloneObjects));
408 if(supports(
IN_ARG_x) || !ignoreUnsupported)
409 set_x_direction(condCloneMultiVec(inArgs.
get_x_direction(),cloneObjects));
412 if(supports(
IN_ARG_x) || !ignoreUnsupported)
415 const int min_Ng = TEUCHOS_MIN(this->Ng(),inArgs.
Ng());
416 for (
int j = 0; j < min_Ng; ++j) {
420 #ifdef HAVE_THYRA_ME_POLYNOMIAL
424 cloneObjects &&
"Have not implemented cloning for x_dot_poly yet!" );
425 set_x_dot_poly(inArgs.get_x_dot_poly());
431 cloneObjects &&
"Have not implemented cloning for x_poly yet!" );
432 set_x_poly(inArgs.get_x_poly());
435 #endif // HAVE_THYRA_ME_POLYNOMIAL
436 const int min_Np = TEUCHOS_MIN(this->Np(),inArgs.
Np());
437 for (
int l = 0; l < min_Np; ++l) {
439 set_p(l,condCloneVec(inArgs.
get_p(l),cloneObjects));
441 for (
int l = 0; l < min_Np; ++l) {
443 set_p_direction(l,condCloneMultiVec(inArgs.
get_p_direction(l),cloneObjects));
445 for (
int l = 0; l < min_Np; ++l) {
447 if (
nonnull(inArgs.get_p_mp(l)))
448 set_p_mp(l,condCloneVec_mp(inArgs.get_p_mp(l),cloneObjects));
452 if(supports(
IN_ARG_t) || !ignoreUnsupported)
453 set_t(inArgs.
get_t());
476 if (extended_inargs_.size() > 0)
479 "Extended InArgs does not support cloning!");
480 this->extended_inargs_ = inArgs.extended_inargs_;
484 template<
class Scalar>
491 const std::string inArg_name =
toString(inArg_arg);
493 supports(inArg_arg) != inArgs.
supports(inArg_arg), std::logic_error,
494 "Error, the input argument "<<inArg_name<<
" with support "<<inArgs.
supports(inArg_arg)<<
"\n"
495 "in the InArgs object for the model:\n\n"
497 "is not the same the argument "<<inArg_name<<
" with support "<<supports(inArg_arg)<<
"\n"
498 "in the InArgs object for the model:\n\n"
499 " "<<modelEvalDescription()<<
"\n\n"
500 "and these two InArgs objects are not compatible!"
507 template<
class Scalar>
510 return modelEvalDescription_;
514 template<
class Scalar>
518 std::ostringstream oss;
520 <<
"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<
">"
522 <<
"model="<<modelEvalDescription_
529 template<
class Scalar>
537 using Teuchos::describe;
556 *out <<
"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<
">:\n";
559 *out <<
"model = " << modelEvalDescription_ <<
"\n";
560 *out <<
"Np = " << Np() <<
"\n";
564 *out <<
"x_dot_dot = " << Teuchos::describe(*x_dot_dot,x_verbLevel);
566 *out <<
"||x_dot_dot|| = " << norm(*x_dot_dot) << endl;
571 *out <<
"x_dot = " << Teuchos::describe(*x_dot,x_verbLevel);
573 *out <<
"||x_dot|| = " << norm(*x_dot) << endl;
578 *out <<
"x = " << Teuchos::describe(*x,x_verbLevel);
580 *out <<
"||x|| = " << norm(*x) << endl;
584 for(
int l = 0; l < Np(); ++l ) {
586 if ( !
is_null(p_l = this->get_p(l)) ) {
587 *out <<
"p("<<l<<
") = " << Teuchos::describe(*p_l,p_verbLevel);
589 *out <<
"||p("<<l<<
")|| = " << norm(*p_l) << endl;
596 *out <<
"t = " << t_ << endl;
599 *out <<
"alpha = " << alpha_ << endl;
602 *out <<
"beta = " << beta_ << endl;
605 *out <<
"W_x_dot_dot_coeff = " << W_x_dot_dot_coeff_ << endl;
608 *out <<
"step_size = " << step_size_ << endl;
611 *out <<
"stage_number = " << stage_number_ << endl;
618 template<
class Scalar>
620 const std::string &modelEvalDescription_in
623 modelEvalDescription_ = modelEvalDescription_in;
627 template<
class Scalar>
631 p_direction_.resize(Np_in);
633 supports_p_mp_.resize(Np_in);
634 g_multiplier_.resize(Ng_in);
638 template<
class Scalar>
645 ,
"model = \'"<<modelEvalDescription_
646 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!");
647 supports_[arg] = supports_in;
650 template<
class Scalar>
656 supports_p_mp_[l] = supports_in;
660 template<
class Scalar>
666 &inArgs.supports_[0],
668 this->_set_Np_Ng( Np_in >= 0 ? Np_in : inArgs.
Np(), inArgs.
Ng() );
672 template<
class Scalar>
691 true ,std::logic_error,
692 "Error, can not handle args other than IN_ARG_x yet!"
695 this->_setSupports(arg,
false);
699 template<
class Scalar>
705 !supports_[arg], std::logic_error
706 ,
"Thyra::ModelEvaluatorBase::InArgs<"
708 "model = \'"<<modelEvalDescription_<<
"\': Error, "
709 "The argument arg = " <<
toString(arg) <<
" is not supported!"
713 template<
class Scalar>
720 !supports_p_mp_[l], std::logic_error
721 ,
"Thyra::ModelEvaluatorBase::InArgs<"
723 "model = \'"<<modelEvalDescription_<<
"\': Error, "
724 "The argument p_mp(l) with index l = " << l <<
" is not supported!"
729 template<
class Scalar>
730 void ModelEvaluatorBase::InArgs<Scalar>::assert_l(
int l)
const
733 !( 0 <= l && l < Np() ), std::logic_error
734 ,
"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_l(l):\n\n"
735 " model = \'"<<modelEvalDescription_<<
"\':\n\n"
736 "Error, The parameter l = " << l <<
" is not in the range [0,"<<Np()<<
")!"
740 template<
class Scalar>
741 void ModelEvaluatorBase::InArgs<Scalar>::assert_j(
int j)
const
744 !( 0 <= j && j < Ng() ), std::logic_error
745 ,
"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_j(j):\n\n"
746 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
747 "Error, The auxiliary function g("<<j<<
")"
748 " is not in the range [0,"<<Ng()<<
")!"
757 template<
class Scalar>
761 std::ostringstream oss;
762 oss <<
"DerivativeMultiVector{";
763 if (
is_null(getMultiVector())) {
768 <<
"multiVec=" << getMultiVector()->description()
769 <<
",orientation=" <<
toString(getOrientation());
776 template<
class Scalar>
782 using Teuchos::describe;
784 out <<
"DerivativeMultiVector\n";
788 <<
describe(*getMultiVector(),verbLevel)
790 <<
toString(getOrientation()) << endl;
807 template<
class Scalar>
812 std::ostringstream oss;
813 oss <<
"Derivative{";
817 else if (!
is_null(getLinearOp())) {
818 oss <<
"linearOp=" << getLinearOp()->description();
821 oss <<
"derivMultiVec=" << getDerivativeMultiVector().description();
828 template<
class Scalar>
834 using Teuchos::describe;
836 out <<
"Derivative:";
840 else if (!
is_null(getLinearOp())) {
843 <<
"linearOp = " <<
describe(*getLinearOp(),verbLevel);
848 <<
"derivMultiVec = ";
849 getDerivativeMultiVector().describe(out,verbLevel);
859 template<
class Scalar>
861 :modelEvalDescription_(
"WARNING! THIS OUTARGS OBJECT IS UNINITIALIZED!"),
865 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
866 this->_setHessianSupports(
false);
871 template<
class Scalar>
873 {
return DfDp_.size(); }
876 template<
class Scalar>
878 {
return g_.size(); }
881 template<
class Scalar>
888 ,
"model = \'"<<modelEvalDescription_
889 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
891 return supports_[arg];
895 template<
class Scalar>
902 return supports_DfDp_[l];
906 template<
class Scalar>
913 return supports_DgDx_dot_[j];
917 template<
class Scalar>
924 return supports_DgDx_[j];
928 template<
class Scalar>
936 return supports_DgDp_[ j*Np() + l ];
940 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
942 template<
class Scalar>
944 EOutArgs_hess_vec_prod_f_xx
947 return supports_hess_vec_prod_f_xx_;
950 template<
class Scalar>
952 EOutArgs_hess_vec_prod_f_xp ,
int l
956 return supports_hess_vec_prod_f_xp_[l];
959 template<
class Scalar>
961 EOutArgs_hess_vec_prod_f_px ,
int l
965 return supports_hess_vec_prod_f_px_[l];
968 template<
class Scalar>
970 EOutArgs_hess_vec_prod_f_pp ,
int l1,
int l2
975 return supports_hess_vec_prod_f_pp_[ l1*Np() + l2 ];
978 template<
class Scalar>
980 EOutArgs_hess_vec_prod_g_xx ,
int j
984 return supports_hess_vec_prod_g_xx_[j];
987 template<
class Scalar>
989 EOutArgs_hess_vec_prod_g_xp ,
int j,
int l
994 return supports_hess_vec_prod_g_xp_[ j*Np() + l ];
997 template<
class Scalar>
999 EOutArgs_hess_vec_prod_g_px ,
int j,
int l
1004 return supports_hess_vec_prod_g_px_[ j*Np() + l ];
1007 template<
class Scalar>
1009 EOutArgs_hess_vec_prod_g_pp ,
int j,
int l1,
int l2
1015 return supports_hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1018 template<
class Scalar>
1023 return supports_hess_f_xx_;
1026 template<
class Scalar>
1028 EOutArgs_hess_f_xp ,
int l
1032 return supports_hess_f_xp_[l];
1035 template<
class Scalar>
1037 EOutArgs_hess_f_pp ,
int l1,
int l2
1042 return supports_hess_f_pp_[ l1*Np() + l2 ];
1045 template<
class Scalar>
1050 return supports_H_xx_;
1053 template<
class Scalar>
1055 EOutArgs_H_xp ,
int l
1059 return supports_H_xp_[l];
1062 template<
class Scalar>
1064 EOutArgs_H_pp ,
int l1,
int l2
1069 return supports_H_pp_[ l1*Np() + l2 ];
1072 template<
class Scalar>
1074 EOutArgs_hess_g_xx ,
int j
1078 return supports_hess_g_xx_[j];
1081 template<
class Scalar>
1083 EOutArgs_hess_g_xp ,
int j,
int l
1088 return supports_hess_g_xp_[ j*Np() + l ];
1091 template<
class Scalar>
1093 EOutArgs_hess_g_pp ,
int j,
int l1,
int l2
1099 return supports_hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1102 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
1105 template<
class Scalar>
1112 return supports_g_mp_[j];
1115 template<
class Scalar>
1116 const ModelEvaluatorBase::DerivativeSupport&
1122 return supports_DfDp_mp_[l];
1126 template<
class Scalar>
1127 const ModelEvaluatorBase::DerivativeSupport&
1133 return supports_DgDx_dot_mp_[j];
1137 template<
class Scalar>
1138 const ModelEvaluatorBase::DerivativeSupport&
1144 return supports_DgDx_mp_[j];
1148 template<
class Scalar>
1149 const ModelEvaluatorBase::DerivativeSupport&
1156 return supports_DgDp_mp_[ j*Np() + l ];
1161 template<
class Scalar>
1171 template<
class Scalar>
1180 template<
class Scalar>
1190 template<
class Scalar>
1199 template<
class Scalar>
1209 template<
class Scalar>
1218 template<
class Scalar>
1228 template<
class Scalar>
1237 template<
class Scalar>
1247 template<
class Scalar>
1256 template<
class Scalar>
1266 template<
class Scalar>
1275 template<
class Scalar>
1285 template<
class Scalar>
1294 template<
class Scalar>
1304 template<
class Scalar>
1313 template<
class Scalar>
1318 return W_properties_;
1322 template<
class Scalar>
1332 template<
class Scalar>
1341 template<
class Scalar>
1346 return DfDp_properties_[l];
1350 template<
class Scalar>
1356 DfDp_mp_[l] = DfDp_mp_l;
1360 template<
class Scalar>
1369 template<
class Scalar>
1370 ModelEvaluatorBase::DerivativeProperties
1371 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp_mp_properties(
int l)
const
1374 return DfDp_mp_properties_[l];
1378 template<
class Scalar>
1384 DgDx_dot_[j] = DgDx_dot_j;
1388 template<
class Scalar>
1393 return DgDx_dot_[j];
1397 template<
class Scalar>
1402 return DgDx_dot_properties_[j];
1406 template<
class Scalar>
1412 DgDx_dot_mp_[j] = DgDx_dot_mp_j;
1416 template<
class Scalar>
1421 return DgDx_dot_mp_[j];
1425 template<
class Scalar>
1426 ModelEvaluatorBase::DerivativeProperties
1427 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot_mp_properties(
int j)
const
1430 return DgDx_dot_mp_properties_[j];
1434 template<
class Scalar>
1444 template<
class Scalar>
1453 template<
class Scalar>
1458 return DgDx_properties_[j];
1462 template<
class Scalar>
1468 DgDx_mp_[j] = DgDx_mp_j;
1472 template<
class Scalar>
1481 template<
class Scalar>
1482 ModelEvaluatorBase::DerivativeProperties
1483 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_mp_properties(
int j)
const
1486 return DgDx_mp_properties_[j];
1490 template<
class Scalar>
1496 DgDp_[ j*Np() + l ] = DgDp_j_l;
1500 template<
class Scalar>
1505 return DgDp_[ j*Np() + l ];
1509 template<
class Scalar>
1514 return DgDp_properties_[ j*Np() + l ];
1518 template<
class Scalar>
1524 DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l;
1528 template<
class Scalar>
1533 return DgDp_mp_[ j*Np() + l ];
1537 template<
class Scalar>
1538 ModelEvaluatorBase::DerivativeProperties
1539 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp_mp_properties(
int j,
int l)
const
1542 return DgDp_mp_properties_[ j*Np() + l ];
1546 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
1548 template<
class Scalar>
1549 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_xx(
1550 const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_xx
1553 assert_supports(OUT_ARG_hess_vec_prod_f_xx);
1554 hess_vec_prod_f_xx_ = hess_vec_prod_f_xx;
1557 template<
class Scalar>
1558 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_xp(
1559 int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_xp_l
1562 assert_supports(OUT_ARG_hess_vec_prod_f_xp,l);
1563 hess_vec_prod_f_xp_[l] = hess_vec_prod_f_xp_l;
1566 template<
class Scalar>
1567 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_px(
1568 int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_px_l
1571 assert_supports(OUT_ARG_hess_vec_prod_f_px,l);
1572 hess_vec_prod_f_px_[l] = hess_vec_prod_f_px_l;
1575 template<
class Scalar>
1576 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_pp(
1577 int l1,
int l2,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_pp_l1_l2
1580 assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2);
1581 hess_vec_prod_f_pp_[ l1*Np() + l2 ] = hess_vec_prod_f_pp_l1_l2;
1584 template<
class Scalar>
1585 RCP<MultiVectorBase<Scalar> >
1586 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_xx()
const
1588 assert_supports(OUT_ARG_hess_vec_prod_f_xx);
1589 return hess_vec_prod_f_xx_;
1592 template<
class Scalar>
1593 RCP<MultiVectorBase<Scalar> >
1594 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_xp(
int l)
const
1596 assert_supports(OUT_ARG_hess_vec_prod_f_xp,l);
1597 return hess_vec_prod_f_xp_[l];
1600 template<
class Scalar>
1601 RCP<MultiVectorBase<Scalar> >
1602 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_px(
int l)
const
1604 assert_supports(OUT_ARG_hess_vec_prod_f_px,l);
1605 return hess_vec_prod_f_px_[l];
1608 template<
class Scalar>
1609 RCP<MultiVectorBase<Scalar> >
1610 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_pp(
int l1,
int l2)
const
1612 assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2);
1613 return hess_vec_prod_f_pp_[ l1*Np() + l2 ];
1617 template<
class Scalar>
1618 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_xx(
1619 int j,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_xx_j
1622 assert_supports(OUT_ARG_hess_vec_prod_g_xx,j);
1623 hess_vec_prod_g_xx_[j] = hess_vec_prod_g_xx_j;
1626 template<
class Scalar>
1627 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_xp(
1628 int j,
int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_xp_j_l
1631 assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l);
1632 hess_vec_prod_g_xp_[ j*Np() + l ] = hess_vec_prod_g_xp_j_l;
1635 template<
class Scalar>
1636 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_px(
1637 int j,
int l,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_px_j_l
1640 assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l);
1641 hess_vec_prod_g_px_[ j*Np() + l ] = hess_vec_prod_g_px_j_l;
1644 template<
class Scalar>
1645 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_pp(
1646 int j,
int l1,
int l2,
const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_pp_j_l1_l2
1649 assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2);
1650 hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ] = hess_vec_prod_g_pp_j_l1_l2;
1653 template<
class Scalar>
1654 RCP<MultiVectorBase<Scalar> >
1655 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_xx(
int j)
const
1657 assert_supports(OUT_ARG_hess_vec_prod_g_xx,j);
1658 return hess_vec_prod_g_xx_[j];
1661 template<
class Scalar>
1662 RCP<MultiVectorBase<Scalar> >
1663 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_xp(
int j,
int l)
const
1665 assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l);
1666 return hess_vec_prod_g_xp_[ j*Np() + l ];
1669 template<
class Scalar>
1670 RCP<MultiVectorBase<Scalar> >
1671 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_px(
int j,
int l)
const
1673 assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l);
1674 return hess_vec_prod_g_px_[ j*Np() + l ];
1677 template<
class Scalar>
1678 RCP<MultiVectorBase<Scalar> >
1679 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_pp(
int j,
int l1,
int l2)
const
1681 assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2);
1682 return hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1685 template<
class Scalar>
1686 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_xx(
1687 const RCP<LinearOpBase<Scalar> > &hess_f_xx
1690 assert_supports(OUT_ARG_hess_f_xx);
1691 hess_f_xx_ = hess_f_xx;
1694 template<
class Scalar>
1695 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_xp(
1696 int l,
const RCP<LinearOpBase<Scalar> > &hess_f_xp_l
1699 assert_supports(OUT_ARG_hess_f_xp,l);
1700 hess_f_xp_[l] = hess_f_xp_l;
1703 template<
class Scalar>
1704 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_pp(
1705 int l1,
int l2,
const RCP<LinearOpBase<Scalar> > &hess_f_pp_l1_l2
1708 assert_supports(OUT_ARG_hess_f_pp,l1,l2);
1709 hess_f_pp_[ l1*Np() + l2 ] = hess_f_pp_l1_l2;
1712 template<
class Scalar>
1713 RCP<LinearOpBase<Scalar> >
1714 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_xx()
const
1716 assert_supports(OUT_ARG_hess_f_xx);
1720 template<
class Scalar>
1721 RCP<LinearOpBase<Scalar> >
1722 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_xp(
int l)
const
1724 assert_supports(OUT_ARG_hess_f_xp,l);
1725 return hess_f_xp_[l];
1728 template<
class Scalar>
1729 RCP<LinearOpBase<Scalar> >
1730 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_pp(
int l1,
int l2)
const
1732 assert_supports(OUT_ARG_hess_f_pp,l1,l2);
1733 return hess_f_pp_[ l1*Np() + l2 ];
1736 template<
class Scalar>
1737 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_xx(
1738 int j,
const RCP<LinearOpBase<Scalar> > &hess_g_xx_j
1741 assert_supports(OUT_ARG_hess_g_xx,j);
1742 hess_g_xx_[j] = hess_g_xx_j;
1745 template<
class Scalar>
1746 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_xp(
1747 int j,
int l,
const RCP<LinearOpBase<Scalar> > &hess_g_xp_j_l
1750 assert_supports(OUT_ARG_hess_g_xp,j,l);
1751 hess_g_xp_[ j*Np() + l ] = hess_g_xp_j_l;
1754 template<
class Scalar>
1755 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_pp(
1756 int j,
int l1,
int l2,
const RCP<LinearOpBase<Scalar> > &hess_g_pp_j_l1_l2
1759 assert_supports(OUT_ARG_hess_g_pp,j,l1,l2);
1760 hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ] = hess_g_pp_j_l1_l2;
1763 template<
class Scalar>
1764 RCP<LinearOpBase<Scalar> >
1765 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_xx(
int j)
const
1767 assert_supports(OUT_ARG_hess_g_xx,j);
1768 return hess_g_xx_[j];
1771 template<
class Scalar>
1772 RCP<LinearOpBase<Scalar> >
1773 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_xp(
int j,
int l)
const
1775 assert_supports(OUT_ARG_hess_g_xp,j,l);
1776 return hess_g_xp_[ j*Np() + l ];
1779 template<
class Scalar>
1780 RCP<LinearOpBase<Scalar> >
1781 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_pp(
int j,
int l1,
int l2)
const
1783 assert_supports(OUT_ARG_hess_g_pp,j,l1,l2);
1784 return hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1787 template<
class Scalar>
1788 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_xx(
1789 const RCP<LinearOpBase<Scalar> > &H_xx
1792 assert_supports(OUT_ARG_H_xx);
1796 template<
class Scalar>
1797 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_xp(
1798 int l,
const RCP<LinearOpBase<Scalar> > &H_xp_l
1801 assert_supports(OUT_ARG_H_xp,l);
1805 template<
class Scalar>
1806 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_pp(
1807 int l1,
int l2,
const RCP<LinearOpBase<Scalar> > &H_pp_l1_l2
1810 assert_supports(OUT_ARG_H_pp,l1,l2);
1811 H_pp_[ l1*Np() + l2 ] = H_pp_l1_l2;
1814 template<
class Scalar>
1815 RCP<LinearOpBase<Scalar> >
1816 ModelEvaluatorBase::OutArgs<Scalar>::get_H_xx()
const
1818 assert_supports(OUT_ARG_H_xx);
1822 template<
class Scalar>
1823 RCP<LinearOpBase<Scalar> >
1824 ModelEvaluatorBase::OutArgs<Scalar>::get_H_xp(
int l)
const
1826 assert_supports(OUT_ARG_H_xp,l);
1830 template<
class Scalar>
1831 RCP<LinearOpBase<Scalar> >
1832 ModelEvaluatorBase::OutArgs<Scalar>::get_H_pp(
int l1,
int l2)
const
1834 assert_supports(OUT_ARG_H_pp,l1,l2);
1835 return H_pp_[ l1*Np() + l2 ];
1838 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
1841 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1844 template<
class Scalar>
1845 void ModelEvaluatorBase::OutArgs<Scalar>::set_f_poly(
1853 template<
class Scalar>
1854 RCP<Teuchos::Polynomial< VectorBase<Scalar> > >
1855 ModelEvaluatorBase::OutArgs<Scalar>::get_f_poly()
const
1861 #endif // HAVE_THYRA_ME_POLYNOMIAL
1864 template<
class Scalar>
1870 const int min_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.
Np());
1871 const int min_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.
Ng());
1874 if ( supports(
OUT_ARG_f) || !ignoreUnsupported )
1875 set_f(inputOutArgs.
get_f());
1881 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1885 set_f_poly(inputOutArgs.get_f_poly());
1887 #endif // HAVE_THYRA_ME_POLYNOMIAL
1889 for (
int j = 0; j < min_Ng; ++j ) {
1891 set_g(j,inputOutArgs.
get_g(j));
1893 for (
int j = 0; j < min_Ng; ++j ) {
1896 set_g_mp(j,inputOutArgs.
get_g_mp(j));
1901 if ( supports(
OUT_ARG_W) || !ignoreUnsupported )
1902 set_W(inputOutArgs.
get_W());
1919 for (
int l = 0; l < min_Np; ++l ) {
1920 MEB::Derivative<Scalar> DfDp_l;
1922 && !(DfDp_l=inputOutArgs.
get_DfDp(l)).isEmpty() )
1924 if ( DfDp_l.isSupportedBy(supports(
OUT_ARG_DfDp,l)) || !ignoreUnsupported )
1928 for (
int l = 0; l < min_Np; ++l ) {
1929 MEB::MPDerivative DfDp_mp_l;
1931 && !(DfDp_mp_l=inputOutArgs.get_DfDp_mp(l)).isEmpty() )
1933 if ( DfDp_mp_l.isSupportedBy(supports(
OUT_ARG_DfDp_mp,l)) || !ignoreUnsupported )
1934 set_DfDp_mp(l,DfDp_mp_l);
1938 for (
int j = 0; j < min_Ng; ++j ) {
1940 MEB::Derivative<Scalar> DgDx_dot_j;
1942 && !(DgDx_dot_j=inputOutArgs.
get_DgDx_dot(j)).isEmpty() )
1944 if( DgDx_dot_j.isSupportedBy(supports(
OUT_ARG_DgDx_dot,j)) || !ignoreUnsupported )
1945 set_DgDx_dot(j,DgDx_dot_j);
1948 MEB::Derivative<Scalar> DgDx_j;
1950 && !(DgDx_j=inputOutArgs.
get_DgDx(j)).isEmpty() ) {
1951 if ( DgDx_j.isSupportedBy(supports(
OUT_ARG_DgDx,j)) || !ignoreUnsupported )
1955 for (
int j = 0; j < min_Ng; ++j ) {
1957 MEB::MPDerivative DgDx_dot_mp_j;
1959 && !(DgDx_dot_mp_j=inputOutArgs.get_DgDx_dot_mp(j)).isEmpty() )
1962 set_DgDx_dot_mp(j,DgDx_dot_mp_j);
1965 MEB::MPDerivative DgDx_mp_j;
1967 && !(DgDx_mp_j=inputOutArgs.get_DgDx_mp(j)).isEmpty() ) {
1968 if ( DgDx_mp_j.isSupportedBy(supports(
OUT_ARG_DgDx_mp,j)) || !ignoreUnsupported )
1969 set_DgDx_mp(j,DgDx_mp_j);
1973 for (
int l = 0; l < min_Np; ++l ) {
1974 for (
int j = 0; j < min_Ng; ++j ) {
1975 MEB::Derivative<Scalar> DgDp_j_l;
1977 && !(DgDp_j_l=inputOutArgs.
get_DgDp(j,l)).isEmpty() )
1979 if ( DgDp_j_l.isSupportedBy(supports(
OUT_ARG_DgDp,j,l)) || !ignoreUnsupported )
1980 set_DgDp(j,l,DgDp_j_l);
1984 for (
int l = 0; l < min_Np; ++l ) {
1985 for (
int j = 0; j < min_Ng; ++j ) {
1986 MEB::MPDerivative DgDp_mp_j_l;
1988 && !(DgDp_mp_j_l=inputOutArgs.get_DgDp_mp(j,l)).isEmpty() )
1990 if ( DgDp_mp_j_l.isSupportedBy(supports(
OUT_ARG_DgDp_mp,j,l)) || !ignoreUnsupported )
1991 set_DgDp_mp(j,l,DgDp_mp_j_l);
1996 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
1999 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_xx) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_xx()) ) {
2000 if ( supports(OUT_ARG_hess_vec_prod_f_xx) || !ignoreUnsupported )
2001 set_hess_vec_prod_f_xx(inputOutArgs.get_hess_vec_prod_f_xx());
2003 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2004 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_xp,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_xp(l1)) ) {
2005 if ( supports(OUT_ARG_hess_vec_prod_f_xp,l1) || !ignoreUnsupported )
2006 set_hess_vec_prod_f_xp(l1,inputOutArgs.get_hess_vec_prod_f_xp(l1));
2008 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_px,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_px(l1)) ) {
2009 if ( supports(OUT_ARG_hess_vec_prod_f_px,l1) || !ignoreUnsupported )
2010 set_hess_vec_prod_f_px(l1,inputOutArgs.get_hess_vec_prod_f_px(l1));
2012 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2013 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2) &&
nonnull(inputOutArgs.get_hess_vec_prod_f_pp(l1,l2)) ) {
2014 if ( supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2) || !ignoreUnsupported )
2015 set_hess_vec_prod_f_pp(l1,l2,inputOutArgs.get_hess_vec_prod_f_pp(l1,l2));
2021 for (
int j = 0; j < min_Ng; ++j ) {
2022 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_xx,j) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_xx(j)) ) {
2023 if ( supports(OUT_ARG_hess_vec_prod_g_xx,j) || !ignoreUnsupported )
2024 set_hess_vec_prod_g_xx(j,inputOutArgs.get_hess_vec_prod_g_xx(j));
2026 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2027 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_xp,j,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_xp(j,l1)) ) {
2028 if ( supports(OUT_ARG_hess_vec_prod_g_xp,j,l1) || !ignoreUnsupported )
2029 set_hess_vec_prod_g_xp(j,l1,inputOutArgs.get_hess_vec_prod_g_xp(j,l1));
2031 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_px,j,l1) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_px(j,l1)) ) {
2032 if ( supports(OUT_ARG_hess_vec_prod_g_px,j,l1) || !ignoreUnsupported )
2033 set_hess_vec_prod_g_px(j,l1,inputOutArgs.get_hess_vec_prod_g_px(j,l1));
2035 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2036 if( inputOutArgs.
supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2) &&
nonnull(inputOutArgs.get_hess_vec_prod_g_pp(j,l1,l2)) ) {
2037 if ( supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2) || !ignoreUnsupported )
2038 set_hess_vec_prod_g_pp(j,l1,l2,inputOutArgs.get_hess_vec_prod_g_pp(j,l1,l2));
2045 if( inputOutArgs.
supports(OUT_ARG_hess_f_xx) &&
nonnull(inputOutArgs.get_hess_f_xx()) ) {
2046 if ( supports(OUT_ARG_hess_f_xx) || !ignoreUnsupported )
2047 set_hess_f_xx(inputOutArgs.get_hess_f_xx());
2049 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2050 if( inputOutArgs.
supports(OUT_ARG_hess_f_xp,l1) &&
nonnull(inputOutArgs.get_hess_f_xp(l1)) ) {
2051 if ( supports(OUT_ARG_hess_f_xp,l1) || !ignoreUnsupported )
2052 set_hess_f_xp(l1,inputOutArgs.get_hess_f_xp(l1));
2054 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2055 if( inputOutArgs.
supports(OUT_ARG_hess_f_pp,l1,l2) &&
nonnull(inputOutArgs.get_hess_f_pp(l1,l2)) ) {
2056 if ( supports(OUT_ARG_hess_f_pp,l1,l2) || !ignoreUnsupported )
2057 set_hess_f_pp(l1,l2,inputOutArgs.get_hess_f_pp(l1,l2));
2063 for (
int j = 0; j < min_Ng; ++j ) {
2064 if( inputOutArgs.
supports(OUT_ARG_hess_g_xx,j) &&
nonnull(inputOutArgs.get_hess_g_xx(j)) ) {
2065 if ( supports(OUT_ARG_hess_g_xx,j) || !ignoreUnsupported )
2066 set_hess_g_xx(j,inputOutArgs.get_hess_g_xx(j));
2068 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2069 if( inputOutArgs.
supports(OUT_ARG_hess_g_xp,j,l1) &&
nonnull(inputOutArgs.get_hess_g_xp(j,l1)) ) {
2070 if ( supports(OUT_ARG_hess_g_xp,j,l1) || !ignoreUnsupported )
2071 set_hess_g_xp(j,l1,inputOutArgs.get_hess_g_xp(j,l1));
2073 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2074 if( inputOutArgs.
supports(OUT_ARG_hess_g_pp,j,l1,l2) &&
nonnull(inputOutArgs.get_hess_g_pp(j,l1,l2)) ) {
2075 if ( supports(OUT_ARG_hess_g_pp,j,l1,l2) || !ignoreUnsupported )
2076 set_hess_g_pp(j,l1,l2,inputOutArgs.get_hess_g_pp(j,l1,l2));
2083 if( inputOutArgs.
supports(OUT_ARG_H_xx) &&
nonnull(inputOutArgs.get_H_xx()) ) {
2084 if ( supports(OUT_ARG_H_xx) || !ignoreUnsupported )
2085 set_H_xx(inputOutArgs.get_H_xx());
2087 for (
int l1 = 0; l1 < min_Np; ++l1 ) {
2088 if( inputOutArgs.
supports(OUT_ARG_H_xp,l1) &&
nonnull(inputOutArgs.get_H_xp(l1)) ) {
2089 if ( supports(OUT_ARG_H_xp,l1) || !ignoreUnsupported )
2090 set_H_xp(l1,inputOutArgs.get_H_xp(l1));
2092 for (
int l2 = 0; l2 < min_Np; ++l2 ) {
2093 if( inputOutArgs.
supports(OUT_ARG_H_pp,l1,l2) &&
nonnull(inputOutArgs.get_H_pp(l1,l2)) ) {
2094 if ( supports(OUT_ARG_H_pp,l1,l2) || !ignoreUnsupported )
2095 set_H_pp(l1,l2,inputOutArgs.get_H_pp(l1,l2));
2100 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2103 this->extended_outargs_ = inputOutArgs.extended_outargs_;
2109 template<
class Scalar>
2115 assign(this->get_f().ptr(),ST::nan());
2117 for(
int j = 0; j < this->Ng(); ++j ) {
2119 assign(this->get_g(j).ptr(),ST::nan());
2125 template<
class Scalar>
2132 template<
class Scalar>
2141 for (
int l = 0; l < Np(); ++l ) {
2142 if (!DfDp_[l].isEmpty())
2145 #ifdef HAVE_THYRA_ME_POLYNOMIAL
2148 #endif // HAVE_THYRA_ME_POLYNOMIAL
2149 for (
int j = 0; j < Ng(); ++j ) {
2152 if (!DgDx_dot_[j].isEmpty())
2154 if (!DgDx_[j].isEmpty())
2156 for (
int l = 0; l < Np(); ++l ) {
2157 if (!DgDp_[j*Np()+l].isEmpty())
2165 template<
class Scalar>
2173 const std::string outArg_name =
toString(outArg_arg);
2175 supports(outArg_arg) != outArgs.
supports(outArg_arg), std::logic_error,
2176 "Error, the output argument "<<outArg_name<<
" with support "<<outArgs.
supports(outArg_arg)<<
"\n"
2177 "in the OutArgs object for the model:\n\n"
2179 "is not the same the argument "<<outArg_name<<
" with support "<<supports(outArg_arg)<<
"\n"
2180 "in the OutArgs object for the model:\n\n"
2181 " "<<modelEvalDescription()<<
"\n\n"
2182 "and these two OutArgs objects are not compatible!"
2186 const int l_Np = this->Np();
2187 const int l_Ng = this->Ng();
2192 for (
int l = 0; l < l_Np; ++l ) {
2196 "Error, the support for DfDp("<<l<<
") is not the same for the models\n\n"
2199 " "<<modelEvalDescription()<<
"\n\n"
2200 "and these two OutArgs objects are not compatible!"
2205 for (
int j = 0; j < l_Ng; ++j ) {
2209 "Error, the support for DgDx_dot("<<j<<
") is not the same for the models\n\n"
2212 " "<<modelEvalDescription()<<
"\n\n"
2213 "and these two OutArgs objects are not compatible!"
2218 "Error, the support for DgDx("<<j<<
") is not the same for the models\n\n"
2221 " "<<modelEvalDescription()<<
"\n\n"
2222 "and these two OutArgs objects are not compatible!"
2224 for (
int l = 0; l < l_Np; ++l ) {
2228 "Error, the support for DgDp("<<j<<
","<<l<<
") is not the same for the models\n\n"
2231 " "<<modelEvalDescription()<<
"\n\n"
2232 "and these two OutArgs objects are not compatible!"
2239 template<
class Scalar>
2242 return modelEvalDescription_;
2246 template<
class Scalar>
2250 std::ostringstream oss;
2252 <<
"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<
">"
2254 <<
"model="<<modelEvalDescription_
2262 template<
class Scalar>
2269 using Teuchos::describe;
2275 typedef MEB::Derivative<Scalar> Deriv;
2284 *out <<
"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<
">:\n";
2287 *out <<
"model = " << modelEvalDescription_ <<
"\n";
2288 *out <<
"Np = " << Np() <<
"\n";
2289 *out <<
"Ng = " << Ng() <<
"\n";
2293 *out <<
"f = " << Teuchos::describe(*f,verbLevel);
2296 for(
int j = 0; j < Ng(); ++j ) {
2298 if (!
is_null(g_j=this->get_g(j)))
2299 *out <<
"g("<<j<<
") = " << Teuchos::describe(*g_j,verbLevel);
2304 *out <<
"W = " << Teuchos::describe(*W,verbLevel);
2309 *out <<
"W_op = " << Teuchos::describe(*W_op,verbLevel);
2312 for(
int l = 0; l < Np(); ++l ) {
2316 && !(DfDp_l=get_DfDp(l)).isEmpty()
2319 *out <<
"DfDp("<<l<<
") = ";
2320 DfDp_l.describe(*out,verbLevel);
2324 for(
int j = 0; j < Ng(); ++j ) {
2329 && !(DgDx_dot_j=get_DgDx_dot(j)).isEmpty()
2332 *out <<
"DgDx_dot("<<j<<
") = ";
2333 DgDx_dot_j.describe(*out,verbLevel);
2339 && !(DgDx_j=get_DgDx(j)).isEmpty()
2342 *out <<
"DgDx("<<j<<
") = ";
2343 DgDx_j.describe(*out,verbLevel);
2346 for(
int l = 0; l < Np(); ++l ) {
2351 && !(DgDp_j_l=get_DgDp(j,l)).isEmpty()
2354 *out <<
"DgDp("<<j<<
","<<l<<
") = ";
2355 DgDp_j_l.describe(*out,verbLevel);
2369 template<
class Scalar>
2371 const std::string &modelEvalDescription_in
2374 modelEvalDescription_ = modelEvalDescription_in;
2377 template<
class Scalar>
2381 supports_DfDp_.resize(Np_in);
2383 DfDp_properties_.resize(Np_in); std::fill_n(DfDp_properties_.begin(),Np_in,
DerivativeProperties());
2385 supports_DfDp_mp_.resize(Np_in);
2386 DfDp_mp_.resize(Np_in); std::fill_n(DfDp_mp_.begin(),Np_in,
MPDerivative());
2387 DfDp_mp_properties_.resize(Np_in); std::fill_n(DfDp_mp_properties_.begin(),Np_in,
DerivativeProperties());
2390 g_.resize(Ng_in); std::fill_n(g_.begin(),Ng_in,Teuchos::null);
2391 supports_DgDx_dot_.resize(Ng_in);
2393 DgDx_dot_properties_.resize(Ng_in); std::fill_n(DgDx_dot_properties_.begin(),Ng_in,
DerivativeProperties());
2394 supports_DgDx_.resize(Ng_in);
2396 DgDx_properties_.resize(Ng_in); std::fill_n(DgDx_properties_.begin(),Ng_in,
DerivativeProperties());
2398 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2399 supports_hess_vec_prod_g_xx_.resize(Ng_in);
2402 supports_hess_g_xx_.resize(Ng_in);
2404 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2406 g_mp_.resize(Ng_in); std::fill_n(g_mp_.begin(),Ng_in,Teuchos::null);
2407 supports_g_mp_.resize(Ng_in);
2408 supports_DgDx_dot_mp_.resize(Ng_in);
2409 DgDx_dot_mp_.resize(Ng_in); std::fill_n(DgDx_dot_mp_.begin(),Ng_in,
MPDerivative());
2410 DgDx_dot_mp_properties_.resize(Ng_in); std::fill_n(DgDx_dot_mp_properties_.begin(),Ng_in,
DerivativeProperties());
2411 supports_DgDx_mp_.resize(Ng_in);
2412 DgDx_mp_.resize(Ng_in); std::fill_n(DgDx_mp_.begin(),Ng_in,
MPDerivative());
2413 DgDx_mp_properties_.resize(Ng_in); std::fill_n(DgDx_mp_properties_.begin(),Ng_in,
DerivativeProperties());
2415 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2417 const int Np = Np_in;
2418 const int NpNp = Np_in*Np_in;
2420 supports_hess_vec_prod_f_xp_.resize(Np);
2423 supports_hess_vec_prod_f_px_.resize(Np);
2426 supports_hess_vec_prod_f_pp_.resize(NpNp);
2429 supports_hess_f_xp_.resize(Np);
2432 supports_hess_f_pp_.resize(NpNp);
2435 supports_H_xp_.resize(Np);
2438 supports_H_pp_.resize(NpNp);
2441 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2442 if(Np_in && Ng_in) {
2443 const int NpNg = Np_in*Ng_in;
2444 const int NpNpNg = Np_in*Np_in*Ng_in;
2445 supports_DgDp_.resize(NpNg);
2447 DgDp_properties_.resize(NpNg); std::fill_n(DgDp_properties_.begin(),NpNg,
DerivativeProperties());
2449 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2450 supports_hess_vec_prod_g_xp_.resize(NpNg);
2453 supports_hess_vec_prod_g_px_.resize(NpNg);
2456 supports_hess_vec_prod_g_pp_.resize(NpNpNg);
2459 supports_hess_g_xp_.resize(NpNg);
2462 supports_hess_g_pp_.resize(NpNpNg);
2464 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2466 supports_DgDp_mp_.resize(NpNg);
2467 DgDp_mp_.resize(NpNg); std::fill_n(DgDp_mp_.begin(),NpNg,
MPDerivative());
2468 DgDp_mp_properties_.resize(NpNg); std::fill_n(DgDp_mp_properties_.begin(),NpNg,
DerivativeProperties());
2473 template<
class Scalar>
2479 ,
"model = \'"<<modelEvalDescription_
2480 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
2482 supports_[arg] = supports_in;
2486 template<
class Scalar>
2493 supports_DfDp_[l] = supports_in;
2497 template<
class Scalar>
2503 supports_DgDx_dot_[j] = supports_in;
2507 template<
class Scalar>
2513 supports_DgDx_[j] = supports_in;
2517 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2519 template<
class Scalar>
2521 EOutArgs_hess_vec_prod_f_xx ,
bool supports_in
2524 supports_hess_vec_prod_f_xx_ = supports_in;
2527 template<
class Scalar>
2529 EOutArgs_hess_vec_prod_f_xp ,
int l,
bool supports_in
2533 supports_hess_vec_prod_f_xp_[l] = supports_in;
2536 template<
class Scalar>
2538 EOutArgs_hess_vec_prod_f_px ,
int l,
bool supports_in
2542 supports_hess_vec_prod_f_px_[l] = supports_in;
2545 template<
class Scalar>
2547 EOutArgs_hess_vec_prod_f_pp ,
int l1,
int l2,
bool supports_in
2552 supports_hess_vec_prod_f_pp_[ l1*Np()+ l2 ] = supports_in;
2555 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2558 template<
class Scalar>
2565 supports_DgDp_[ j*Np()+ l ] = supports_in;
2569 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2571 template<
class Scalar>
2573 EOutArgs_hess_vec_prod_g_xx ,
int j,
bool supports_in
2577 supports_hess_vec_prod_g_xx_[j] = supports_in;
2580 template<
class Scalar>
2582 EOutArgs_hess_vec_prod_g_xp ,
int j,
int l,
bool supports_in
2587 supports_hess_vec_prod_g_xp_[ j*Np()+ l ] = supports_in;
2590 template<
class Scalar>
2592 EOutArgs_hess_vec_prod_g_px ,
int j,
int l,
bool supports_in
2597 supports_hess_vec_prod_g_px_[ j*Np()+ l ] = supports_in;
2600 template<
class Scalar>
2602 EOutArgs_hess_vec_prod_g_pp ,
int j,
int l1,
int l2,
bool supports_in
2608 supports_hess_vec_prod_g_pp_[ j*Np()*Np()+ l1*Np() + l2 ] = supports_in;
2612 template<
class Scalar>
2614 EOutArgs_hess_f_xx ,
bool supports_in
2617 supports_hess_f_xx_ = supports_in;
2620 template<
class Scalar>
2622 EOutArgs_hess_f_xp ,
int l,
bool supports_in
2626 supports_hess_f_xp_[l] = supports_in;
2629 template<
class Scalar>
2631 EOutArgs_hess_f_pp ,
int l1,
int l2,
bool supports_in
2636 supports_hess_f_pp_[ l1*Np()+ l2 ] = supports_in;
2639 template<
class Scalar>
2641 EOutArgs_hess_g_xx ,
int j,
bool supports_in
2645 supports_hess_g_xx_[j] = supports_in;
2648 template<
class Scalar>
2650 EOutArgs_hess_g_xp ,
int j,
int l,
bool supports_in
2655 supports_hess_g_xp_[ j*Np()+ l ] = supports_in;
2658 template<
class Scalar>
2660 EOutArgs_hess_g_pp ,
int j,
int l1,
int l2,
bool supports_in
2666 supports_hess_g_pp_[ j*Np()*Np()+ l1*Np() + l2 ] = supports_in;
2669 template<
class Scalar>
2671 EOutArgs_H_xx ,
bool supports_in
2674 supports_H_xx_ = supports_in;
2677 template<
class Scalar>
2679 EOutArgs_H_xp ,
int l,
bool supports_in
2683 supports_H_xp_[l] = supports_in;
2686 template<
class Scalar>
2688 EOutArgs_H_pp ,
int l1,
int l2,
bool supports_in
2693 supports_H_pp_[ l1*Np()+ l2 ] = supports_in;
2696 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2699 template<
class Scalar>
2706 supports_g_mp_[j] = supports_in;
2710 template<
class Scalar>
2717 supports_DfDp_mp_[l] = supports_in;
2721 template<
class Scalar>
2727 supports_DgDx_dot_mp_[j] = supports_in;
2731 template<
class Scalar>
2737 supports_DgDx_mp_[j] = supports_in;
2741 template<
class Scalar>
2748 supports_DgDp_mp_[ j*Np()+ l ] = supports_in;
2752 template<
class Scalar>
2757 W_properties_ = properties;
2761 template<
class Scalar>
2767 DfDp_properties_[l] = properties;
2771 template<
class Scalar>
2777 DgDx_dot_properties_[j] = properties;
2781 template<
class Scalar>
2787 DgDx_properties_[j] = properties;
2791 template<
class Scalar>
2797 DgDp_properties_[ j*Np()+ l ] = properties;
2801 template<
class Scalar>
2807 DfDp_mp_properties_[l] = properties;
2811 template<
class Scalar>
2813 int j,
const DerivativeProperties &properties
2817 DgDx_dot_mp_properties_[j] = properties;
2821 template<
class Scalar>
2822 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_mp_properties(
2823 int j,
const DerivativeProperties &properties
2827 DgDx_mp_properties_[j] = properties;
2831 template<
class Scalar>
2832 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDp_mp_properties(
2833 int j,
int l,
const DerivativeProperties &properties
2837 DgDp_mp_properties_[ j*Np()+ l ] = properties;
2841 template<
class Scalar>
2847 const int l_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.
Np());
2848 const int l_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.
Ng());
2850 &inputOutArgs.supports_[0],
2852 for(
int l = 0; l < l_Np; ++l ) {
2855 this->_setSupports(MEB::OUT_ARG_DfDp,l,ds);
2859 for(
int l = 0; l < l_Np; ++l ) {
2862 this->_setSupports(MEB::OUT_ARG_DfDp_mp,l,ds);
2863 this->_set_DfDp_mp_properties(l,inputOutArgs.get_DfDp_mp_properties(l));
2866 for(
int j = 0; j < l_Ng; ++j ) {
2868 this->_setSupports(MEB::OUT_ARG_DgDx_dot,j,ds);
2871 for(
int j = 0; j < l_Ng; ++j ) {
2873 this->_setSupports(MEB::OUT_ARG_DgDx_dot_mp,j,ds);
2874 if(!ds.
none()) this->_set_DgDx_dot_mp_properties(j,inputOutArgs.get_DgDx_dot_mp_properties(j));
2876 for(
int j = 0; j < l_Ng; ++j ) {
2878 this->_setSupports(MEB::OUT_ARG_DgDx,j,ds);
2881 for(
int j = 0; j < l_Ng; ++j ) {
2883 this->_setSupports(MEB::OUT_ARG_DgDx_mp,j,ds);
2884 if(!ds.
none()) this->_set_DgDx_mp_properties(j,inputOutArgs.get_DgDx_mp_properties(j));
2886 for(
int j = 0; j < l_Ng; ++j )
for(
int l = 0; l < l_Np; ++l ) {
2888 this->_setSupports(MEB::OUT_ARG_DgDp,j,l,ds);
2891 for(
int j = 0; j < l_Ng; ++j )
for(
int l = 0; l < l_Np; ++l ) {
2893 this->_setSupports(MEB::OUT_ARG_DgDp_mp,j,l,ds);
2894 if(!ds.
none()) this->_set_DgDp_mp_properties(j,l,inputOutArgs.get_DgDp_mp_properties(j,l));
2901 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2902 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xx,inputOutArgs.
supports(OUT_ARG_hess_vec_prod_f_xx));
2903 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2904 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1));
2905 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_px,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_f_px,l1));
2906 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2907 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2));
2910 for(
int j = 0; j < l_Ng; ++j ) {
2911 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xx,j,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_xx,j));
2912 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2913 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1));
2914 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1));
2915 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2916 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));
2920 this->_setSupports(MEB::OUT_ARG_hess_f_xx,inputOutArgs.
supports(OUT_ARG_hess_f_xx));
2921 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2922 this->_setSupports(MEB::OUT_ARG_hess_f_xp,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_f_xp,l1));
2923 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2924 this->_setSupports(MEB::OUT_ARG_hess_f_pp,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_f_pp,l1,l2));
2927 for(
int j = 0; j < l_Ng; ++j ) {
2928 this->_setSupports(MEB::OUT_ARG_hess_g_xx,j,inputOutArgs.
supports(MEB::OUT_ARG_hess_g_xx,j));
2929 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2930 this->_setSupports(MEB::OUT_ARG_hess_g_xp,j,l1,inputOutArgs.
supports(MEB::OUT_ARG_hess_g_xp,j,l1));
2931 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2932 this->_setSupports(MEB::OUT_ARG_hess_g_pp,j,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_hess_g_pp,j,l1,l2));
2936 this->_setSupports(MEB::OUT_ARG_H_xx,inputOutArgs.
supports(OUT_ARG_H_xx));
2937 for(
int l1 = 0; l1 < l_Np; ++l1 ) {
2938 this->_setSupports(MEB::OUT_ARG_H_xp,l1,inputOutArgs.
supports(MEB::OUT_ARG_H_xp,l1));
2939 for(
int l2 = 0; l2 < l_Np; ++l2 ) {
2940 this->_setSupports(MEB::OUT_ARG_H_pp,l1,l2,inputOutArgs.
supports(MEB::OUT_ARG_H_pp,l1,l2));
2943 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2945 extended_outargs_ = inputOutArgs.extended_outargs_;
2949 template<
class Scalar>
2956 const int l_Ng = this->Ng();
2957 for(
int j = 0; j < l_Ng; ++j ) {
2964 const int l_Ng = this->Ng();
2965 for(
int j = 0; j < l_Ng; ++j ) {
2973 true ,std::logic_error,
2974 "Error, can not handle args other than IN_ARG_x yet!"
2980 template<
class Scalar>
2990 const int l_Np = this->Np();
2991 for(
int l = 0; l < l_Np; ++l )
2999 const int l_Np = this->Np();
3000 for(
int l = 0; l < l_Np; ++l )
3006 true ,std::logic_error,
3007 "Error, can not handle args other than OUT_ARG_f yet!"
3010 this->_setSupports(arg,
false);
3013 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3014 template<
class Scalar>
3020 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xx,supports);
3021 this->_setSupports(MEB::OUT_ARG_hess_f_xx,supports);
3022 this->_setSupports(MEB::OUT_ARG_H_xx,supports);
3023 for (
int l1=0; l1<this->Np(); ++l1)
3025 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1,supports);
3026 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_px,l1,supports);
3027 this->_setSupports(MEB::OUT_ARG_hess_f_xp,l1,supports);
3028 this->_setSupports(MEB::OUT_ARG_H_xp,l1,supports);
3029 for (
int l2=0; l2<this->Np(); ++l2)
3031 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2,supports);
3032 this->_setSupports(MEB::OUT_ARG_hess_f_pp,l1,l2,supports);
3033 this->_setSupports(MEB::OUT_ARG_H_pp,l1,l2,supports);
3037 for (
int j=0; j<this->Ng(); ++j)
3039 this->_setSupports(MEB::OUT_ARG_hess_g_xx,j,supports);
3040 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xx,j,supports);
3041 for (
int l1=0; l1<this->Np(); ++l1)
3043 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1,supports);
3044 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1,supports);
3045 this->_setSupports(MEB::OUT_ARG_hess_g_xp,j,l1,supports);
3046 for (
int l2=0; l2<this->Np(); ++l2)
3048 this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2,supports);
3049 this->_setSupports(MEB::OUT_ARG_hess_g_pp,j,l1,l2,supports);
3054 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3059 template<
class Scalar>
3060 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
EOutArgsMembers arg)
const
3063 !this->supports(arg), std::logic_error
3064 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(arg):\n\n"
3065 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3066 "Error, The argument arg = " <<
toString(arg) <<
" is not supported!"
3071 template<
class Scalar>
3072 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3073 EOutArgsDfDp arg,
int l,
const Derivative<Scalar> &deriv
3076 const DerivativeSupport derivSupport = this->supports(arg,l);
3078 !deriv.isSupportedBy(derivSupport), std::logic_error,
3079 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp,l):\n\n"
3080 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3081 "Error, The argument DfDp("<<l<<
") = " << deriv.description() <<
"\n"
3082 "is not supported!\n\n"
3083 "The supported types include " << derivSupport.description() <<
"!"
3088 template<
class Scalar>
3089 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3093 const DerivativeSupport derivSupport = this->supports(arg,j);
3095 !deriv.isSupportedBy(derivSupport), std::logic_error,
3096 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot,j):\n\n"
3097 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3098 "Error, The argument DgDx_dot("<<j<<
") = " << deriv.description() <<
"\n"
3099 "is not supported!\n\n"
3100 "The supported types include " << derivSupport.description() <<
"!"
3105 template<
class Scalar>
3106 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3107 EOutArgsDgDx arg,
int j,
const Derivative<Scalar> &deriv
3110 const DerivativeSupport derivSupport = this->supports(arg,j);
3112 !deriv.isSupportedBy(derivSupport), std::logic_error,
3113 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx,j):\n\n"
3114 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3115 "Error, The argument DgDx("<<j<<
") = " << deriv.description() <<
"\n"
3116 "is not supported!\n\n"
3117 "The supported types include " << derivSupport.description() <<
"!"
3122 template<
class Scalar>
3123 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3124 EOutArgsDgDp arg,
int j,
int l,
const Derivative<Scalar> &deriv
3127 const DerivativeSupport derivSupport = this->supports(arg,j,l);
3129 !deriv.isSupportedBy(derivSupport), std::logic_error,
3130 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp,j,l):\n\n"
3131 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3132 "Error, The argument DgDp("<<j<<
","<<l<<
") = " << deriv.description() <<
"\n"
3133 "is not supported!\n\n"
3134 "The supported types include " << derivSupport.description() <<
"!"
3139 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3141 template<
class Scalar>
3142 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3143 EOutArgs_hess_vec_prod_f_xx arg
3146 const bool support = this->supports(arg);
3148 !support, std::logic_error,
3149 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_xx):\n\n"
3150 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3151 "Error, The argument hess_vec_prod_f_xx() is not supported!"
3155 template<
class Scalar>
3156 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3157 EOutArgs_hess_vec_prod_f_xp arg,
int l
3160 const bool support = this->supports(arg,l);
3162 !support, std::logic_error,
3163 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_xp,l):\n\n"
3164 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3165 "Error, The argument hess_vec_prod_f_xp("<<l<<
") is not supported!"
3169 template<
class Scalar>
3170 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3171 EOutArgs_hess_vec_prod_f_px arg,
int l
3174 const bool support = this->supports(arg,l);
3176 !support, std::logic_error,
3177 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_px,l):\n\n"
3178 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3179 "Error, The argument hess_vec_prod_f_px("<<l<<
") is not supported!"
3183 template<
class Scalar>
3184 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3185 EOutArgs_hess_vec_prod_f_pp arg,
int l1,
int l2
3188 const bool support = this->supports(arg,l1,l2);
3190 !support, std::logic_error,
3191 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2):\n\n"
3192 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3193 "Error, The argument hess_vec_prod_f_pp("<<l1<<
","<<l2<<
") is not supported!"
3197 template<
class Scalar>
3198 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3199 EOutArgs_hess_vec_prod_g_xx arg,
int j
3202 const bool support = this->supports(arg,j);
3204 !support, std::logic_error,
3205 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_xx,j):\n\n"
3206 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3207 "Error, The argument hess_vec_prod_g_xx("<<j<<
") is not supported!"
3211 template<
class Scalar>
3212 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3213 EOutArgs_hess_vec_prod_g_xp arg,
int j,
int l
3216 const bool support = this->supports(arg,j,l);
3218 !support, std::logic_error,
3219 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l):\n\n"
3220 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3221 "Error, The argument hess_vec_prod_g_xp("<<j<<
","<<l<<
") is not supported!"
3225 template<
class Scalar>
3226 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3227 EOutArgs_hess_vec_prod_g_px arg,
int j,
int l
3230 const bool support = this->supports(arg,j,l);
3232 !support, std::logic_error,
3233 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l):\n\n"
3234 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3235 "Error, The argument hess_vec_prod_g_px("<<j<<
","<<l<<
") is not supported!"
3239 template<
class Scalar>
3240 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3241 EOutArgs_hess_vec_prod_g_pp arg,
int j,
int l1,
int l2
3244 const bool support = this->supports(arg,j,l1,l2);
3246 !support, std::logic_error,
3247 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2):\n\n"
3248 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3249 "Error, The argument hess_vec_prod_g_pp("<<j<<
","<<l1<<
","<<l2<<
") is not supported!"
3253 template<
class Scalar>
3254 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3255 EOutArgs_hess_f_xx arg
3258 const bool support = this->supports(arg);
3260 !support, std::logic_error,
3261 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_xx):\n\n"
3262 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3263 "Error, The argument hess_f_xx() is not supported!"
3267 template<
class Scalar>
3268 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3269 EOutArgs_hess_f_xp arg,
int l
3272 const bool support = this->supports(arg,l);
3274 !support, std::logic_error,
3275 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_xp,l):\n\n"
3276 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3277 "Error, The argument hess_f_xp() is not supported!"
3281 template<
class Scalar>
3282 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3283 EOutArgs_hess_f_pp arg,
int l1,
int l2
3286 const bool support = this->supports(arg,l1,l2);
3288 !support, std::logic_error,
3289 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_pp,l1,l2):\n\n"
3290 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3291 "Error, The argument hess_f_pp() is not supported!"
3295 template<
class Scalar>
3296 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3297 EOutArgs_hess_g_xx arg,
int j
3300 const bool support = this->supports(arg,j);
3302 !support, std::logic_error,
3303 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_xx,j):\n\n"
3304 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3305 "Error, The argument hess_g_xx() is not supported!"
3309 template<
class Scalar>
3310 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3311 EOutArgs_hess_g_xp arg,
int j,
int l
3314 const bool support = this->supports(arg,j,l);
3316 !support, std::logic_error,
3317 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_xp,j,l):\n\n"
3318 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3319 "Error, The argument hess_g_xp() is not supported!"
3323 template<
class Scalar>
3324 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3325 EOutArgs_hess_g_pp arg,
int j,
int l1,
int l2
3328 const bool support = this->supports(arg,j,l1,l2);
3330 !support, std::logic_error,
3331 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_pp,j,l1,l2):\n\n"
3332 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3333 "Error, The argument hess_g_pp() is not supported!"
3337 template<
class Scalar>
3338 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3342 const bool support = this->supports(arg);
3344 !support, std::logic_error,
3345 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_xx):\n\n"
3346 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3347 "Error, The argument H_xx() is not supported!"
3351 template<
class Scalar>
3352 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3353 EOutArgs_H_xp arg,
int l
3356 const bool support = this->supports(arg,l);
3358 !support, std::logic_error,
3359 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_xp,l):\n\n"
3360 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3361 "Error, The argument H_xp() is not supported!"
3365 template<
class Scalar>
3366 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3367 EOutArgs_H_pp arg,
int l1,
int l2
3370 const bool support = this->supports(arg,l1,l2);
3372 !support, std::logic_error,
3373 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_pp,l1,l2):\n\n"
3374 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3375 "Error, The argument H_pp() is not supported!"
3379 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3382 template<
class Scalar>
3383 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3389 !supports_g_mp_[j], std::logic_error,
3390 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_g_mp,j):\n\n"
3391 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3392 "Error, The argument g_mp("<<j<<
") \n"
3393 "is not supported!\n\n"
3398 template<
class Scalar>
3399 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3403 const DerivativeSupport derivSupport = this->supports(arg,l);
3405 !deriv.isSupportedBy(derivSupport), std::logic_error,
3406 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp_mp,l):\n\n"
3407 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3408 "Error, The argument DfDp_mp("<<l<<
") = " << deriv.description() <<
"\n"
3409 "is not supported!\n\n"
3410 "The supported types include " << derivSupport.description() <<
"!"
3415 template<
class Scalar>
3416 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3420 const DerivativeSupport derivSupport = this->supports(arg,j);
3422 !deriv.isSupportedBy(derivSupport), std::logic_error,
3423 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot_mp,j):\n\n"
3424 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3425 "Error, The argument DgDx_dot_mp("<<j<<
") = " << deriv.description() <<
"\n"
3426 "is not supported!\n\n"
3427 "The supported types include " << derivSupport.description() <<
"!"
3432 template<
class Scalar>
3433 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3437 const DerivativeSupport derivSupport = this->supports(arg,j);
3439 !deriv.isSupportedBy(derivSupport), std::logic_error,
3440 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_mp,j):\n\n"
3441 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3442 "Error, The argument DgDx_mp("<<j<<
") = " << deriv.description() <<
"\n"
3443 "is not supported!\n\n"
3444 "The supported types include " << derivSupport.description() <<
"!"
3449 template<
class Scalar>
3450 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3454 const DerivativeSupport derivSupport = this->supports(arg,j,l);
3456 !deriv.isSupportedBy(derivSupport), std::logic_error,
3457 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp_mp,j,l):\n\n"
3458 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3459 "Error, The argument DgDp_mp("<<j<<
","<<l<<
") = " << deriv.description() <<
"\n"
3460 "is not supported!\n\n"
3461 "The supported types include " << derivSupport.description() <<
"!"
3466 template<
class Scalar>
3467 void ModelEvaluatorBase::OutArgs<Scalar>::assert_l(
int l)
const
3470 !( 0 <= l && l < Np() ), std::logic_error
3471 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_l(l):\n\n"
3472 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3473 "Error, The parameter subvector p("<<l<<
")"
3474 " is not in the range [0,"<<Np()<<
")!"
3479 template<
class Scalar>
3480 void ModelEvaluatorBase::OutArgs<Scalar>::assert_j(
int j)
const
3483 !( 0 <= j && j < Ng() ), std::logic_error
3484 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_j(j):\n\n"
3485 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
3486 "Error, The auxiliary function g("<<j<<
")"
3487 " is not in the range [0,"<<Ng()<<
")!"
3497 template<
class Scalar>
3502 template<
class Scalar>
3508 template<
class Scalar>
3510 const std::string &modelEvalDescription_in )
3512 this->_setModelEvalDescription(modelEvalDescription_in);
3516 template<
class Scalar>
3518 { this->_set_Np_Ng(Np_in, 0); }
3520 template<
class Scalar>
3522 { this->_set_Np_Ng(Np_in, Ng_in); }
3524 template<
class Scalar>
3526 { this->_setSupports(arg,supports_in); }
3529 template<
class Scalar>
3531 { this->_setSupports(arg,l,supports_in); }
3534 template<
class Scalar>
3539 this->_setSupports(inArgs, Np_in);
3543 template<
class Scalar>
3548 this->_setUnsupportsAndRelated(arg);
3557 template<
class Scalar>
3562 template<
class Scalar>
3566 :
OutArgs<Scalar>(inputOutArgs)
3570 template<
class Scalar>
3572 const std::string &modelEvalDescription_in
3574 { this->_setModelEvalDescription(modelEvalDescription_in); }
3577 template<
class Scalar>
3579 { this->_set_Np_Ng(Np_in, Ng_in); }
3582 template<
class Scalar>
3586 { this->_setSupports(arg,supports_in); }
3589 template<
class Scalar>
3593 { this->_setSupports(arg,l,supports_in); }
3596 template<
class Scalar>
3600 { this->_setSupports(arg,j,supports_in); }
3603 template<
class Scalar>
3607 { this->_setSupports(arg,j,supports_in); }
3610 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3612 template<
class Scalar>
3614 EOutArgs_hess_vec_prod_f_xx arg,
bool supports_in
3616 { this->_setSupports(arg,supports_in); }
3618 template<
class Scalar>
3620 EOutArgs_hess_vec_prod_f_xp arg,
int l,
bool supports_in
3622 { this->_setSupports(arg,l,supports_in); }
3624 template<
class Scalar>
3626 EOutArgs_hess_vec_prod_f_px arg,
int l,
bool supports_in
3628 { this->_setSupports(arg,l,supports_in); }
3630 template<
class Scalar>
3632 EOutArgs_hess_vec_prod_f_pp arg,
int l1,
int l2,
bool supports_in
3634 { this->_setSupports(arg,l1,l2,supports_in); }
3636 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3639 template<
class Scalar>
3643 { this->_setSupports(arg,j,l,supports_in); }
3646 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3648 template<
class Scalar>
3650 EOutArgs_hess_vec_prod_g_xx arg,
int j,
bool supports_in
3652 { this->_setSupports(arg,j,supports_in); }
3654 template<
class Scalar>
3656 EOutArgs_hess_vec_prod_g_xp arg,
int j,
int l,
bool supports_in
3658 { this->_setSupports(arg,j,l,supports_in); }
3660 template<
class Scalar>
3662 EOutArgs_hess_vec_prod_g_px arg,
int j,
int l,
bool supports_in
3664 { this->_setSupports(arg,j,l,supports_in); }
3666 template<
class Scalar>
3668 EOutArgs_hess_vec_prod_g_pp arg,
int j,
int l1,
int l2,
bool supports_in
3670 { this->_setSupports(arg,j,l1,l2,supports_in); }
3672 template<
class Scalar>
3674 EOutArgs_hess_f_xx arg,
bool supports_in
3676 { this->_setSupports(arg,supports_in); }
3678 template<
class Scalar>
3680 EOutArgs_hess_f_xp arg,
int l,
bool supports_in
3682 { this->_setSupports(arg,l,supports_in); }
3684 template<
class Scalar>
3686 EOutArgs_hess_f_pp arg,
int l1,
int l2,
bool supports_in
3688 { this->_setSupports(arg,l1,l2,supports_in); }
3690 template<
class Scalar>
3692 EOutArgs_hess_g_xx arg,
int j,
bool supports_in
3694 { this->_setSupports(arg,j,supports_in); }
3696 template<
class Scalar>
3698 EOutArgs_hess_g_xp arg,
int j,
int l,
bool supports_in
3700 { this->_setSupports(arg,j,l,supports_in); }
3702 template<
class Scalar>
3704 EOutArgs_hess_g_pp arg,
int j,
int l1,
int l2,
bool supports_in
3706 { this->_setSupports(arg,j,l1,l2,supports_in); }
3708 template<
class Scalar>
3710 EOutArgs_H_xx arg,
bool supports_in
3712 { this->_setSupports(arg,supports_in); }
3714 template<
class Scalar>
3716 EOutArgs_H_xp arg,
int l,
bool supports_in
3718 { this->_setSupports(arg,l,supports_in); }
3720 template<
class Scalar>
3722 EOutArgs_H_pp arg,
int l1,
int l2,
bool supports_in
3724 { this->_setSupports(arg,l1,l2,supports_in); }
3726 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3729 template<
class Scalar>
3733 { this->_setSupports(arg,j,supports_in); }
3736 template<
class Scalar>
3740 { this->_setSupports(arg,l,supports_in); }
3743 template<
class Scalar>
3747 { this->_setSupports(arg,j,supports_in); }
3750 template<
class Scalar>
3754 { this->_setSupports(arg,j,supports_in); }
3757 template<
class Scalar>
3759 EOutArgsDgDp_mp arg,
int j,
int l,
const DerivativeSupport& supports_in
3761 { this->_setSupports(arg,j,l,supports_in); }
3764 template<
class Scalar>
3768 { this->_set_W_properties(properties); }
3771 template<
class Scalar>
3775 { this->_set_DfDp_properties(l,properties); }
3778 template<
class Scalar>
3782 { this->_set_DgDx_dot_properties(j,properties); }
3785 template<
class Scalar>
3789 { this->_set_DgDx_properties(j,properties); }
3792 template<
class Scalar>
3796 { this->_set_DgDp_properties(j,l,properties); }
3799 template<
class Scalar>
3803 { this->_set_DfDp_mp_properties(l,properties); }
3806 template<
class Scalar>
3808 int j,
const DerivativeProperties &properties
3810 { this->_set_DgDx_dot_mp_properties(j,properties); }
3813 template<
class Scalar>
3814 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_mp_properties(
3815 int j,
const DerivativeProperties &properties
3817 { this->_set_DgDx_mp_properties(j,properties); }
3820 template<
class Scalar>
3821 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDp_mp_properties(
3822 int j,
int l,
const DerivativeProperties &properties
3824 { this->_set_DgDp_mp_properties(j,l,properties); }
3827 template<
class Scalar>
3831 { this->_setSupports(inputOutArgs); }
3834 template<
class Scalar>
3838 { this->_setUnsupportsAndRelated(arg); }
3841 template<
class Scalar>
3845 { this->_setUnsupportsAndRelated(arg); }
3848 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3849 template<
class Scalar>
3853 { this->_setHessianSupports(supports); }
3854 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3867 #define THYRA_MODEL_EVALUATOR_BASE_INSTANT(SCALAR) \
3869 template class ModelEvaluatorBase::InArgs<SCALAR >; \
3871 template std::string \
3872 ModelEvaluatorBase::Derivative<SCALAR >::description() const; \
3875 void ModelEvaluatorBase::Derivative<SCALAR >::describe( \
3876 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel \
3879 template class ModelEvaluatorBase::OutArgs<SCALAR >; \
3881 template class ModelEvaluatorBase::InArgsSetup<SCALAR >; \
3883 template class ModelEvaluatorBase::OutArgsSetup<SCALAR >;
3886 #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...