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();
73 RCP<const Stokhos::ProductEpetraVector >
75 const RCP<const Stokhos::ProductEpetraVector > &vec,
81 printf(
"Warning: clone_v not implemented for ProductEpetraVector: %s %d\n",__FILE__,__LINE__);
95 template<
class Scalar>
97 :modelEvalDescription_(
"WARNING! THIS INARGS OBJECT IS UNINITIALIZED!")
101 std::fill_n(&supports_[0],NUM_E_IN_ARGS_MEMBERS,
false);
105 step_size_ = ST::zero();
106 stage_number_ = ST::one();
110 template<
class Scalar>
112 {
return p_.size(); }
114 template<
class Scalar>
118 int(arg)>=NUM_E_IN_ARGS_MEMBERS ||
int(arg) < 0,std::logic_error
119 ,
"model = \'"<<modelEvalDescription_
120 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
122 return supports_[arg];
125 template<
class Scalar>
129 return supports_p_mp_[l];
132 template<
class Scalar>
136 { assert_supports(IN_ARG_x_dot_dot); x_dot_dot_ = x_dot_dot; }
138 template<
class Scalar>
141 { assert_supports(IN_ARG_x_dot_dot);
return x_dot_dot_; }
143 template<
class Scalar>
147 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
150 template<
class Scalar>
153 { assert_supports(IN_ARG_x_dot);
return x_dot_; }
156 template<
class Scalar>
160 { assert_supports(IN_ARG_x); x_ = x; }
163 template<
class Scalar>
166 { assert_supports(IN_ARG_x);
return x_; }
169 template<
class Scalar>
173 { assert_supports(IN_ARG_x_dot_mp); x_dot_mp_ = x_dot_mp; }
176 template<
class Scalar>
179 { assert_supports(IN_ARG_x_dot_mp);
return x_dot_mp_; }
182 template<
class Scalar>
186 { assert_supports(IN_ARG_x_mp); x_mp_ = x_mp; }
189 template<
class Scalar>
192 { assert_supports(IN_ARG_x_mp);
return x_mp_; }
195 #ifdef HAVE_THYRA_ME_POLYNOMIAL
197 template<
class Scalar>
201 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
204 template<
class Scalar>
207 { assert_supports(IN_ARG_x_dot_poly);
return x_dot_poly_; }
210 template<
class Scalar>
211 void ModelEvaluatorBase::InArgs<Scalar>::set_x_poly(
214 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
217 template<
class Scalar>
218 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
219 ModelEvaluatorBase::InArgs<Scalar>::get_x_poly()
const
220 { assert_supports(IN_ARG_x_poly);
return x_poly_; }
223 #endif // HAVE_THYRA_ME_POLYNOMIAL
225 template<
class Scalar>
229 { assert_l(l); p_[l] = p_l; }
232 template<
class Scalar>
235 { assert_l(l);
return p_[l]; }
238 template<
class Scalar>
242 { assert_supports(IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; }
244 template<
class Scalar>
247 { assert_supports(IN_ARG_p_mp, l);
return p_mp_[l]; }
250 template<
class Scalar>
252 { assert_supports(IN_ARG_t); t_ = t; }
255 template<
class Scalar>
258 { assert_supports(IN_ARG_t);
return t_; }
261 template<
class Scalar>
263 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
266 template<
class Scalar>
268 { assert_supports(IN_ARG_alpha);
return alpha_; }
271 template<
class Scalar>
273 { assert_supports(IN_ARG_beta); beta_ = beta; }
276 template<
class Scalar>
278 { assert_supports(IN_ARG_beta);
return beta_; }
280 template<
class Scalar>
282 { assert_supports(IN_ARG_W_x_dot_dot_coeff); W_x_dot_dot_coeff_ = W_x_dot_dot_coeff; }
285 template<
class Scalar>
287 { assert_supports(IN_ARG_W_x_dot_dot_coeff);
return W_x_dot_dot_coeff_; }
289 template<
class Scalar>
291 { assert_supports(IN_ARG_step_size); step_size_ = step_size; }
293 template<
class Scalar>
295 { assert_supports(IN_ARG_step_size);
return step_size_; }
297 template<
class Scalar>
299 { assert_supports(IN_ARG_stage_number);
return stage_number_; }
302 template<
class Scalar>
304 { assert_supports(IN_ARG_stage_number); stage_number_ = stage_number; }
307 template<
class Scalar>
309 const InArgs<Scalar>& inArgs,
bool ignoreUnsupported,
bool cloneObjects
312 using ModelEvaluatorHelperPack::condCloneVec;
313 using ModelEvaluatorHelperPack::condCloneVec_mp;
315 if(supports(IN_ARG_x_dot_dot) || !ignoreUnsupported)
316 set_x_dot_dot(condCloneVec(inArgs.
get_x_dot_dot(),cloneObjects));
319 if(supports(IN_ARG_x_dot) || !ignoreUnsupported)
320 set_x_dot(condCloneVec(inArgs.
get_x_dot(),cloneObjects));
323 if(supports(IN_ARG_x_dot_mp) || !ignoreUnsupported)
324 set_x_dot_mp(condCloneVec_mp(inArgs.
get_x_dot_mp(),cloneObjects));
327 if(supports(IN_ARG_x) || !ignoreUnsupported)
328 set_x(condCloneVec(inArgs.
get_x(),cloneObjects));
331 if(supports(IN_ARG_x_mp) || !ignoreUnsupported)
332 set_x_mp(condCloneVec_mp(inArgs.
get_x_mp(),cloneObjects));
334 #ifdef HAVE_THYRA_ME_POLYNOMIAL
335 if( inArgs.
supports(IN_ARG_x_dot_poly) &&
nonnull(inArgs.get_x_dot_poly()) ) {
336 if(supports(IN_ARG_x_dot_poly) || !ignoreUnsupported) {
338 cloneObjects &&
"Have not implemented cloning for x_dot_poly yet!" );
339 set_x_dot_poly(inArgs.get_x_dot_poly());
343 if(supports(IN_ARG_x_poly) || !ignoreUnsupported) {
345 cloneObjects &&
"Have not implemented cloning for x_poly yet!" );
346 set_x_poly(inArgs.get_x_poly());
349 #endif // HAVE_THYRA_ME_POLYNOMIAL
350 const int min_Np = TEUCHOS_MIN(this->Np(),inArgs.
Np());
351 for (
int l = 0; l < min_Np; ++l) {
353 set_p(l,condCloneVec(inArgs.
get_p(l),cloneObjects));
355 for (
int l = 0; l < min_Np; ++l) {
356 if (inArgs.
supports(IN_ARG_p_mp,l)) {
357 if (
nonnull(inArgs.get_p_mp(l)))
358 set_p_mp(l,condCloneVec_mp(inArgs.get_p_mp(l),cloneObjects));
362 if(supports(IN_ARG_t) || !ignoreUnsupported)
363 set_t(inArgs.
get_t());
365 if (inArgs.
supports(IN_ARG_alpha)) {
366 if(supports(IN_ARG_alpha) || !ignoreUnsupported)
370 if(supports(IN_ARG_beta) || !ignoreUnsupported)
373 if (inArgs.
supports(IN_ARG_W_x_dot_dot_coeff)) {
374 if(supports(IN_ARG_W_x_dot_dot_coeff) || !ignoreUnsupported)
377 if (inArgs.
supports(IN_ARG_step_size)) {
378 if(supports(IN_ARG_step_size) || !ignoreUnsupported)
381 if (inArgs.
supports(IN_ARG_stage_number)) {
382 if(supports(IN_ARG_stage_number) || !ignoreUnsupported)
386 if (extended_inargs_.size() > 0)
389 "Extended InArgs does not support cloning!");
390 this->extended_inargs_ = inArgs.extended_inargs_;
394 template<
class Scalar>
399 for (
int inArg_i = 0; inArg_i < NUM_E_IN_ARGS_MEMBERS; ++inArg_i ) {
400 const EInArgsMembers inArg_arg = static_cast<EInArgsMembers>(inArg_i);
401 const std::string inArg_name =
toString(inArg_arg);
403 supports(inArg_arg) != inArgs.
supports(inArg_arg), std::logic_error,
404 "Error, the input argument "<<inArg_name<<
" with support "<<inArgs.
supports(inArg_arg)<<
"\n"
405 "in the InArgs object for the model:\n\n"
407 "is not the same the argument "<<inArg_name<<
" with support "<<supports(inArg_arg)<<
"\n"
408 "in the InArgs object for the model:\n\n"
409 " "<<modelEvalDescription()<<
"\n\n"
410 "and these two InArgs objects are not compatible!"
417 template<
class Scalar>
420 return modelEvalDescription_;
424 template<
class Scalar>
428 std::ostringstream oss;
430 <<
"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<
">"
432 <<
"model="<<modelEvalDescription_
439 template<
class Scalar>
447 using Teuchos::describe;
448 using Teuchos::includesVerbLevel;
455 out = Teuchos::rcp(&out_arg,
false);
466 *out <<
"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<
">:\n";
469 *out <<
"model = " << modelEvalDescription_ <<
"\n";
470 *out <<
"Np = " << Np() <<
"\n";
473 if ( this->supports(IN_ARG_x_dot_dot) && !
is_null(x_dot_dot=get_x_dot_dot()) ) {
474 *out <<
"x_dot_dot = " << Teuchos::describe(*x_dot_dot,x_verbLevel);
476 *out <<
"||x_dot_dot|| = " <<
norm(*x_dot_dot) << endl;
480 if ( this->supports(IN_ARG_x_dot) && !
is_null(x_dot=get_x_dot()) ) {
481 *out <<
"x_dot = " << Teuchos::describe(*x_dot,x_verbLevel);
483 *out <<
"||x_dot|| = " <<
norm(*x_dot) << endl;
487 if ( this->supports(IN_ARG_x) && !
is_null(x=get_x()) ) {
488 *out <<
"x = " << Teuchos::describe(*x,x_verbLevel);
490 *out <<
"||x|| = " <<
norm(*x) << endl;
494 for(
int l = 0; l < Np(); ++l ) {
496 if ( !
is_null(p_l = this->get_p(l)) ) {
497 *out <<
"p("<<l<<
") = " << Teuchos::describe(*p_l,p_verbLevel);
499 *out <<
"||p("<<l<<
")|| = " <<
norm(*p_l) << endl;
505 if (this->supports(IN_ARG_t)) {
506 *out <<
"t = " << t_ << endl;
508 if (this->supports(IN_ARG_alpha)) {
509 *out <<
"alpha = " << alpha_ << endl;
511 if (this->supports(IN_ARG_beta)) {
512 *out <<
"beta = " << beta_ << endl;
514 if (this->supports(IN_ARG_W_x_dot_dot_coeff)) {
515 *out <<
"W_x_dot_dot_coeff = " << W_x_dot_dot_coeff_ << endl;
517 if (this->supports(IN_ARG_step_size)) {
518 *out <<
"step_size = " << step_size_ << endl;
520 if (this->supports(IN_ARG_stage_number)) {
521 *out <<
"stage_number = " << stage_number_ << endl;
528 template<
class Scalar>
530 const std::string &modelEvalDescription_in
533 modelEvalDescription_ = modelEvalDescription_in;
537 template<
class Scalar>
542 supports_p_mp_.resize(Np_in);
546 template<
class Scalar>
552 int(arg)>=NUM_E_IN_ARGS_MEMBERS ||
int(arg) < 0,std::logic_error
553 ,
"model = \'"<<modelEvalDescription_
554 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!");
555 supports_[arg] = supports_in;
558 template<
class Scalar>
564 supports_p_mp_[l] = supports_in;
568 template<
class Scalar>
574 &inArgs.supports_[0],
575 &inArgs.supports_[0] + NUM_E_IN_ARGS_MEMBERS, &supports_[0] );
576 this->_set_Np( Np_in >= 0 ? Np_in : inArgs.
Np() );
580 template<
class Scalar>
587 this->_setSupports(IN_ARG_x_dot_dot,
false);
588 this->_setSupports(IN_ARG_x_dot,
false);
589 this->_setSupports(IN_ARG_x_dot_poly,
false);
590 this->_setSupports(IN_ARG_alpha,
false);
591 this->_setSupports(IN_ARG_beta,
false);
592 this->_setSupports(IN_ARG_W_x_dot_dot_coeff,
false);
593 this->_setSupports(IN_ARG_step_size,
false);
594 this->_setSupports(IN_ARG_stage_number,
false);
599 true ,std::logic_error,
600 "Error, can not handle args other than IN_ARG_x yet!"
603 this->_setSupports(arg,
false);
607 template<
class Scalar>
613 !supports_[arg], std::logic_error
614 ,
"Thyra::ModelEvaluatorBase::InArgs<"
616 "model = \'"<<modelEvalDescription_<<
"\': Error, "
617 "The argument arg = " <<
toString(arg) <<
" is not supported!"
621 template<
class Scalar>
623 EInArgs_p_mp arg,
int l
628 !supports_p_mp_[l], std::logic_error
629 ,
"Thyra::ModelEvaluatorBase::InArgs<"
631 "model = \'"<<modelEvalDescription_<<
"\': Error, "
632 "The argument p_mp(l) with index l = " << l <<
" is not supported!"
637 template<
class Scalar>
638 void ModelEvaluatorBase::InArgs<Scalar>::assert_l(
int l)
const
641 !( 0 <= l && l < Np() ), std::logic_error
642 ,
"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_l(l):\n\n"
643 " model = \'"<<modelEvalDescription_<<
"\':\n\n"
644 "Error, The parameter l = " << l <<
" is not in the range [0,"<<Np()<<
")!"
654 template<
class Scalar>
658 std::ostringstream oss;
659 oss <<
"DerivativeMultiVector{";
660 if (
is_null(getMultiVector())) {
666 <<
",orientation=" <<
toString(getOrientation());
673 template<
class Scalar>
679 using Teuchos::describe;
681 out <<
"DerivativeMultiVector\n";
685 << describe(*getMultiVector(),verbLevel)
687 <<
toString(getOrientation()) << endl;
704 template<
class Scalar>
709 std::ostringstream oss;
710 oss <<
"Derivative{";
714 else if (!
is_null(getLinearOp())) {
715 oss <<
"linearOp=" << getLinearOp()->
description();
718 oss <<
"derivMultiVec=" << getDerivativeMultiVector().description();
725 template<
class Scalar>
731 using Teuchos::describe;
733 out <<
"Derivative:";
737 else if (!
is_null(getLinearOp())) {
740 <<
"linearOp = " << describe(*getLinearOp(),verbLevel);
745 <<
"derivMultiVec = ";
746 getDerivativeMultiVector().describe(out,verbLevel);
756 template<
class Scalar>
758 :modelEvalDescription_(
"WARNING! THIS OUTARGS OBJECT IS UNINITIALIZED!"),
760 { std::fill_n(&supports_[0],NUM_E_OUT_ARGS_MEMBERS,
false); }
763 template<
class Scalar>
765 {
return DfDp_.size(); }
768 template<
class Scalar>
770 {
return g_.size(); }
773 template<
class Scalar>
779 int(arg)>=NUM_E_OUT_ARGS_MEMBERS ||
int(arg) < 0,std::logic_error
780 ,
"model = \'"<<modelEvalDescription_
781 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
783 return supports_[arg];
787 template<
class Scalar>
794 return supports_DfDp_[l];
798 template<
class Scalar>
805 return supports_DgDx_dot_[j];
809 template<
class Scalar>
816 return supports_DgDx_[j];
820 template<
class Scalar>
828 return supports_DgDp_[ j*Np() + l ];
832 template<
class Scalar>
839 return supports_g_mp_[j];
842 template<
class Scalar>
845 EOutArgsDfDp_mp arg,
int l
849 return supports_DfDp_mp_[l];
853 template<
class Scalar>
854 const ModelEvaluatorBase::DerivativeSupport&
855 ModelEvaluatorBase::OutArgs<Scalar>::supports(
856 EOutArgsDgDx_dot_mp arg,
int j
860 return supports_DgDx_dot_mp_[j];
864 template<
class Scalar>
865 const ModelEvaluatorBase::DerivativeSupport&
866 ModelEvaluatorBase::OutArgs<Scalar>::supports(
867 EOutArgsDgDx_mp arg,
int j
871 return supports_DgDx_mp_[j];
875 template<
class Scalar>
876 const ModelEvaluatorBase::DerivativeSupport&
877 ModelEvaluatorBase::OutArgs<Scalar>::supports(
878 EOutArgsDgDp_mp arg,
int j,
int l
883 return supports_DgDp_mp_[ j*Np() + l ];
888 template<
class Scalar>
893 assert_supports(OUT_ARG_f);
898 template<
class Scalar>
902 assert_supports(OUT_ARG_f);
907 template<
class Scalar>
917 template<
class Scalar>
926 template<
class Scalar>
931 assert_supports(OUT_ARG_f_mp);
936 template<
class Scalar>
940 assert_supports(OUT_ARG_f_mp);
945 template<
class Scalar>
950 assert_supports(OUT_ARG_g_mp,j);
955 template<
class Scalar>
959 assert_supports(OUT_ARG_g_mp,j);
964 template<
class Scalar>
969 assert_supports(OUT_ARG_W);
974 template<
class Scalar>
978 assert_supports(OUT_ARG_W);
983 template<
class Scalar>
988 assert_supports(OUT_ARG_W_mp);
993 template<
class Scalar>
997 assert_supports(OUT_ARG_W_mp);
1002 template<
class Scalar>
1007 assert_supports(OUT_ARG_W_op);
1012 template<
class Scalar>
1016 assert_supports(OUT_ARG_W_op);
1021 template<
class Scalar>
1026 assert_supports(OUT_ARG_W_prec);
1031 template<
class Scalar>
1035 assert_supports(OUT_ARG_W_prec);
1040 template<
class Scalar>
1044 assert_supports(OUT_ARG_f);
1045 return W_properties_;
1049 template<
class Scalar>
1054 assert_supports(OUT_ARG_DfDp,l,DfDp_l);
1059 template<
class Scalar>
1063 assert_supports(OUT_ARG_DfDp,l);
1068 template<
class Scalar>
1072 assert_supports(OUT_ARG_DfDp,l);
1073 return DfDp_properties_[l];
1077 template<
class Scalar>
1082 assert_supports(OUT_ARG_DfDp_mp,l,DfDp_mp_l);
1083 DfDp_mp_[l] = DfDp_mp_l;
1087 template<
class Scalar>
1091 assert_supports(OUT_ARG_DfDp_mp,l);
1096 template<
class Scalar>
1097 ModelEvaluatorBase::DerivativeProperties
1098 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp_mp_properties(
int l)
const
1100 assert_supports(OUT_ARG_DfDp_mp,l);
1101 return DfDp_mp_properties_[l];
1105 template<
class Scalar>
1110 assert_supports(OUT_ARG_DgDx_dot,j,DgDx_dot_j);
1111 DgDx_dot_[j] = DgDx_dot_j;
1115 template<
class Scalar>
1119 assert_supports(OUT_ARG_DgDx_dot,j);
1120 return DgDx_dot_[j];
1124 template<
class Scalar>
1128 assert_supports(OUT_ARG_DgDx_dot,j);
1129 return DgDx_dot_properties_[j];
1133 template<
class Scalar>
1138 assert_supports(OUT_ARG_DgDx_dot_mp,j,DgDx_dot_mp_j);
1139 DgDx_dot_mp_[j] = DgDx_dot_mp_j;
1143 template<
class Scalar>
1147 assert_supports(OUT_ARG_DgDx_dot_mp,j);
1148 return DgDx_dot_mp_[j];
1152 template<
class Scalar>
1153 ModelEvaluatorBase::DerivativeProperties
1154 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot_mp_properties(
int j)
const
1156 assert_supports(OUT_ARG_DgDx_dot_mp,j);
1157 return DgDx_dot_mp_properties_[j];
1161 template<
class Scalar>
1166 assert_supports(OUT_ARG_DgDx,j,DgDx_j);
1171 template<
class Scalar>
1175 assert_supports(OUT_ARG_DgDx,j);
1180 template<
class Scalar>
1184 assert_supports(OUT_ARG_DgDx,j);
1185 return DgDx_properties_[j];
1189 template<
class Scalar>
1194 assert_supports(OUT_ARG_DgDx_mp,j,DgDx_mp_j);
1195 DgDx_mp_[j] = DgDx_mp_j;
1199 template<
class Scalar>
1203 assert_supports(OUT_ARG_DgDx_mp,j);
1208 template<
class Scalar>
1209 ModelEvaluatorBase::DerivativeProperties
1210 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_mp_properties(
int j)
const
1212 assert_supports(OUT_ARG_DgDx_mp,j);
1213 return DgDx_mp_properties_[j];
1217 template<
class Scalar>
1222 assert_supports(OUT_ARG_DgDp,j,l,DgDp_j_l);
1223 DgDp_[ j*Np() + l ] = DgDp_j_l;
1227 template<
class Scalar>
1231 assert_supports(OUT_ARG_DgDp,j,l);
1232 return DgDp_[ j*Np() + l ];
1236 template<
class Scalar>
1240 assert_supports(OUT_ARG_DgDp,j,l);
1241 return DgDp_properties_[ j*Np() + l ];
1245 template<
class Scalar>
1250 assert_supports(OUT_ARG_DgDp_mp,j,l,DgDp_mp_j_l);
1251 DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l;
1255 template<
class Scalar>
1259 assert_supports(OUT_ARG_DgDp_mp,j,l);
1260 return DgDp_mp_[ j*Np() + l ];
1264 template<
class Scalar>
1265 ModelEvaluatorBase::DerivativeProperties
1266 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp_mp_properties(
int j,
int l)
const
1268 assert_supports(OUT_ARG_DgDp_mp,j,l);
1269 return DgDp_mp_properties_[ j*Np() + l ];
1273 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1276 template<
class Scalar>
1277 void ModelEvaluatorBase::OutArgs<Scalar>::set_f_poly(
1285 template<
class Scalar>
1286 RCP<Teuchos::Polynomial< VectorBase<Scalar> > >
1287 ModelEvaluatorBase::OutArgs<Scalar>::get_f_poly()
const
1293 #endif // HAVE_THYRA_ME_POLYNOMIAL
1296 template<
class Scalar>
1302 const int min_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.
Np());
1303 const int min_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.
Ng());
1306 if ( supports(OUT_ARG_f) || !ignoreUnsupported )
1307 set_f(inputOutArgs.
get_f());
1310 if ( supports(OUT_ARG_f_mp) || !ignoreUnsupported )
1313 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1315 if ( inputOutArgs.
supports(OUT_ARG_f_poly) &&
nonnull(inputOutArgs.get_f_poly()) ) {
1316 if ( supports(OUT_ARG_f_poly) || !ignoreUnsupported )
1317 set_f_poly(inputOutArgs.get_f_poly());
1319 #endif // HAVE_THYRA_ME_POLYNOMIAL
1321 for (
int j = 0; j < min_Ng; ++j ) {
1323 set_g(j,inputOutArgs.
get_g(j));
1325 for (
int j = 0; j < min_Ng; ++j ) {
1327 if ( supports(OUT_ARG_g_mp,j) || !ignoreUnsupported )
1328 set_g_mp(j,inputOutArgs.
get_g_mp(j));
1333 if ( supports(OUT_ARG_W) || !ignoreUnsupported )
1334 set_W(inputOutArgs.
get_W());
1337 if ( supports(OUT_ARG_W_mp) || !ignoreUnsupported )
1342 if ( supports(OUT_ARG_W_op) || !ignoreUnsupported )
1347 if ( supports(OUT_ARG_W_prec) || !ignoreUnsupported )
1351 for (
int l = 0; l < min_Np; ++l ) {
1352 MEB::Derivative<Scalar> DfDp_l;
1353 if ( !inputOutArgs.
supports(OUT_ARG_DfDp,l).none()
1354 && !(DfDp_l=inputOutArgs.
get_DfDp(l)).isEmpty() )
1356 if ( DfDp_l.isSupportedBy(supports(OUT_ARG_DfDp,l)) || !ignoreUnsupported )
1360 for (
int l = 0; l < min_Np; ++l ) {
1361 MEB::MPDerivative DfDp_mp_l;
1362 if ( !inputOutArgs.
supports(OUT_ARG_DfDp_mp,l).none()
1363 && !(DfDp_mp_l=inputOutArgs.get_DfDp_mp(l)).isEmpty() )
1365 if ( DfDp_mp_l.isSupportedBy(supports(OUT_ARG_DfDp_mp,l)) || !ignoreUnsupported )
1366 set_DfDp_mp(l,DfDp_mp_l);
1370 for (
int j = 0; j < min_Ng; ++j ) {
1372 MEB::Derivative<Scalar> DgDx_dot_j;
1373 if ( !inputOutArgs.
supports(OUT_ARG_DgDx_dot,j).none()
1374 && !(DgDx_dot_j=inputOutArgs.
get_DgDx_dot(j)).isEmpty() )
1376 if( DgDx_dot_j.isSupportedBy(supports(OUT_ARG_DgDx_dot,j)) || !ignoreUnsupported )
1377 set_DgDx_dot(j,DgDx_dot_j);
1380 MEB::Derivative<Scalar> DgDx_j;
1381 if ( !inputOutArgs.
supports(OUT_ARG_DgDx,j).none()
1382 && !(DgDx_j=inputOutArgs.
get_DgDx(j)).isEmpty() ) {
1383 if ( DgDx_j.isSupportedBy(supports(OUT_ARG_DgDx,j)) || !ignoreUnsupported )
1387 for (
int j = 0; j < min_Ng; ++j ) {
1389 MEB::MPDerivative DgDx_dot_mp_j;
1390 if ( !inputOutArgs.
supports(OUT_ARG_DgDx_dot_mp,j).none()
1391 && !(DgDx_dot_mp_j=inputOutArgs.get_DgDx_dot_mp(j)).isEmpty() )
1393 if( DgDx_dot_mp_j.isSupportedBy(supports(OUT_ARG_DgDx_dot_mp,j)) || !ignoreUnsupported )
1394 set_DgDx_dot_mp(j,DgDx_dot_mp_j);
1397 MEB::MPDerivative DgDx_mp_j;
1398 if ( !inputOutArgs.
supports(OUT_ARG_DgDx_mp,j).none()
1399 && !(DgDx_mp_j=inputOutArgs.get_DgDx_mp(j)).isEmpty() ) {
1400 if ( DgDx_mp_j.isSupportedBy(supports(OUT_ARG_DgDx_mp,j)) || !ignoreUnsupported )
1401 set_DgDx_mp(j,DgDx_mp_j);
1405 for (
int l = 0; l < min_Np; ++l ) {
1406 for (
int j = 0; j < min_Ng; ++j ) {
1407 MEB::Derivative<Scalar> DgDp_j_l;
1408 if ( !inputOutArgs.
supports(OUT_ARG_DgDp,j,l).none()
1409 && !(DgDp_j_l=inputOutArgs.
get_DgDp(j,l)).isEmpty() )
1411 if ( DgDp_j_l.isSupportedBy(supports(OUT_ARG_DgDp,j,l)) || !ignoreUnsupported )
1412 set_DgDp(j,l,DgDp_j_l);
1416 for (
int l = 0; l < min_Np; ++l ) {
1417 for (
int j = 0; j < min_Ng; ++j ) {
1418 MEB::MPDerivative DgDp_mp_j_l;
1419 if ( !inputOutArgs.
supports(OUT_ARG_DgDp_mp,j,l).none()
1420 && !(DgDp_mp_j_l=inputOutArgs.get_DgDp_mp(j,l)).isEmpty() )
1422 if ( DgDp_mp_j_l.isSupportedBy(supports(OUT_ARG_DgDp_mp,j,l)) || !ignoreUnsupported )
1423 set_DgDp_mp(j,l,DgDp_mp_j_l);
1428 this->extended_outargs_ = inputOutArgs.extended_outargs_;
1434 template<
class Scalar>
1439 if( this->supports(OUT_ARG_f) &&
nonnull(this->get_f()) ) {
1440 assign(this->get_f().ptr(),ST::nan());
1442 for(
int j = 0; j < this->Ng(); ++j ) {
1444 assign(this->get_g(j).ptr(),ST::nan());
1450 template<
class Scalar>
1457 template<
class Scalar>
1466 for (
int l = 0; l < Np(); ++l ) {
1467 if (!DfDp_[l].isEmpty())
1470 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1473 #endif // HAVE_THYRA_ME_POLYNOMIAL
1474 for (
int j = 0; j < Ng(); ++j ) {
1477 if (!DgDx_dot_[j].isEmpty())
1479 if (!DgDx_[j].isEmpty())
1481 for (
int l = 0; l < Np(); ++l ) {
1482 if (!DgDp_[j*Np()+l].isEmpty())
1490 template<
class Scalar>
1496 for (
int outArg_i = 0; outArg_i < NUM_E_OUT_ARGS_MEMBERS; ++outArg_i ) {
1497 const EOutArgsMembers outArg_arg = static_cast<EOutArgsMembers>(outArg_i);
1498 const std::string outArg_name =
toString(outArg_arg);
1500 supports(outArg_arg) != outArgs.
supports(outArg_arg), std::logic_error,
1501 "Error, the output argument "<<outArg_name<<
" with support "<<outArgs.
supports(outArg_arg)<<
"\n"
1502 "in the OutArgs object for the model:\n\n"
1504 "is not the same the argument "<<outArg_name<<
" with support "<<supports(outArg_arg)<<
"\n"
1505 "in the OutArgs object for the model:\n\n"
1506 " "<<modelEvalDescription()<<
"\n\n"
1507 "and these two OutArgs objects are not compatible!"
1511 const int l_Np = this->Np();
1512 const int l_Ng = this->Ng();
1516 if (supports(OUT_ARG_f)) {
1517 for (
int l = 0; l < l_Np; ++l ) {
1519 !supports(OUT_ARG_DfDp,l).isSameSupport(outArgs.
supports(OUT_ARG_DfDp,l)),
1521 "Error, the support for DfDp("<<l<<
") is not the same for the models\n\n"
1524 " "<<modelEvalDescription()<<
"\n\n"
1525 "and these two OutArgs objects are not compatible!"
1530 for (
int j = 0; j < l_Ng; ++j ) {
1532 !supports(OUT_ARG_DgDx_dot,j).isSameSupport(outArgs.
supports(OUT_ARG_DgDx_dot,j)),
1534 "Error, the support for DgDx_dot("<<j<<
") is not the same for the models\n\n"
1537 " "<<modelEvalDescription()<<
"\n\n"
1538 "and these two OutArgs objects are not compatible!"
1541 !supports(OUT_ARG_DgDx,j).isSameSupport(outArgs.
supports(OUT_ARG_DgDx,j)),
1543 "Error, the support for DgDx("<<j<<
") is not the same for the models\n\n"
1546 " "<<modelEvalDescription()<<
"\n\n"
1547 "and these two OutArgs objects are not compatible!"
1549 for (
int l = 0; l < l_Np; ++l ) {
1551 !supports(OUT_ARG_DgDp,j,l).isSameSupport(outArgs.
supports(OUT_ARG_DgDp,j,l)),
1553 "Error, the support for DgDp("<<j<<
","<<l<<
") is not the same for the models\n\n"
1556 " "<<modelEvalDescription()<<
"\n\n"
1557 "and these two OutArgs objects are not compatible!"
1564 template<
class Scalar>
1567 return modelEvalDescription_;
1571 template<
class Scalar>
1575 std::ostringstream oss;
1577 <<
"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<
">"
1579 <<
"model="<<modelEvalDescription_
1587 template<
class Scalar>
1594 using Teuchos::describe;
1600 typedef MEB::Derivative<Scalar> Deriv;
1606 out = Teuchos::rcp(&out_arg,
false);
1609 *out <<
"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<
">:\n";
1612 *out <<
"model = " << modelEvalDescription_ <<
"\n";
1613 *out <<
"Np = " << Np() <<
"\n";
1614 *out <<
"Ng = " << Ng() <<
"\n";
1617 if (this->supports(OUT_ARG_f) && !
is_null(f=get_f()) ) {
1618 *out <<
"f = " << Teuchos::describe(*f,verbLevel);
1621 for(
int j = 0; j < Ng(); ++j ) {
1623 if (!
is_null(g_j=this->get_g(j)))
1624 *out <<
"g("<<j<<
") = " << Teuchos::describe(*g_j,verbLevel);
1628 if ( this->supports(OUT_ARG_W) && !
is_null(W=get_W()) ) {
1629 *out <<
"W = " << Teuchos::describe(*W,verbLevel);
1633 if ( this->supports(OUT_ARG_W_op) && !
is_null(W_op=get_W_op()) ) {
1634 *out <<
"W_op = " << Teuchos::describe(*W_op,verbLevel);
1637 for(
int l = 0; l < Np(); ++l ) {
1640 !this->supports(OUT_ARG_DfDp,l).none()
1641 && !(DfDp_l=get_DfDp(l)).isEmpty()
1644 *out <<
"DfDp("<<l<<
") = ";
1645 DfDp_l.describe(*out,verbLevel);
1649 for(
int j = 0; j < Ng(); ++j ) {
1653 !this->supports(OUT_ARG_DgDx_dot,j).none()
1654 && !(DgDx_dot_j=get_DgDx_dot(j)).isEmpty()
1657 *out <<
"DgDx_dot("<<j<<
") = ";
1658 DgDx_dot_j.describe(*out,verbLevel);
1663 !this->supports(OUT_ARG_DgDx,j).none()
1664 && !(DgDx_j=get_DgDx(j)).isEmpty()
1667 *out <<
"DgDx("<<j<<
") = ";
1668 DgDx_j.describe(*out,verbLevel);
1671 for(
int l = 0; l < Np(); ++l ) {
1675 !this->supports(OUT_ARG_DgDp,j,l).none()
1676 && !(DgDp_j_l=get_DgDp(j,l)).isEmpty()
1679 *out <<
"DgDp("<<j<<
","<<l<<
") = ";
1680 DgDp_j_l.describe(*out,verbLevel);
1694 template<
class Scalar>
1696 const std::string &modelEvalDescription_in
1699 modelEvalDescription_ = modelEvalDescription_in;
1702 template<
class Scalar>
1706 supports_DfDp_.resize(Np_in);
1708 DfDp_properties_.resize(Np_in); std::fill_n(DfDp_properties_.begin(),Np_in,
DerivativeProperties());
1710 supports_DfDp_mp_.resize(Np_in);
1711 DfDp_mp_.resize(Np_in); std::fill_n(DfDp_mp_.begin(),Np_in,
MPDerivative());
1712 DfDp_mp_properties_.resize(Np_in); std::fill_n(DfDp_mp_properties_.begin(),Np_in,
DerivativeProperties());
1715 g_.resize(Ng_in); std::fill_n(g_.begin(),Ng_in,Teuchos::null);
1716 supports_DgDx_dot_.resize(Ng_in);
1718 DgDx_dot_properties_.resize(Ng_in); std::fill_n(DgDx_dot_properties_.begin(),Ng_in,
DerivativeProperties());
1719 supports_DgDx_.resize(Ng_in);
1721 DgDx_properties_.resize(Ng_in); std::fill_n(DgDx_properties_.begin(),Ng_in,
DerivativeProperties());
1723 g_mp_.resize(Ng_in); std::fill_n(g_mp_.begin(),Ng_in,Teuchos::null);
1724 supports_g_mp_.resize(Ng_in);
1725 supports_DgDx_dot_mp_.resize(Ng_in);
1726 DgDx_dot_mp_.resize(Ng_in); std::fill_n(DgDx_dot_mp_.begin(),Ng_in,
MPDerivative());
1727 DgDx_dot_mp_properties_.resize(Ng_in); std::fill_n(DgDx_dot_mp_properties_.begin(),Ng_in,
DerivativeProperties());
1728 supports_DgDx_mp_.resize(Ng_in);
1729 DgDx_mp_.resize(Ng_in); std::fill_n(DgDx_mp_.begin(),Ng_in,
MPDerivative());
1730 DgDx_mp_properties_.resize(Ng_in); std::fill_n(DgDx_mp_properties_.begin(),Ng_in,
DerivativeProperties());
1732 if(Np_in && Ng_in) {
1733 const int NpNg = Np_in*Ng_in;
1734 supports_DgDp_.resize(NpNg);
1736 DgDp_properties_.resize(NpNg); std::fill_n(DgDp_properties_.begin(),NpNg,
DerivativeProperties());
1738 supports_DgDp_mp_.resize(NpNg);
1739 DgDp_mp_.resize(NpNg); std::fill_n(DgDp_mp_.begin(),NpNg,
MPDerivative());
1740 DgDp_mp_properties_.resize(NpNg); std::fill_n(DgDp_mp_properties_.begin(),NpNg,
DerivativeProperties());
1745 template<
class Scalar>
1750 int(arg)>=NUM_E_OUT_ARGS_MEMBERS ||
int(arg) < 0,std::logic_error
1751 ,
"model = \'"<<modelEvalDescription_
1752 <<
"\': Error, arg="<<
toString(arg)<<
" is invalid!"
1754 supports_[arg] = supports_in;
1758 template<
class Scalar>
1763 assert_supports(OUT_ARG_f);
1765 supports_DfDp_[l] = supports_in;
1769 template<
class Scalar>
1775 supports_DgDx_dot_[j] = supports_in;
1779 template<
class Scalar>
1785 supports_DgDx_[j] = supports_in;
1789 template<
class Scalar>
1796 supports_DgDp_[ j*Np()+ l ] = supports_in;
1800 template<
class Scalar>
1807 supports_g_mp_[j] = supports_in;
1811 template<
class Scalar>
1813 EOutArgsDfDp_mp arg,
int l,
const DerivativeSupport& supports_in
1816 assert_supports(OUT_ARG_f_mp);
1818 supports_DfDp_mp_[l] = supports_in;
1822 template<
class Scalar>
1823 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
1824 EOutArgsDgDx_dot_mp arg,
int j,
const DerivativeSupport& supports_in
1828 supports_DgDx_dot_mp_[j] = supports_in;
1832 template<
class Scalar>
1833 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
1834 EOutArgsDgDx_mp arg,
int j,
const DerivativeSupport& supports_in
1838 supports_DgDx_mp_[j] = supports_in;
1842 template<
class Scalar>
1843 void ModelEvaluatorBase::OutArgs<Scalar>::_setSupports(
1844 EOutArgsDgDp_mp arg,
int j,
int l,
const DerivativeSupport& supports_in
1849 supports_DgDp_mp_[ j*Np()+ l ] = supports_in;
1853 template<
class Scalar>
1858 W_properties_ = properties;
1862 template<
class Scalar>
1867 assert_supports(OUT_ARG_DfDp,l);
1868 DfDp_properties_[l] = properties;
1872 template<
class Scalar>
1877 assert_supports(OUT_ARG_DgDx_dot,j);
1878 DgDx_dot_properties_[j] = properties;
1882 template<
class Scalar>
1887 assert_supports(OUT_ARG_DgDx,j);
1888 DgDx_properties_[j] = properties;
1892 template<
class Scalar>
1897 assert_supports(OUT_ARG_DgDp,j,l);
1898 DgDp_properties_[ j*Np()+ l ] = properties;
1902 template<
class Scalar>
1907 assert_supports(OUT_ARG_DfDp_mp,l);
1908 DfDp_mp_properties_[l] = properties;
1912 template<
class Scalar>
1914 int j,
const DerivativeProperties &properties
1917 assert_supports(OUT_ARG_DgDx_dot_mp,j);
1918 DgDx_dot_mp_properties_[j] = properties;
1922 template<
class Scalar>
1923 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_mp_properties(
1924 int j,
const DerivativeProperties &properties
1927 assert_supports(OUT_ARG_DgDx_mp,j);
1928 DgDx_mp_properties_[j] = properties;
1932 template<
class Scalar>
1933 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDp_mp_properties(
1934 int j,
int l,
const DerivativeProperties &properties
1937 assert_supports(OUT_ARG_DgDp_mp,j,l);
1938 DgDp_mp_properties_[ j*Np()+ l ] = properties;
1942 template<
class Scalar>
1948 const int l_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.
Np());
1949 const int l_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.
Ng());
1951 &inputOutArgs.supports_[0],
1952 &inputOutArgs.supports_[0] + NUM_E_OUT_ARGS_MEMBERS, &supports_[0] );
1953 for(
int l = 0; l < l_Np; ++l ) {
1956 this->_setSupports(MEB::OUT_ARG_DfDp,l,ds);
1960 for(
int l = 0; l < l_Np; ++l ) {
1963 this->_setSupports(MEB::OUT_ARG_DfDp_mp,l,ds);
1964 this->_set_DfDp_mp_properties(l,inputOutArgs.get_DfDp_mp_properties(l));
1967 for(
int j = 0; j < l_Ng; ++j ) {
1969 this->_setSupports(MEB::OUT_ARG_DgDx_dot,j,ds);
1972 for(
int j = 0; j < l_Ng; ++j ) {
1974 this->_setSupports(MEB::OUT_ARG_DgDx_dot_mp,j,ds);
1975 if(!ds.
none()) this->_set_DgDx_dot_mp_properties(j,inputOutArgs.get_DgDx_dot_mp_properties(j));
1977 for(
int j = 0; j < l_Ng; ++j ) {
1979 this->_setSupports(MEB::OUT_ARG_DgDx,j,ds);
1982 for(
int j = 0; j < l_Ng; ++j ) {
1984 this->_setSupports(MEB::OUT_ARG_DgDx_mp,j,ds);
1985 if(!ds.
none()) this->_set_DgDx_mp_properties(j,inputOutArgs.get_DgDx_mp_properties(j));
1987 for(
int j = 0; j < l_Ng; ++j )
for(
int l = 0; l < l_Np; ++l ) {
1989 this->_setSupports(MEB::OUT_ARG_DgDp,j,l,ds);
1992 for(
int j = 0; j < l_Ng; ++j )
for(
int l = 0; l < l_Np; ++l ) {
1994 this->_setSupports(MEB::OUT_ARG_DgDp_mp,j,l,ds);
1995 if(!ds.
none()) this->_set_DgDp_mp_properties(j,l,inputOutArgs.get_DgDp_mp_properties(j,l));
1997 if(this->supports(OUT_ARG_W) || this->supports(OUT_ARG_W_op))
1999 if(this->supports(OUT_ARG_W_mp))
2002 extended_outargs_ = inputOutArgs.extended_outargs_;
2006 template<
class Scalar>
2013 const int l_Ng = this->Ng();
2014 for(
int j = 0; j < l_Ng; ++j ) {
2021 const int l_Ng = this->Ng();
2022 for(
int j = 0; j < l_Ng; ++j ) {
2030 true ,std::logic_error,
2031 "Error, can not handle args other than IN_ARG_x yet!"
2037 template<
class Scalar>
2044 this->_setSupports(OUT_ARG_W,
false);
2045 this->_setSupports(OUT_ARG_W_op,
false);
2046 this->_setSupports(OUT_ARG_f_poly,
false);
2047 const int l_Np = this->Np();
2048 for(
int l = 0; l < l_Np; ++l )
2052 case OUT_ARG_f_mp: {
2053 this->_setSupports(OUT_ARG_W_mp,
false);
2054 this->_setSupports(OUT_ARG_W_op,
false);
2055 this->_setSupports(OUT_ARG_f_poly,
false);
2056 const int l_Np = this->Np();
2057 for(
int l = 0; l < l_Np; ++l )
2063 true ,std::logic_error,
2064 "Error, can not handle args other than OUT_ARG_f yet!"
2067 this->_setSupports(arg,
false);
2074 template<
class Scalar>
2078 !this->supports(arg), std::logic_error
2079 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(arg):\n\n"
2080 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2081 "Error, The argument arg = " <<
toString(arg) <<
" is not supported!"
2086 template<
class Scalar>
2088 EOutArgsDfDp arg,
int l,
const Derivative<Scalar> &deriv
2091 const DerivativeSupport derivSupport = this->supports(arg,l);
2093 !deriv.isSupportedBy(derivSupport), std::logic_error,
2094 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp,l):\n\n"
2095 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2096 "Error, The argument DfDp("<<l<<
") = " << deriv.description() <<
"\n"
2097 "is not supported!\n\n"
2098 "The supported types include " << derivSupport.description() <<
"!"
2103 template<
class Scalar>
2104 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2105 EOutArgsDgDx_dot arg,
int j,
const Derivative<Scalar> &deriv
2108 const DerivativeSupport derivSupport = this->supports(arg,j);
2110 !deriv.isSupportedBy(derivSupport), std::logic_error,
2111 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot,j):\n\n"
2112 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2113 "Error, The argument DgDx_dot("<<j<<
") = " << deriv.description() <<
"\n"
2114 "is not supported!\n\n"
2115 "The supported types include " << derivSupport.description() <<
"!"
2120 template<
class Scalar>
2121 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2122 EOutArgsDgDx arg,
int j,
const Derivative<Scalar> &deriv
2125 const DerivativeSupport derivSupport = this->supports(arg,j);
2127 !deriv.isSupportedBy(derivSupport), std::logic_error,
2128 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx,j):\n\n"
2129 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2130 "Error, The argument DgDx("<<j<<
") = " << deriv.description() <<
"\n"
2131 "is not supported!\n\n"
2132 "The supported types include " << derivSupport.description() <<
"!"
2137 template<
class Scalar>
2138 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2139 EOutArgsDgDp arg,
int j,
int l,
const Derivative<Scalar> &deriv
2142 const DerivativeSupport derivSupport = this->supports(arg,j,l);
2144 !deriv.isSupportedBy(derivSupport), std::logic_error,
2145 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp,j,l):\n\n"
2146 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2147 "Error, The argument DgDp("<<j<<
","<<l<<
") = " << deriv.description() <<
"\n"
2148 "is not supported!\n\n"
2149 "The supported types include " << derivSupport.description() <<
"!"
2154 template<
class Scalar>
2155 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2156 EOutArgs_g_mp arg,
int j
2161 !supports_g_mp_[j], std::logic_error,
2162 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_g_mp,j):\n\n"
2163 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2164 "Error, The argument g_mp("<<j<<
") \n"
2165 "is not supported!\n\n"
2170 template<
class Scalar>
2171 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2172 EOutArgsDfDp_mp arg,
int l,
const MPDerivative &deriv
2175 const DerivativeSupport derivSupport = this->supports(arg,l);
2177 !deriv.isSupportedBy(derivSupport), std::logic_error,
2178 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp_mp,l):\n\n"
2179 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2180 "Error, The argument DfDp_mp("<<l<<
") = " << deriv.description() <<
"\n"
2181 "is not supported!\n\n"
2182 "The supported types include " << derivSupport.description() <<
"!"
2187 template<
class Scalar>
2188 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2189 EOutArgsDgDx_dot_mp arg,
int j,
const MPDerivative &deriv
2192 const DerivativeSupport derivSupport = this->supports(arg,j);
2194 !deriv.isSupportedBy(derivSupport), std::logic_error,
2195 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot_mp,j):\n\n"
2196 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2197 "Error, The argument DgDx_dot_mp("<<j<<
") = " << deriv.description() <<
"\n"
2198 "is not supported!\n\n"
2199 "The supported types include " << derivSupport.description() <<
"!"
2204 template<
class Scalar>
2205 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2206 EOutArgsDgDx_mp arg,
int j,
const MPDerivative &deriv
2209 const DerivativeSupport derivSupport = this->supports(arg,j);
2211 !deriv.isSupportedBy(derivSupport), std::logic_error,
2212 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_mp,j):\n\n"
2213 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2214 "Error, The argument DgDx_mp("<<j<<
") = " << deriv.description() <<
"\n"
2215 "is not supported!\n\n"
2216 "The supported types include " << derivSupport.description() <<
"!"
2221 template<
class Scalar>
2222 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2223 EOutArgsDgDp_mp arg,
int j,
int l,
const MPDerivative &deriv
2226 const DerivativeSupport derivSupport = this->supports(arg,j,l);
2228 !deriv.isSupportedBy(derivSupport), std::logic_error,
2229 "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp_mp,j,l):\n\n"
2230 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2231 "Error, The argument DgDp_mp("<<j<<
","<<l<<
") = " << deriv.description() <<
"\n"
2232 "is not supported!\n\n"
2233 "The supported types include " << derivSupport.description() <<
"!"
2238 template<
class Scalar>
2239 void ModelEvaluatorBase::OutArgs<Scalar>::assert_l(
int l)
const
2242 !( 0 <= l && l < Np() ), std::logic_error
2243 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_l(l):\n\n"
2244 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2245 "Error, The parameter subvector p("<<l<<
")"
2246 " is not in the range [0,"<<Np()<<
")!"
2251 template<
class Scalar>
2252 void ModelEvaluatorBase::OutArgs<Scalar>::assert_j(
int j)
const
2255 !( 0 <= j && j < Ng() ), std::logic_error
2256 ,
"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_j(j):\n\n"
2257 "model = \'"<<modelEvalDescription_<<
"\':\n\n"
2258 "Error, The auxiliary function g("<<j<<
")"
2259 " is not in the range [0,"<<Ng()<<
")!"
2269 template<
class Scalar>
2274 template<
class Scalar>
2280 template<
class Scalar>
2282 const std::string &modelEvalDescription_in )
2284 this->_setModelEvalDescription(modelEvalDescription_in);
2288 template<
class Scalar>
2290 { this->_set_Np(Np_in); }
2293 template<
class Scalar>
2295 { this->_setSupports(arg,supports_in); }
2298 template<
class Scalar>
2300 { this->_setSupports(arg,l,supports_in); }
2303 template<
class Scalar>
2308 this->_setSupports(inArgs, Np_in);
2312 template<
class Scalar>
2317 this->_setUnsupportsAndRelated(arg);
2326 template<
class Scalar>
2331 template<
class Scalar>
2335 :
OutArgs<Scalar>(inputOutArgs)
2339 template<
class Scalar>
2341 const std::string &modelEvalDescription_in
2343 { this->_setModelEvalDescription(modelEvalDescription_in); }
2346 template<
class Scalar>
2348 { this->_set_Np_Ng(Np_in, Ng_in); }
2351 template<
class Scalar>
2355 { this->_setSupports(arg,supports_in); }
2358 template<
class Scalar>
2362 { this->_setSupports(arg,l,supports_in); }
2365 template<
class Scalar>
2369 { this->_setSupports(arg,j,supports_in); }
2372 template<
class Scalar>
2376 { this->_setSupports(arg,j,supports_in); }
2379 template<
class Scalar>
2383 { this->_setSupports(arg,j,l,supports_in); }
2386 template<
class Scalar>
2390 { this->_setSupports(arg,j,supports_in); }
2393 template<
class Scalar>
2397 { this->_setSupports(arg,l,supports_in); }
2400 template<
class Scalar>
2404 { this->_setSupports(arg,j,supports_in); }
2407 template<
class Scalar>
2411 { this->_setSupports(arg,j,supports_in); }
2414 template<
class Scalar>
2416 EOutArgsDgDp_mp arg,
int j,
int l,
const DerivativeSupport& supports_in
2418 { this->_setSupports(arg,j,l,supports_in); }
2421 template<
class Scalar>
2425 { this->_set_W_properties(properties); }
2428 template<
class Scalar>
2432 { this->_set_DfDp_properties(l,properties); }
2435 template<
class Scalar>
2439 { this->_set_DgDx_dot_properties(j,properties); }
2442 template<
class Scalar>
2446 { this->_set_DgDx_properties(j,properties); }
2449 template<
class Scalar>
2453 { this->_set_DgDp_properties(j,l,properties); }
2456 template<
class Scalar>
2460 { this->_set_DfDp_mp_properties(l,properties); }
2463 template<
class Scalar>
2465 int j,
const DerivativeProperties &properties
2467 { this->_set_DgDx_dot_mp_properties(j,properties); }
2470 template<
class Scalar>
2471 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_mp_properties(
2472 int j,
const DerivativeProperties &properties
2474 { this->_set_DgDx_mp_properties(j,properties); }
2477 template<
class Scalar>
2478 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDp_mp_properties(
2479 int j,
int l,
const DerivativeProperties &properties
2481 { this->_set_DgDp_mp_properties(j,l,properties); }
2484 template<
class Scalar>
2488 { this->_setSupports(inputOutArgs); }
2491 template<
class Scalar>
2495 { this->_setUnsupportsAndRelated(arg); }
2498 template<
class Scalar>
2502 { this->_setUnsupportsAndRelated(arg); }
2516 #define THYRA_MODEL_EVALUATOR_BASE_INSTANT(SCALAR) \
2518 template class ModelEvaluatorBase::InArgs<SCALAR >; \
2520 template std::string \
2521 ModelEvaluatorBase::Derivative<SCALAR >::description() const; \
2524 void ModelEvaluatorBase::Derivative<SCALAR >::describe( \
2525 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel \
2528 template class ModelEvaluatorBase::OutArgs<SCALAR >; \
2530 template class ModelEvaluatorBase::InArgsSetup<SCALAR >; \
2532 template class ModelEvaluatorBase::OutArgsSetup<SCALAR >;
2535 #endif // THYRA_MODEL_EVALUATOR_BASE_DEF_HPP