Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_ModelEvaluatorBase_def.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
11 #define THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
12 
13 
14 #include "Thyra_ModelEvaluatorBase_decl.hpp"
15 #include "Thyra_MultiVectorBase.hpp"
16 #include "Thyra_VectorBase.hpp"
17 #include "Thyra_MultiVectorStdOps.hpp"
18 #include "Thyra_VectorStdOps.hpp"
19 
20 
21 namespace Thyra {
22 
23 
24 namespace ModelEvaluatorHelperPack {
25 
26 
27 template<class Scalar>
28 inline
29 RCP<const Thyra::VectorBase<Scalar> >
30 condCloneVec(
31  const RCP<const Thyra::VectorBase<Scalar> > &vec,
32  bool cloneObject
33  )
34 {
35  if(cloneObject)
36  return vec->clone_v();
37  return vec;
38 }
39 
40 template<class Scalar>
41 inline
42 RCP<const Thyra::MultiVectorBase<Scalar> >
43 condCloneMultiVec(
44  const RCP<const Thyra::MultiVectorBase<Scalar> > &vec,
45  bool cloneObject
46  )
47 {
48  if(cloneObject)
49  return vec->clone_mv();
50  return vec;
51 }
52 
53 inline
54 RCP<const Stokhos::ProductEpetraVector >
55 condCloneVec_mp(
56  const RCP<const Stokhos::ProductEpetraVector > &vec,
57  bool cloneObject
58  )
59 {
60  if(cloneObject)
61  {
62  printf("Warning: clone_v not implemented for ProductEpetraVector: %s %d\n",__FILE__,__LINE__);
63  //return vec->clone_v(); //JF clone_v not implemented for ProductEpetraVector
64  }
65  return vec;
66 }
67 
68 } // namespace ModelEvaluatorHelperPack
69 
70 
71 //
72 // ModelEvaluatorBase::InArgs
73 //
74 
75 
76 template<class Scalar>
78  :modelEvalDescription_("WARNING! THIS INARGS OBJECT IS UNINITIALIZED!")
79 {
82  std::fill_n(&supports_[0],NUM_E_IN_ARGS_MEMBERS,false);
83  t_ = SMT::zero();
84  alpha_ = ST::zero();
85  beta_ = ST::zero();
86  step_size_ = ST::zero();
87  stage_number_ = ST::one();
88 }
89 
90 
91 template<class Scalar>
93 { return p_.size(); }
94 
95 template<class Scalar>
97 { return g_multiplier_.size(); }
98 
99 template<class Scalar>
101 {
103  int(arg)>=NUM_E_IN_ARGS_MEMBERS || int(arg) < 0,std::logic_error
104  ,"model = \'"<<modelEvalDescription_
105  <<"\': Error, arg="<<toString(arg)<<" is invalid!"
106  );
107  return supports_[arg];
108 }
109 
110 template<class Scalar>
112 {
113  assert_l(l);
114  return supports_p_mp_[l];
115 }
116 
117 template<class Scalar>
119  const RCP<const VectorBase<Scalar> > &x_dot_dot
120  )
121 { assert_supports(IN_ARG_x_dot_dot); x_dot_dot_ = x_dot_dot; }
122 
123 template<class Scalar>
126 { assert_supports(IN_ARG_x_dot_dot); return x_dot_dot_; }
127 
128 template<class Scalar>
130  const RCP<const VectorBase<Scalar> > &x_dot
131  )
132 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
133 
134 
135 template<class Scalar>
138 { assert_supports(IN_ARG_x_dot); return x_dot_; }
139 
140 
141 template<class Scalar>
143  const RCP<const VectorBase<Scalar> > &x
144  )
145 { assert_supports(IN_ARG_x); x_ = x; }
146 
147 
148 template<class Scalar>
151 { assert_supports(IN_ARG_x); return x_; }
152 
153 
154 template<class Scalar>
156  const RCP<const MultiVectorBase<Scalar> > &x_direction
157  )
158 { assert_supports(IN_ARG_x); x_direction_ = x_direction; }
159 
160 
161 template<class Scalar>
163  int l, const RCP<const MultiVectorBase<Scalar> > &p_direction_l
164  )
165 { assert_l(l); p_direction_[l] = p_direction_l; }
166 
167 
168 template<class Scalar>
171 { assert_supports(IN_ARG_x); return x_direction_; }
172 
173 
174 template<class Scalar>
177 { assert_l(l); return p_direction_[l]; }
178 
179 
180 template<class Scalar>
183  )
184 { assert_supports(IN_ARG_x_dot_mp); x_dot_mp_ = x_dot_mp; }
185 
186 
187 template<class Scalar>
190 { assert_supports(IN_ARG_x_dot_mp); return x_dot_mp_; }
191 
192 
193 template<class Scalar>
196  )
197 { assert_supports(IN_ARG_x_mp); x_mp_ = x_mp; }
198 
199 
200 template<class Scalar>
203 { assert_supports(IN_ARG_x_mp); return x_mp_; }
204 
205 template<class Scalar>
207  const RCP<const VectorBase<Scalar> > &f_multiplier
208  )
209 { assert_supports(IN_ARG_x); f_multiplier_ = f_multiplier; }
210 
211 template<class Scalar>
214 { assert_supports(IN_ARG_x); return f_multiplier_; }
215 
216 template<class Scalar>
218  int j, const RCP<const VectorBase<Scalar> > &g_multiplier
219  )
220 {
221  assert_j(j);
222  assert_supports(IN_ARG_x);
223  g_multiplier_[j] = g_multiplier;
224 }
225 
226 template<class Scalar>
229 {
230  assert_j(j);
231  assert_supports(IN_ARG_x);
232  return g_multiplier_[j];
233 }
234 
235 #ifdef HAVE_THYRA_ME_POLYNOMIAL
236 
237 template<class Scalar>
239  const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_dot_poly
240  )
241 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
242 
243 
244 template<class Scalar>
247 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; }
248 
249 
250 template<class Scalar>
251 void ModelEvaluatorBase::InArgs<Scalar>::set_x_poly(
252  const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_poly
253  )
254 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
255 
256 
257 template<class Scalar>
258 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
259 ModelEvaluatorBase::InArgs<Scalar>::get_x_poly() const
260 { assert_supports(IN_ARG_x_poly); return x_poly_; }
261 
262 
263 #endif // HAVE_THYRA_ME_POLYNOMIAL
264 
265 template<class Scalar>
267  int l, const RCP<const VectorBase<Scalar> > &p_l
268  )
269 { assert_l(l); p_[l] = p_l; }
270 
271 
272 template<class Scalar>
275 { assert_l(l); return p_[l]; }
276 
277 
278 template<class Scalar>
280  int l, const RCP<const Stokhos::ProductEpetraVector > &p_mp_l
281  )
282 { assert_supports(IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; }
283 
284 template<class Scalar>
287 { assert_supports(IN_ARG_p_mp, l); return p_mp_[l]; }
288 
289 
290 template<class Scalar>
292 { assert_supports(IN_ARG_t); t_ = t; }
293 
294 
295 template<class Scalar>
298 { assert_supports(IN_ARG_t); return t_; }
299 
300 
301 template<class Scalar>
303 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
304 
305 
306 template<class Scalar>
308 { assert_supports(IN_ARG_alpha); return alpha_; }
309 
310 
311 template<class Scalar>
313 { assert_supports(IN_ARG_beta); beta_ = beta; }
314 
315 
316 template<class Scalar>
318 { assert_supports(IN_ARG_beta); return beta_; }
319 
320 template<class Scalar>
322 { assert_supports(IN_ARG_W_x_dot_dot_coeff); W_x_dot_dot_coeff_ = W_x_dot_dot_coeff; }
323 
324 
325 template<class Scalar>
327 { assert_supports(IN_ARG_W_x_dot_dot_coeff); return W_x_dot_dot_coeff_; }
328 
329 template<class Scalar>
331 { assert_supports(IN_ARG_step_size); step_size_ = step_size; }
332 
333 template<class Scalar>
335 { assert_supports(IN_ARG_step_size); return step_size_; }
336 
337 template<class Scalar>
339 { assert_supports(IN_ARG_stage_number); return stage_number_; }
340 
341 
342 template<class Scalar>
344 { assert_supports(IN_ARG_stage_number); stage_number_ = stage_number; }
345 
346 
347 template<class Scalar>
349  const InArgs<Scalar>& inArgs, bool ignoreUnsupported, bool cloneObjects
350  )
351 {
352  using ModelEvaluatorHelperPack::condCloneVec;
353  using ModelEvaluatorHelperPack::condCloneMultiVec;
354  using ModelEvaluatorHelperPack::condCloneVec_mp;
355  if( inArgs.supports(IN_ARG_x_dot_dot) && nonnull(inArgs.get_x_dot_dot()) ) {
356  if(supports(IN_ARG_x_dot_dot) || !ignoreUnsupported)
357  set_x_dot_dot(condCloneVec(inArgs.get_x_dot_dot(),cloneObjects));
358  }
359  if( inArgs.supports(IN_ARG_x_dot) && nonnull(inArgs.get_x_dot()) ) {
360  if(supports(IN_ARG_x_dot) || !ignoreUnsupported)
361  set_x_dot(condCloneVec(inArgs.get_x_dot(),cloneObjects));
362  }
363  if( inArgs.supports(IN_ARG_x_dot_mp) && nonnull(inArgs.get_x_dot_mp()) ) {
364  if(supports(IN_ARG_x_dot_mp) || !ignoreUnsupported)
365  set_x_dot_mp(condCloneVec_mp(inArgs.get_x_dot_mp(),cloneObjects));
366  }
367  if( inArgs.supports(IN_ARG_x) && nonnull(inArgs.get_x()) ) {
368  if(supports(IN_ARG_x) || !ignoreUnsupported)
369  set_x(condCloneVec(inArgs.get_x(),cloneObjects));
370  }
371  if( inArgs.supports(IN_ARG_x_mp) && nonnull(inArgs.get_x_mp()) ) {
372  if(supports(IN_ARG_x_mp) || !ignoreUnsupported)
373  set_x_mp(condCloneVec_mp(inArgs.get_x_mp(),cloneObjects));
374  }
375  if( inArgs.supports(IN_ARG_x) && nonnull(inArgs.get_x_direction()) ) {
376  if(supports(IN_ARG_x) || !ignoreUnsupported)
377  set_x_direction(condCloneMultiVec(inArgs.get_x_direction(),cloneObjects));
378  }
379  if( inArgs.supports(IN_ARG_x) && nonnull(inArgs.get_f_multiplier()) ) {
380  if(supports(IN_ARG_x) || !ignoreUnsupported)
381  set_f_multiplier(condCloneVec(inArgs.get_f_multiplier(),cloneObjects));
382  }
383  const int min_Ng = TEUCHOS_MIN(this->Ng(),inArgs.Ng());
384  for (int j = 0; j < min_Ng; ++j) {
385  if (nonnull(inArgs.get_g_multiplier(j)))
386  set_g_multiplier(j,condCloneVec(inArgs.get_g_multiplier(j),cloneObjects));
387  }
388 #ifdef HAVE_THYRA_ME_POLYNOMIAL
389  if( inArgs.supports(IN_ARG_x_dot_poly) && nonnull(inArgs.get_x_dot_poly()) ) {
390  if(supports(IN_ARG_x_dot_poly) || !ignoreUnsupported) {
392  cloneObjects && "Have not implemented cloning for x_dot_poly yet!" );
393  set_x_dot_poly(inArgs.get_x_dot_poly());
394  }
395  }
396  if( inArgs.supports(IN_ARG_x_poly) && nonnull(inArgs.get_x_poly()) ) {
397  if(supports(IN_ARG_x_poly) || !ignoreUnsupported) {
399  cloneObjects && "Have not implemented cloning for x_poly yet!" );
400  set_x_poly(inArgs.get_x_poly());
401  }
402  }
403 #endif // HAVE_THYRA_ME_POLYNOMIAL
404  const int min_Np = TEUCHOS_MIN(this->Np(),inArgs.Np());
405  for (int l = 0; l < min_Np; ++l) {
406  if (nonnull(inArgs.get_p(l)))
407  set_p(l,condCloneVec(inArgs.get_p(l),cloneObjects));
408  }
409  for (int l = 0; l < min_Np; ++l) {
410  if (nonnull(inArgs.get_p_direction(l)))
411  set_p_direction(l,condCloneMultiVec(inArgs.get_p_direction(l),cloneObjects));
412  }
413  for (int l = 0; l < min_Np; ++l) {
414  if (inArgs.supports(IN_ARG_p_mp,l)) {
415  if (nonnull(inArgs.get_p_mp(l)))
416  set_p_mp(l,condCloneVec_mp(inArgs.get_p_mp(l),cloneObjects));
417  }
418  }
419  if (inArgs.supports(IN_ARG_t)) {
420  if(supports(IN_ARG_t) || !ignoreUnsupported)
421  set_t(inArgs.get_t());
422  }
423  if (inArgs.supports(IN_ARG_alpha)) {
424  if(supports(IN_ARG_alpha) || !ignoreUnsupported)
425  set_alpha(inArgs.get_alpha());
426  }
427  if (inArgs.supports(IN_ARG_beta)) {
428  if(supports(IN_ARG_beta) || !ignoreUnsupported)
429  set_beta(inArgs.get_beta());
430  }
431  if (inArgs.supports(IN_ARG_W_x_dot_dot_coeff)) {
432  if(supports(IN_ARG_W_x_dot_dot_coeff) || !ignoreUnsupported)
433  set_W_x_dot_dot_coeff(inArgs.get_W_x_dot_dot_coeff());
434  }
435  if (inArgs.supports(IN_ARG_step_size)) {
436  if(supports(IN_ARG_step_size) || !ignoreUnsupported)
437  set_step_size(inArgs.get_step_size());
438  }
439  if (inArgs.supports(IN_ARG_stage_number)) {
440  if(supports(IN_ARG_stage_number) || !ignoreUnsupported)
441  set_stage_number(inArgs.get_stage_number());
442  }
443  // Extended inArgs
444  if (extended_inargs_.size() > 0)
445  TEUCHOS_TEST_FOR_EXCEPTION(cloneObjects,
446  std::runtime_error,
447  "Extended InArgs does not support cloning!");
448  this->extended_inargs_ = inArgs.extended_inargs_;
449 }
450 
451 
452 template<class Scalar>
454  const InArgs<Scalar> &inArgs
455  ) const
456 {
457  for ( int inArg_i = 0; inArg_i < NUM_E_IN_ARGS_MEMBERS; ++inArg_i ) {
458  const EInArgsMembers inArg_arg = static_cast<EInArgsMembers>(inArg_i);
459  const std::string inArg_name = toString(inArg_arg);
461  supports(inArg_arg) != inArgs.supports(inArg_arg), std::logic_error,
462  "Error, the input argument "<<inArg_name<<" with support "<<inArgs.supports(inArg_arg)<<"\n"
463  "in the InArgs object for the model:\n\n"
464  " "<<inArgs.modelEvalDescription()<<"\n\n"
465  "is not the same the argument "<<inArg_name<<" with support "<<supports(inArg_arg)<<"\n"
466  "in the InArgs object for the model:\n\n"
467  " "<<modelEvalDescription()<<"\n\n"
468  "and these two InArgs objects are not compatible!"
469  );
470  }
471  TEUCHOS_ASSERT_EQUALITY( this->Np(), inArgs.Np() );
472 }
473 
474 
475 template<class Scalar>
477 {
478  return modelEvalDescription_;
479 }
480 
481 
482 template<class Scalar>
484 {
486  std::ostringstream oss;
487  oss
488  << "Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<">"
489  << "{"
490  << "model="<<modelEvalDescription_
491  << ",Np="<<Np()
492  << "}";
493  return oss.str();
494 }
495 
496 
497 template<class Scalar>
499  Teuchos::FancyOStream &out_arg, const Teuchos::EVerbosityLevel verbLevel
500  ) const
501 {
502  using std::endl;
504  using Teuchos::OSTab;
505  using Teuchos::describe;
507  typedef RCP<const VectorBase<Scalar> > CV_ptr;
508 
509  if(verbLevel == Teuchos::VERB_NONE)
510  return;
511 
513  out = Teuchos::rcp(&out_arg,false);
514  const bool dump_x = includesVerbLevel(verbLevel,Teuchos::VERB_HIGH);
515  const Teuchos::EVerbosityLevel x_verbLevel =
516  dump_x?Teuchos::VERB_EXTREME:verbLevel;
517  const bool print_x_nrm = includesVerbLevel(verbLevel,Teuchos::VERB_LOW);
518  const bool dump_p = includesVerbLevel(verbLevel,Teuchos::VERB_MEDIUM);
519  const Teuchos::EVerbosityLevel p_verbLevel =
520  dump_p?Teuchos::VERB_EXTREME:verbLevel;
521  const bool print_p_nrm = includesVerbLevel(verbLevel,Teuchos::VERB_LOW);
522  OSTab tab(out);
523 
524  *out <<"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<">:\n";
525  tab.incrTab();
526 
527  *out <<"model = " << modelEvalDescription_ << "\n";
528  *out <<"Np = " << Np() << "\n";
529 
530  CV_ptr x_dot_dot;
531  if ( this->supports(IN_ARG_x_dot_dot) && !is_null(x_dot_dot=get_x_dot_dot()) ) {
532  *out << "x_dot_dot = " << Teuchos::describe(*x_dot_dot,x_verbLevel);
533  if (print_x_nrm)
534  *out << "||x_dot_dot|| = " << norm(*x_dot_dot) << endl;
535  }
536 
537  CV_ptr x_dot;
538  if ( this->supports(IN_ARG_x_dot) && !is_null(x_dot=get_x_dot()) ) {
539  *out << "x_dot = " << Teuchos::describe(*x_dot,x_verbLevel);
540  if (print_x_nrm)
541  *out << "||x_dot|| = " << norm(*x_dot) << endl;
542  }
543 
544  CV_ptr x;
545  if ( this->supports(IN_ARG_x) && !is_null(x=get_x()) ) {
546  *out << "x = " << Teuchos::describe(*x,x_verbLevel);
547  if (print_x_nrm)
548  *out << "||x|| = " << norm(*x) << endl;
549  }
550 
551  if (print_x_nrm) {
552  for( int l = 0; l < Np(); ++l ) {
553  CV_ptr p_l;
554  if ( !is_null(p_l = this->get_p(l)) ) {
555  *out << "p("<<l<<") = " << Teuchos::describe(*p_l,p_verbLevel);
556  if (print_p_nrm)
557  *out << "||p("<<l<<")|| = " << norm(*p_l) << endl;
558  }
559  }
560  }
561 
562  if (includesVerbLevel(verbLevel,Teuchos::VERB_MEDIUM)) {
563  if (this->supports(IN_ARG_t)) {
564  *out << "t = " << t_ << endl;
565  }
566  if (this->supports(IN_ARG_alpha)) {
567  *out << "alpha = " << alpha_ << endl;
568  }
569  if (this->supports(IN_ARG_beta)) {
570  *out << "beta = " << beta_ << endl;
571  }
572  if (this->supports(IN_ARG_W_x_dot_dot_coeff)) {
573  *out << "W_x_dot_dot_coeff = " << W_x_dot_dot_coeff_ << endl;
574  }
575  if (this->supports(IN_ARG_step_size)) {
576  *out << "step_size = " << step_size_ << endl;
577  }
578  if (this->supports(IN_ARG_stage_number)) {
579  *out << "stage_number = " << stage_number_ << endl;
580  }
581  }
582 
583 }
584 
585 
586 template<class Scalar>
588  const std::string &modelEvalDescription_in
589  )
590 {
591  modelEvalDescription_ = modelEvalDescription_in;
592 }
593 
594 
595 template<class Scalar>
597 {
598  p_.resize(Np_in);
599  p_direction_.resize(Np_in);
600  p_mp_.resize(Np_in);
601  supports_p_mp_.resize(Np_in);
602  g_multiplier_.resize(Ng_in);
603 }
604 
605 
606 template<class Scalar>
608  EInArgsMembers arg, bool supports_in
609  )
610 {
612  int(arg)>=NUM_E_IN_ARGS_MEMBERS || int(arg) < 0,std::logic_error
613  ,"model = \'"<<modelEvalDescription_
614  <<"\': Error, arg="<<toString(arg)<<" is invalid!");
615  supports_[arg] = supports_in;
616 }
617 
618 template<class Scalar>
620  EInArgs_p_mp /* arg */, int l, bool supports_in
621  )
622 {
623  assert_l(l);
624  supports_p_mp_[l] = supports_in;
625 }
626 
627 
628 template<class Scalar>
630  const InArgs<Scalar>& inArgs, const int Np_in
631  )
632 {
633  std::copy(
634  &inArgs.supports_[0],
635  &inArgs.supports_[0] + NUM_E_IN_ARGS_MEMBERS, &supports_[0] );
636  this->_set_Np_Ng( Np_in >= 0 ? Np_in : inArgs.Np(), inArgs.Ng() );
637 }
638 
639 
640 template<class Scalar>
642  EInArgsMembers arg
643  )
644 {
645  switch(arg) {
646  case IN_ARG_x: {
647  this->_setSupports(IN_ARG_x_dot_dot,false);
648  this->_setSupports(IN_ARG_x_dot,false);
649  this->_setSupports(IN_ARG_x_dot_poly,false);
650  this->_setSupports(IN_ARG_alpha,false);
651  this->_setSupports(IN_ARG_beta,false);
652  this->_setSupports(IN_ARG_W_x_dot_dot_coeff,false);
653  this->_setSupports(IN_ARG_step_size,false);
654  this->_setSupports(IN_ARG_stage_number,false);
655  break;
656  }
657  default:
659  true ,std::logic_error,
660  "Error, can not handle args other than IN_ARG_x yet!"
661  );
662  }
663  this->_setSupports(arg,false);
664 }
665 
666 
667 template<class Scalar>
669  EInArgsMembers arg
670  ) const
671 {
673  !supports_[arg], std::logic_error
674  ,"Thyra::ModelEvaluatorBase::InArgs<"
675  << Teuchos::ScalarTraits<Scalar>::name() <<">::assert_supports(arg): "
676  "model = \'"<<modelEvalDescription_<<"\': Error, "
677  "The argument arg = " << toString(arg) << " is not supported!"
678  );
679 }
680 
681 template<class Scalar>
683  EInArgs_p_mp /* arg */, int l
684  ) const
685 {
686  assert_l(l);
688  !supports_p_mp_[l], std::logic_error
689  ,"Thyra::ModelEvaluatorBase::InArgs<"
690  << Teuchos::ScalarTraits<Scalar>::name() <<">::assert_supports(IN_ARG_p_mp,1): "
691  "model = \'"<<modelEvalDescription_<<"\': Error, "
692  "The argument p_mp(l) with index l = " << l << " is not supported!"
693  );
694 }
695 
696 
697 template<class Scalar>
698 void ModelEvaluatorBase::InArgs<Scalar>::assert_l(int l) const
699 {
701  !( 0 <= l && l < Np() ), std::logic_error
702  ,"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_l(l):\n\n"
703  " model = \'"<<modelEvalDescription_<<"\':\n\n"
704  "Error, The parameter l = " << l << " is not in the range [0,"<<Np()<<")!"
705  );
706 }
707 
708 template<class Scalar>
709 void ModelEvaluatorBase::InArgs<Scalar>::assert_j(int j) const
710 {
712  !( 0 <= j && j < Ng() ), std::logic_error
713  ,"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_j(j):\n\n"
714  "model = \'"<<modelEvalDescription_<<"\':\n\n"
715  "Error, The auxiliary function g("<<j<<")"
716  " is not in the range [0,"<<Ng()<<")!"
717  );
718 }
719 
720 //
721 // ModelEvaluatorBase::DerivativeMultiVector
722 //
723 
724 
725 template<class Scalar>
727 {
728  using std::endl;
729  std::ostringstream oss;
730  oss << "DerivativeMultiVector{";
731  if (is_null(getMultiVector())) {
732  oss << "NULL";
733  }
734  else {
735  oss
736  << "multiVec=" << getMultiVector()->description()
737  << ",orientation=" << toString(getOrientation());
738  }
739  oss << "}";
740  return oss.str();
741 }
742 
743 
744 template<class Scalar>
746  Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
747  ) const
748 {
749  using std::endl;
750  using Teuchos::describe;
751  Teuchos::OSTab tab1(out);
752  out << "DerivativeMultiVector\n";
753  Teuchos::OSTab tab2(out);
754  out
755  << "multiVec = "
756  << describe(*getMultiVector(),verbLevel)
757  << "orientation = "
758  << toString(getOrientation()) << endl;
759 }
760 
761 
762 // 2007/06/12: rabartl: The above description() and describe(...) functions
763 // have to be defined here and not in the class DerivativeMultiVector since it
764 // relies on the non-member function
765 // toString(ModelEvaluatorBase::EDerivativeMultiVectorOrientation) which is
766 // defined after the class definition for ModelEvaluatorBase. This was caught
767 // by the intel compiler. I am not sure why this worked with gcc.
768 
769 
770 //
771 // ModelEvaluatorBase::Derivative
772 //
773 
774 
775 template<class Scalar>
776 std::string
778 {
779  using std::endl;
780  std::ostringstream oss;
781  oss << "Derivative{";
782  if (isEmpty()) {
783  oss << "NULL";
784  }
785  else if (!is_null(getLinearOp())) {
786  oss << "linearOp=" << getLinearOp()->description();
787  }
788  else {
789  oss << "derivMultiVec=" << getDerivativeMultiVector().description();
790  }
791  oss << "}";
792  return oss.str();
793 }
794 
795 
796 template<class Scalar>
798  Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
799  ) const
800 {
801  using std::endl;
802  using Teuchos::describe;
803  Teuchos::OSTab tab1(out);
804  out << "Derivative:";
805  if (isEmpty()) {
806  out << " NULL\n";
807  }
808  else if (!is_null(getLinearOp())) {
809  out
810  << endl
811  << "linearOp = " << describe(*getLinearOp(),verbLevel);
812  }
813  else {
814  out
815  << endl
816  << "derivMultiVec = ";
817  getDerivativeMultiVector().describe(out,verbLevel);
818  }
819 }
820 
821 
822 //
823 // ModelEvaluatorBase::OutArgs
824 //
825 
826 
827 template<class Scalar>
829  :modelEvalDescription_("WARNING! THIS OUTARGS OBJECT IS UNINITIALIZED!"),
830  isFailed_(false)
831 {
832  std::fill_n(&supports_[0],NUM_E_OUT_ARGS_MEMBERS,false);
833 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
834  this->_setHessianSupports(false);
835 #endif
836 }
837 
838 
839 template<class Scalar>
841 { return DfDp_.size(); }
842 
843 
844 template<class Scalar>
846 { return g_.size(); }
847 
848 
849 template<class Scalar>
851  EOutArgsMembers arg
852  ) const
853 {
855  int(arg)>=NUM_E_OUT_ARGS_MEMBERS || int(arg) < 0,std::logic_error
856  ,"model = \'"<<modelEvalDescription_
857  <<"\': Error, arg="<<toString(arg)<<" is invalid!"
858  );
859  return supports_[arg];
860 }
861 
862 
863 template<class Scalar>
866  EOutArgsDfDp /* arg */, int l
867  ) const
868 {
869  assert_l(l);
870  return supports_DfDp_[l];
871 }
872 
873 
874 template<class Scalar>
877  EOutArgsDgDx_dot /* arg */, int j
878  ) const
879 {
880  assert_j(j);
881  return supports_DgDx_dot_[j];
882 }
883 
884 
885 template<class Scalar>
888  EOutArgsDgDx /* arg */, int j
889  ) const
890 {
891  assert_j(j);
892  return supports_DgDx_[j];
893 }
894 
895 
896 template<class Scalar>
899  EOutArgsDgDp /* arg */, int j, int l
900  ) const
901 {
902  assert_j(j);
903  assert_l(l);
904  return supports_DgDp_[ j*Np() + l ];
905 }
906 
907 
908 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
909 
910 template<class Scalar>
912  EOutArgs_hess_vec_prod_f_xx /* arg */
913  ) const
914 {
915  return supports_hess_vec_prod_f_xx_;
916 }
917 
918 template<class Scalar>
920  EOutArgs_hess_vec_prod_f_xp /* arg */, int l
921  ) const
922 {
923  assert_l(l);
924  return supports_hess_vec_prod_f_xp_[l];
925 }
926 
927 template<class Scalar>
929  EOutArgs_hess_vec_prod_f_px /* arg */, int l
930  ) const
931 {
932  assert_l(l);
933  return supports_hess_vec_prod_f_px_[l];
934 }
935 
936 template<class Scalar>
938  EOutArgs_hess_vec_prod_f_pp /* arg */, int l1, int l2
939  ) const
940 {
941  assert_l(l1);
942  assert_l(l2);
943  return supports_hess_vec_prod_f_pp_[ l1*Np() + l2 ];
944 }
945 
946 template<class Scalar>
948  EOutArgs_hess_vec_prod_g_xx /* arg */, int j
949  ) const
950 {
951  assert_j(j);
952  return supports_hess_vec_prod_g_xx_[j];
953 }
954 
955 template<class Scalar>
957  EOutArgs_hess_vec_prod_g_xp /* arg */, int j, int l
958  ) const
959 {
960  assert_j(j);
961  assert_l(l);
962  return supports_hess_vec_prod_g_xp_[ j*Np() + l ];
963 }
964 
965 template<class Scalar>
967  EOutArgs_hess_vec_prod_g_px /* arg */, int j, int l
968  ) const
969 {
970  assert_j(j);
971  assert_l(l);
972  return supports_hess_vec_prod_g_px_[ j*Np() + l ];
973 }
974 
975 template<class Scalar>
977  EOutArgs_hess_vec_prod_g_pp /* arg */, int j, int l1, int l2
978  ) const
979 {
980  assert_j(j);
981  assert_l(l1);
982  assert_l(l2);
983  return supports_hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
984 }
985 
986 template<class Scalar>
988  EOutArgs_hess_f_xx /* arg */
989  ) const
990 {
991  return supports_hess_f_xx_;
992 }
993 
994 template<class Scalar>
996  EOutArgs_hess_f_xp /* arg */, int l
997  ) const
998 {
999  assert_l(l);
1000  return supports_hess_f_xp_[l];
1001 }
1002 
1003 template<class Scalar>
1005  EOutArgs_hess_f_pp /* arg */, int l1, int l2
1006  ) const
1007 {
1008  assert_l(l1);
1009  assert_l(l2);
1010  return supports_hess_f_pp_[ l1*Np() + l2 ];
1011 }
1012 
1013 template<class Scalar>
1015  EOutArgs_H_xx /* arg */
1016  ) const
1017 {
1018  return supports_H_xx_;
1019 }
1020 
1021 template<class Scalar>
1023  EOutArgs_H_xp /* arg */, int l
1024  ) const
1025 {
1026  assert_l(l);
1027  return supports_H_xp_[l];
1028 }
1029 
1030 template<class Scalar>
1032  EOutArgs_H_pp /* arg */, int l1, int l2
1033  ) const
1034 {
1035  assert_l(l1);
1036  assert_l(l2);
1037  return supports_H_pp_[ l1*Np() + l2 ];
1038 }
1039 
1040 template<class Scalar>
1042  EOutArgs_hess_g_xx /* arg */, int j
1043  ) const
1044 {
1045  assert_j(j);
1046  return supports_hess_g_xx_[j];
1047 }
1048 
1049 template<class Scalar>
1051  EOutArgs_hess_g_xp /* arg */, int j, int l
1052  ) const
1053 {
1054  assert_j(j);
1055  assert_l(l);
1056  return supports_hess_g_xp_[ j*Np() + l ];
1057 }
1058 
1059 template<class Scalar>
1061  EOutArgs_hess_g_pp /* arg */, int j, int l1, int l2
1062  ) const
1063 {
1064  assert_j(j);
1065  assert_l(l1);
1066  assert_l(l2);
1067  return supports_hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1068 }
1069 
1070 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
1071 
1072 
1073 template<class Scalar>
1074 bool
1076  EOutArgs_g_mp /* arg */, int j
1077  ) const
1078 {
1079  assert_j(j);
1080  return supports_g_mp_[j];
1081 }
1082 
1083 template<class Scalar>
1084 const ModelEvaluatorBase::DerivativeSupport&
1086  EOutArgsDfDp_mp /* arg */, int l
1087  ) const
1088 {
1089  assert_l(l);
1090  return supports_DfDp_mp_[l];
1091 }
1092 
1093 
1094 template<class Scalar>
1095 const ModelEvaluatorBase::DerivativeSupport&
1097  EOutArgsDgDx_dot_mp /* arg */, int j
1098  ) const
1099 {
1100  assert_j(j);
1101  return supports_DgDx_dot_mp_[j];
1102 }
1103 
1104 
1105 template<class Scalar>
1106 const ModelEvaluatorBase::DerivativeSupport&
1108  EOutArgsDgDx_mp /* arg */, int j
1109  ) const
1110 {
1111  assert_j(j);
1112  return supports_DgDx_mp_[j];
1113 }
1114 
1115 
1116 template<class Scalar>
1117 const ModelEvaluatorBase::DerivativeSupport&
1119  EOutArgsDgDp_mp /* arg */, int j, int l
1120  ) const
1121 {
1122  assert_j(j);
1123  assert_l(l);
1124  return supports_DgDp_mp_[ j*Np() + l ];
1125 }
1126 
1127 
1128 
1129 template<class Scalar>
1131  const Evaluation<VectorBase<Scalar> > &f
1132  )
1133 {
1134  assert_supports(OUT_ARG_f);
1135  f_ = f;
1136 }
1137 
1138 
1139 template<class Scalar>
1142 {
1143  assert_supports(OUT_ARG_f);
1144  return f_;
1145 }
1146 
1147 
1148 template<class Scalar>
1150  int j, const Evaluation<VectorBase<Scalar> > &g_j
1151  )
1152 {
1153  assert_j(j);
1154  g_[j] = g_j;
1155 }
1156 
1157 
1158 template<class Scalar>
1161 {
1162  assert_j(j);
1163  return g_[j];
1164 }
1165 
1166 
1167 template<class Scalar>
1170  )
1171 {
1172  assert_supports(OUT_ARG_f_mp);
1173  f_mp_ = f_mp;
1174 }
1175 
1176 
1177 template<class Scalar>
1180 {
1181  assert_supports(OUT_ARG_f_mp);
1182  return f_mp_;
1183 }
1184 
1185 
1186 template<class Scalar>
1188  int j, const RCP<Stokhos::ProductEpetraVector> &g_mp_j
1189  )
1190 {
1191  assert_supports(OUT_ARG_g_mp,j);
1192  g_mp_[j] = g_mp_j;
1193 }
1194 
1195 
1196 template<class Scalar>
1199 {
1200  assert_supports(OUT_ARG_g_mp,j);
1201  return g_mp_[j];
1202 }
1203 
1204 
1205 template<class Scalar>
1208  )
1209 {
1210  assert_supports(OUT_ARG_W);
1211  W_ = W;
1212 }
1213 
1214 
1215 template<class Scalar>
1218 {
1219  assert_supports(OUT_ARG_W);
1220  return W_;
1221 }
1222 
1223 
1224 template<class Scalar>
1227  )
1228 {
1229  assert_supports(OUT_ARG_W_mp);
1230  W_mp_ = W_mp;
1231 }
1232 
1233 
1234 template<class Scalar>
1237 {
1238  assert_supports(OUT_ARG_W_mp);
1239  return W_mp_;
1240 }
1241 
1242 
1243 template<class Scalar>
1245  const RCP<LinearOpBase<Scalar> > &W_op
1246  )
1247 {
1248  assert_supports(OUT_ARG_W_op);
1249  W_op_ = W_op;
1250 }
1251 
1252 
1253 template<class Scalar>
1256 {
1257  assert_supports(OUT_ARG_W_op);
1258  return W_op_;
1259 }
1260 
1261 
1262 template<class Scalar>
1264  const RCP<PreconditionerBase<Scalar> > &W_prec
1265  )
1266 {
1267  assert_supports(OUT_ARG_W_prec);
1268  W_prec_ = W_prec;
1269 }
1270 
1271 
1272 template<class Scalar>
1275 {
1276  assert_supports(OUT_ARG_W_prec);
1277  return W_prec_;
1278 }
1279 
1280 
1281 template<class Scalar>
1284 {
1285  assert_supports(OUT_ARG_f);
1286  return W_properties_;
1287 }
1288 
1289 
1290 template<class Scalar>
1292  int l, const Derivative<Scalar> &DfDp_l
1293  )
1294 {
1295  assert_supports(OUT_ARG_DfDp,l,DfDp_l);
1296  DfDp_[l] = DfDp_l;
1297 }
1298 
1299 
1300 template<class Scalar>
1303 {
1304  assert_supports(OUT_ARG_DfDp,l);
1305  return DfDp_[l];
1306 }
1307 
1308 
1309 template<class Scalar>
1312 {
1313  assert_supports(OUT_ARG_DfDp,l);
1314  return DfDp_properties_[l];
1315 }
1316 
1317 
1318 template<class Scalar>
1320  int l, const MPDerivative &DfDp_mp_l
1321  )
1322 {
1323  assert_supports(OUT_ARG_DfDp_mp,l,DfDp_mp_l);
1324  DfDp_mp_[l] = DfDp_mp_l;
1325 }
1326 
1327 
1328 template<class Scalar>
1331 {
1332  assert_supports(OUT_ARG_DfDp_mp,l);
1333  return DfDp_mp_[l];
1334 }
1335 
1336 
1337 template<class Scalar>
1338 ModelEvaluatorBase::DerivativeProperties
1339 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp_mp_properties(int l) const
1340 {
1341  assert_supports(OUT_ARG_DfDp_mp,l);
1342  return DfDp_mp_properties_[l];
1343 }
1344 
1345 
1346 template<class Scalar>
1348  int j, const Derivative<Scalar> &DgDx_dot_j
1349  )
1350 {
1351  assert_supports(OUT_ARG_DgDx_dot,j,DgDx_dot_j);
1352  DgDx_dot_[j] = DgDx_dot_j;
1353 }
1354 
1355 
1356 template<class Scalar>
1359 {
1360  assert_supports(OUT_ARG_DgDx_dot,j);
1361  return DgDx_dot_[j];
1362 }
1363 
1364 
1365 template<class Scalar>
1368 {
1369  assert_supports(OUT_ARG_DgDx_dot,j);
1370  return DgDx_dot_properties_[j];
1371 }
1372 
1373 
1374 template<class Scalar>
1376  int j, const MPDerivative &DgDx_dot_mp_j
1377  )
1378 {
1379  assert_supports(OUT_ARG_DgDx_dot_mp,j,DgDx_dot_mp_j);
1380  DgDx_dot_mp_[j] = DgDx_dot_mp_j;
1381 }
1382 
1383 
1384 template<class Scalar>
1387 {
1388  assert_supports(OUT_ARG_DgDx_dot_mp,j);
1389  return DgDx_dot_mp_[j];
1390 }
1391 
1392 
1393 template<class Scalar>
1394 ModelEvaluatorBase::DerivativeProperties
1395 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot_mp_properties(int j) const
1396 {
1397  assert_supports(OUT_ARG_DgDx_dot_mp,j);
1398  return DgDx_dot_mp_properties_[j];
1399 }
1400 
1401 
1402 template<class Scalar>
1404  int j, const Derivative<Scalar> &DgDx_j
1405  )
1406 {
1407  assert_supports(OUT_ARG_DgDx,j,DgDx_j);
1408  DgDx_[j] = DgDx_j;
1409 }
1410 
1411 
1412 template<class Scalar>
1415 {
1416  assert_supports(OUT_ARG_DgDx,j);
1417  return DgDx_[j];
1418 }
1419 
1420 
1421 template<class Scalar>
1424 {
1425  assert_supports(OUT_ARG_DgDx,j);
1426  return DgDx_properties_[j];
1427 }
1428 
1429 
1430 template<class Scalar>
1432  int j, const MPDerivative &DgDx_mp_j
1433  )
1434 {
1435  assert_supports(OUT_ARG_DgDx_mp,j,DgDx_mp_j);
1436  DgDx_mp_[j] = DgDx_mp_j;
1437 }
1438 
1439 
1440 template<class Scalar>
1443 {
1444  assert_supports(OUT_ARG_DgDx_mp,j);
1445  return DgDx_mp_[j];
1446 }
1447 
1448 
1449 template<class Scalar>
1450 ModelEvaluatorBase::DerivativeProperties
1451 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_mp_properties(int j) const
1452 {
1453  assert_supports(OUT_ARG_DgDx_mp,j);
1454  return DgDx_mp_properties_[j];
1455 }
1456 
1457 
1458 template<class Scalar>
1460  int j, int l, const Derivative<Scalar> &DgDp_j_l
1461  )
1462 {
1463  assert_supports(OUT_ARG_DgDp,j,l,DgDp_j_l);
1464  DgDp_[ j*Np() + l ] = DgDp_j_l;
1465 }
1466 
1467 
1468 template<class Scalar>
1471 {
1472  assert_supports(OUT_ARG_DgDp,j,l);
1473  return DgDp_[ j*Np() + l ];
1474 }
1475 
1476 
1477 template<class Scalar>
1480 {
1481  assert_supports(OUT_ARG_DgDp,j,l);
1482  return DgDp_properties_[ j*Np() + l ];
1483 }
1484 
1485 
1486 template<class Scalar>
1488  int j, int l, const MPDerivative &DgDp_mp_j_l
1489  )
1490 {
1491  assert_supports(OUT_ARG_DgDp_mp,j,l,DgDp_mp_j_l);
1492  DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l;
1493 }
1494 
1495 
1496 template<class Scalar>
1499 {
1500  assert_supports(OUT_ARG_DgDp_mp,j,l);
1501  return DgDp_mp_[ j*Np() + l ];
1502 }
1503 
1504 
1505 template<class Scalar>
1506 ModelEvaluatorBase::DerivativeProperties
1507 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp_mp_properties(int j, int l) const
1508 {
1509  assert_supports(OUT_ARG_DgDp_mp,j,l);
1510  return DgDp_mp_properties_[ j*Np() + l ];
1511 }
1512 
1513 
1514 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
1515 
1516 template<class Scalar>
1517 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_xx(
1518  const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_xx
1519  )
1520 {
1521  assert_supports(OUT_ARG_hess_vec_prod_f_xx);
1522  hess_vec_prod_f_xx_ = hess_vec_prod_f_xx;
1523 }
1524 
1525 template<class Scalar>
1526 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_xp(
1527  int l, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_xp_l
1528  )
1529 {
1530  assert_supports(OUT_ARG_hess_vec_prod_f_xp,l);
1531  hess_vec_prod_f_xp_[l] = hess_vec_prod_f_xp_l;
1532 }
1533 
1534 template<class Scalar>
1535 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_px(
1536  int l, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_px_l
1537  )
1538 {
1539  assert_supports(OUT_ARG_hess_vec_prod_f_px,l);
1540  hess_vec_prod_f_px_[l] = hess_vec_prod_f_px_l;
1541 }
1542 
1543 template<class Scalar>
1544 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_f_pp(
1545  int l1, int l2, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_f_pp_l1_l2
1546  )
1547 {
1548  assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2);
1549  hess_vec_prod_f_pp_[ l1*Np() + l2 ] = hess_vec_prod_f_pp_l1_l2;
1550 }
1551 
1552 template<class Scalar>
1553 RCP<MultiVectorBase<Scalar> >
1554 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_xx() const
1555 {
1556  assert_supports(OUT_ARG_hess_vec_prod_f_xx);
1557  return hess_vec_prod_f_xx_;
1558 }
1559 
1560 template<class Scalar>
1561 RCP<MultiVectorBase<Scalar> >
1562 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_xp(int l) const
1563 {
1564  assert_supports(OUT_ARG_hess_vec_prod_f_xp,l);
1565  return hess_vec_prod_f_xp_[l];
1566 }
1567 
1568 template<class Scalar>
1569 RCP<MultiVectorBase<Scalar> >
1570 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_px(int l) const
1571 {
1572  assert_supports(OUT_ARG_hess_vec_prod_f_px,l);
1573  return hess_vec_prod_f_px_[l];
1574 }
1575 
1576 template<class Scalar>
1577 RCP<MultiVectorBase<Scalar> >
1578 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_f_pp(int l1, int l2) const
1579 {
1580  assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2);
1581  return hess_vec_prod_f_pp_[ l1*Np() + l2 ];
1582 }
1583 
1584 
1585 template<class Scalar>
1586 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_xx(
1587  int j, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_xx_j
1588  )
1589 {
1590  assert_supports(OUT_ARG_hess_vec_prod_g_xx,j);
1591  hess_vec_prod_g_xx_[j] = hess_vec_prod_g_xx_j;
1592 }
1593 
1594 template<class Scalar>
1595 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_xp(
1596  int j, int l, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_xp_j_l
1597  )
1598 {
1599  assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l);
1600  hess_vec_prod_g_xp_[ j*Np() + l ] = hess_vec_prod_g_xp_j_l;
1601 }
1602 
1603 template<class Scalar>
1604 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_px(
1605  int j, int l, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_px_j_l
1606  )
1607 {
1608  assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l);
1609  hess_vec_prod_g_px_[ j*Np() + l ] = hess_vec_prod_g_px_j_l;
1610 }
1611 
1612 template<class Scalar>
1613 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_vec_prod_g_pp(
1614  int j, int l1, int l2, const RCP<MultiVectorBase<Scalar> > &hess_vec_prod_g_pp_j_l1_l2
1615  )
1616 {
1617  assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2);
1618  hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ] = hess_vec_prod_g_pp_j_l1_l2;
1619 }
1620 
1621 template<class Scalar>
1622 RCP<MultiVectorBase<Scalar> >
1623 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_xx(int j) const
1624 {
1625  assert_supports(OUT_ARG_hess_vec_prod_g_xx,j);
1626  return hess_vec_prod_g_xx_[j];
1627 }
1628 
1629 template<class Scalar>
1630 RCP<MultiVectorBase<Scalar> >
1631 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_xp(int j, int l) const
1632 {
1633  assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l);
1634  return hess_vec_prod_g_xp_[ j*Np() + l ];
1635 }
1636 
1637 template<class Scalar>
1638 RCP<MultiVectorBase<Scalar> >
1639 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_px(int j, int l) const
1640 {
1641  assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l);
1642  return hess_vec_prod_g_px_[ j*Np() + l ];
1643 }
1644 
1645 template<class Scalar>
1646 RCP<MultiVectorBase<Scalar> >
1647 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_vec_prod_g_pp(int j, int l1, int l2) const
1648 {
1649  assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2);
1650  return hess_vec_prod_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1651 }
1652 
1653 template<class Scalar>
1654 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_xx(
1655  const RCP<LinearOpBase<Scalar> > &hess_f_xx
1656  )
1657 {
1658  assert_supports(OUT_ARG_hess_f_xx);
1659  hess_f_xx_ = hess_f_xx;
1660 }
1661 
1662 template<class Scalar>
1663 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_xp(
1664  int l, const RCP<LinearOpBase<Scalar> > &hess_f_xp_l
1665  )
1666 {
1667  assert_supports(OUT_ARG_hess_f_xp,l);
1668  hess_f_xp_[l] = hess_f_xp_l;
1669 }
1670 
1671 template<class Scalar>
1672 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_f_pp(
1673  int l1, int l2, const RCP<LinearOpBase<Scalar> > &hess_f_pp_l1_l2
1674  )
1675 {
1676  assert_supports(OUT_ARG_hess_f_pp,l1,l2);
1677  hess_f_pp_[ l1*Np() + l2 ] = hess_f_pp_l1_l2;
1678 }
1679 
1680 template<class Scalar>
1681 RCP<LinearOpBase<Scalar> >
1682 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_xx() const
1683 {
1684  assert_supports(OUT_ARG_hess_f_xx);
1685  return hess_f_xx_;
1686 }
1687 
1688 template<class Scalar>
1689 RCP<LinearOpBase<Scalar> >
1690 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_xp(int l) const
1691 {
1692  assert_supports(OUT_ARG_hess_f_xp,l);
1693  return hess_f_xp_[l];
1694 }
1695 
1696 template<class Scalar>
1697 RCP<LinearOpBase<Scalar> >
1698 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_f_pp(int l1, int l2) const
1699 {
1700  assert_supports(OUT_ARG_hess_f_pp,l1,l2);
1701  return hess_f_pp_[ l1*Np() + l2 ];
1702 }
1703 
1704 template<class Scalar>
1705 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_xx(
1706  int j, const RCP<LinearOpBase<Scalar> > &hess_g_xx_j
1707  )
1708 {
1709  assert_supports(OUT_ARG_hess_g_xx,j);
1710  hess_g_xx_[j] = hess_g_xx_j;
1711 }
1712 
1713 template<class Scalar>
1714 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_xp(
1715  int j, int l, const RCP<LinearOpBase<Scalar> > &hess_g_xp_j_l
1716  )
1717 {
1718  assert_supports(OUT_ARG_hess_g_xp,j,l);
1719  hess_g_xp_[ j*Np() + l ] = hess_g_xp_j_l;
1720 }
1721 
1722 template<class Scalar>
1723 void ModelEvaluatorBase::OutArgs<Scalar>::set_hess_g_pp(
1724  int j, int l1, int l2, const RCP<LinearOpBase<Scalar> > &hess_g_pp_j_l1_l2
1725  )
1726 {
1727  assert_supports(OUT_ARG_hess_g_pp,j,l1,l2);
1728  hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ] = hess_g_pp_j_l1_l2;
1729 }
1730 
1731 template<class Scalar>
1732 RCP<LinearOpBase<Scalar> >
1733 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_xx(int j) const
1734 {
1735  assert_supports(OUT_ARG_hess_g_xx,j);
1736  return hess_g_xx_[j];
1737 }
1738 
1739 template<class Scalar>
1740 RCP<LinearOpBase<Scalar> >
1741 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_xp(int j, int l) const
1742 {
1743  assert_supports(OUT_ARG_hess_g_xp,j,l);
1744  return hess_g_xp_[ j*Np() + l ];
1745 }
1746 
1747 template<class Scalar>
1748 RCP<LinearOpBase<Scalar> >
1749 ModelEvaluatorBase::OutArgs<Scalar>::get_hess_g_pp(int j, int l1, int l2) const
1750 {
1751  assert_supports(OUT_ARG_hess_g_pp,j,l1,l2);
1752  return hess_g_pp_[ j*Np()*Np() + l1*Np() + l2 ];
1753 }
1754 
1755 template<class Scalar>
1756 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_xx(
1757  const RCP<LinearOpBase<Scalar> > &H_xx
1758  )
1759 {
1760  assert_supports(OUT_ARG_H_xx);
1761  H_xx_ = H_xx;
1762 }
1763 
1764 template<class Scalar>
1765 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_xp(
1766  int l, const RCP<LinearOpBase<Scalar> > &H_xp_l
1767  )
1768 {
1769  assert_supports(OUT_ARG_H_xp,l);
1770  H_xp_[l] = H_xp_l;
1771 }
1772 
1773 template<class Scalar>
1774 void ModelEvaluatorBase::OutArgs<Scalar>::set_H_pp(
1775  int l1, int l2, const RCP<LinearOpBase<Scalar> > &H_pp_l1_l2
1776  )
1777 {
1778  assert_supports(OUT_ARG_H_pp,l1,l2);
1779  H_pp_[ l1*Np() + l2 ] = H_pp_l1_l2;
1780 }
1781 
1782 template<class Scalar>
1783 RCP<LinearOpBase<Scalar> >
1784 ModelEvaluatorBase::OutArgs<Scalar>::get_H_xx() const
1785 {
1786  assert_supports(OUT_ARG_H_xx);
1787  return H_xx_;
1788 }
1789 
1790 template<class Scalar>
1791 RCP<LinearOpBase<Scalar> >
1792 ModelEvaluatorBase::OutArgs<Scalar>::get_H_xp(int l) const
1793 {
1794  assert_supports(OUT_ARG_H_xp,l);
1795  return H_xp_[l];
1796 }
1797 
1798 template<class Scalar>
1799 RCP<LinearOpBase<Scalar> >
1800 ModelEvaluatorBase::OutArgs<Scalar>::get_H_pp(int l1, int l2) const
1801 {
1802  assert_supports(OUT_ARG_H_pp,l1,l2);
1803  return H_pp_[ l1*Np() + l2 ];
1804 }
1805 
1806 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
1807 
1808 
1809 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1810 
1811 
1812 template<class Scalar>
1813 void ModelEvaluatorBase::OutArgs<Scalar>::set_f_poly(
1814  const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly
1815  )
1816 {
1817  f_poly_ = f_poly;
1818 }
1819 
1820 
1821 template<class Scalar>
1822 RCP<Teuchos::Polynomial< VectorBase<Scalar> > >
1823 ModelEvaluatorBase::OutArgs<Scalar>::get_f_poly() const
1824 {
1825  return f_poly_;
1826 }
1827 
1828 
1829 #endif // HAVE_THYRA_ME_POLYNOMIAL
1830 
1831 
1832 template<class Scalar>
1834  const OutArgs<Scalar>& inputOutArgs, bool ignoreUnsupported
1835  )
1836 {
1837  typedef ModelEvaluatorBase MEB;
1838  const int min_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.Np());
1839  const int min_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.Ng());
1840  // f
1841  if ( inputOutArgs.supports(OUT_ARG_f) && nonnull(inputOutArgs.get_f()) ) {
1842  if ( supports(OUT_ARG_f) || !ignoreUnsupported )
1843  set_f(inputOutArgs.get_f());
1844  }
1845  if ( inputOutArgs.supports(OUT_ARG_f_mp) && nonnull(inputOutArgs.get_f_mp()) ) {
1846  if ( supports(OUT_ARG_f_mp) || !ignoreUnsupported )
1847  set_f_mp(inputOutArgs.get_f_mp());
1848  }
1849 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1850  // f_poly
1851  if ( inputOutArgs.supports(OUT_ARG_f_poly) && nonnull(inputOutArgs.get_f_poly()) ) {
1852  if ( supports(OUT_ARG_f_poly) || !ignoreUnsupported )
1853  set_f_poly(inputOutArgs.get_f_poly());
1854  }
1855 #endif // HAVE_THYRA_ME_POLYNOMIAL
1856  // g(j)
1857  for ( int j = 0; j < min_Ng; ++j ) {
1858  if ( nonnull(inputOutArgs.get_g(j)) )
1859  set_g(j,inputOutArgs.get_g(j));
1860  }
1861  for ( int j = 0; j < min_Ng; ++j ) {
1862  if ( inputOutArgs.supports(OUT_ARG_g_mp,j) && nonnull(inputOutArgs.get_g_mp(j)) ) {
1863  if ( supports(OUT_ARG_g_mp,j) || !ignoreUnsupported )
1864  set_g_mp(j,inputOutArgs.get_g_mp(j));
1865  }
1866  }
1867  // W
1868  if( inputOutArgs.supports(OUT_ARG_W) && nonnull(inputOutArgs.get_W()) ) {
1869  if ( supports(OUT_ARG_W) || !ignoreUnsupported )
1870  set_W(inputOutArgs.get_W());
1871  }
1872  if( inputOutArgs.supports(OUT_ARG_W_mp) && nonnull(inputOutArgs.get_W_mp()) ) {
1873  if ( supports(OUT_ARG_W_mp) || !ignoreUnsupported )
1874  set_W_mp(inputOutArgs.get_W_mp());
1875  }
1876  // W_op
1877  if( inputOutArgs.supports(OUT_ARG_W_op) && nonnull(inputOutArgs.get_W_op()) ) {
1878  if ( supports(OUT_ARG_W_op) || !ignoreUnsupported )
1879  set_W_op(inputOutArgs.get_W_op());
1880  }
1881  // W_prec
1882  if( inputOutArgs.supports(OUT_ARG_W_prec) && nonnull(inputOutArgs.get_W_prec()) ) {
1883  if ( supports(OUT_ARG_W_prec) || !ignoreUnsupported )
1884  set_W_prec(inputOutArgs.get_W_prec());
1885  }
1886  // DfDp(l)
1887  for ( int l = 0; l < min_Np; ++l ) {
1888  MEB::Derivative<Scalar> DfDp_l;
1889  if ( !inputOutArgs.supports(OUT_ARG_DfDp,l).none()
1890  && !(DfDp_l=inputOutArgs.get_DfDp(l)).isEmpty() )
1891  {
1892  if ( DfDp_l.isSupportedBy(supports(OUT_ARG_DfDp,l)) || !ignoreUnsupported )
1893  set_DfDp(l,DfDp_l);
1894  }
1895  }
1896  for ( int l = 0; l < min_Np; ++l ) {
1897  MEB::MPDerivative DfDp_mp_l;
1898  if ( !inputOutArgs.supports(OUT_ARG_DfDp_mp,l).none()
1899  && !(DfDp_mp_l=inputOutArgs.get_DfDp_mp(l)).isEmpty() )
1900  {
1901  if ( DfDp_mp_l.isSupportedBy(supports(OUT_ARG_DfDp_mp,l)) || !ignoreUnsupported )
1902  set_DfDp_mp(l,DfDp_mp_l);
1903  }
1904  }
1905  // DgDx_dot(j) and DgDx(j)
1906  for ( int j = 0; j < min_Ng; ++j ) {
1907  // DgDx_dot(j)
1908  MEB::Derivative<Scalar> DgDx_dot_j;
1909  if ( !inputOutArgs.supports(OUT_ARG_DgDx_dot,j).none()
1910  && !(DgDx_dot_j=inputOutArgs.get_DgDx_dot(j)).isEmpty() )
1911  {
1912  if( DgDx_dot_j.isSupportedBy(supports(OUT_ARG_DgDx_dot,j)) || !ignoreUnsupported )
1913  set_DgDx_dot(j,DgDx_dot_j);
1914  }
1915  // DgDx(j)
1916  MEB::Derivative<Scalar> DgDx_j;
1917  if ( !inputOutArgs.supports(OUT_ARG_DgDx,j).none()
1918  && !(DgDx_j=inputOutArgs.get_DgDx(j)).isEmpty() ) {
1919  if ( DgDx_j.isSupportedBy(supports(OUT_ARG_DgDx,j)) || !ignoreUnsupported )
1920  set_DgDx(j,DgDx_j);
1921  }
1922  }
1923  for ( int j = 0; j < min_Ng; ++j ) {
1924  // DgDx_dot(j)
1925  MEB::MPDerivative DgDx_dot_mp_j;
1926  if ( !inputOutArgs.supports(OUT_ARG_DgDx_dot_mp,j).none()
1927  && !(DgDx_dot_mp_j=inputOutArgs.get_DgDx_dot_mp(j)).isEmpty() )
1928  {
1929  if( DgDx_dot_mp_j.isSupportedBy(supports(OUT_ARG_DgDx_dot_mp,j)) || !ignoreUnsupported )
1930  set_DgDx_dot_mp(j,DgDx_dot_mp_j);
1931  }
1932  // DgDx(j)
1933  MEB::MPDerivative DgDx_mp_j;
1934  if ( !inputOutArgs.supports(OUT_ARG_DgDx_mp,j).none()
1935  && !(DgDx_mp_j=inputOutArgs.get_DgDx_mp(j)).isEmpty() ) {
1936  if ( DgDx_mp_j.isSupportedBy(supports(OUT_ARG_DgDx_mp,j)) || !ignoreUnsupported )
1937  set_DgDx_mp(j,DgDx_mp_j);
1938  }
1939  }
1940  // DgDp(j,l)
1941  for ( int l = 0; l < min_Np; ++l ) {
1942  for ( int j = 0; j < min_Ng; ++j ) {
1943  MEB::Derivative<Scalar> DgDp_j_l;
1944  if ( !inputOutArgs.supports(OUT_ARG_DgDp,j,l).none()
1945  && !(DgDp_j_l=inputOutArgs.get_DgDp(j,l)).isEmpty() )
1946  {
1947  if ( DgDp_j_l.isSupportedBy(supports(OUT_ARG_DgDp,j,l)) || !ignoreUnsupported )
1948  set_DgDp(j,l,DgDp_j_l);
1949  }
1950  }
1951  }
1952  for ( int l = 0; l < min_Np; ++l ) {
1953  for ( int j = 0; j < min_Ng; ++j ) {
1954  MEB::MPDerivative DgDp_mp_j_l;
1955  if ( !inputOutArgs.supports(OUT_ARG_DgDp_mp,j,l).none()
1956  && !(DgDp_mp_j_l=inputOutArgs.get_DgDp_mp(j,l)).isEmpty() )
1957  {
1958  if ( DgDp_mp_j_l.isSupportedBy(supports(OUT_ARG_DgDp_mp,j,l)) || !ignoreUnsupported )
1959  set_DgDp_mp(j,l,DgDp_mp_j_l);
1960  }
1961  }
1962  }
1963 
1964 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
1965 
1966  // hess_vec_prod_f
1967  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_f_xx) && nonnull(inputOutArgs.get_hess_vec_prod_f_xx()) ) {
1968  if ( supports(OUT_ARG_hess_vec_prod_f_xx) || !ignoreUnsupported )
1969  set_hess_vec_prod_f_xx(inputOutArgs.get_hess_vec_prod_f_xx());
1970  }
1971  for ( int l1 = 0; l1 < min_Np; ++l1 ) {
1972  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_f_xp,l1) && nonnull(inputOutArgs.get_hess_vec_prod_f_xp(l1)) ) {
1973  if ( supports(OUT_ARG_hess_vec_prod_f_xp,l1) || !ignoreUnsupported )
1974  set_hess_vec_prod_f_xp(l1,inputOutArgs.get_hess_vec_prod_f_xp(l1));
1975  }
1976  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_f_px,l1) && nonnull(inputOutArgs.get_hess_vec_prod_f_px(l1)) ) {
1977  if ( supports(OUT_ARG_hess_vec_prod_f_px,l1) || !ignoreUnsupported )
1978  set_hess_vec_prod_f_px(l1,inputOutArgs.get_hess_vec_prod_f_px(l1));
1979  }
1980  for ( int l2 = 0; l2 < min_Np; ++l2 ) {
1981  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2) && nonnull(inputOutArgs.get_hess_vec_prod_f_pp(l1,l2)) ) {
1982  if ( supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2) || !ignoreUnsupported )
1983  set_hess_vec_prod_f_pp(l1,l2,inputOutArgs.get_hess_vec_prod_f_pp(l1,l2));
1984  }
1985  }
1986  }
1987 
1988  // hess_vec_prod_g
1989  for ( int j = 0; j < min_Ng; ++j ) {
1990  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_g_xx,j) && nonnull(inputOutArgs.get_hess_vec_prod_g_xx(j)) ) {
1991  if ( supports(OUT_ARG_hess_vec_prod_g_xx,j) || !ignoreUnsupported )
1992  set_hess_vec_prod_g_xx(j,inputOutArgs.get_hess_vec_prod_g_xx(j));
1993  }
1994  for ( int l1 = 0; l1 < min_Np; ++l1 ) {
1995  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_g_xp,j,l1) && nonnull(inputOutArgs.get_hess_vec_prod_g_xp(j,l1)) ) {
1996  if ( supports(OUT_ARG_hess_vec_prod_g_xp,j,l1) || !ignoreUnsupported )
1997  set_hess_vec_prod_g_xp(j,l1,inputOutArgs.get_hess_vec_prod_g_xp(j,l1));
1998  }
1999  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_g_px,j,l1) && nonnull(inputOutArgs.get_hess_vec_prod_g_px(j,l1)) ) {
2000  if ( supports(OUT_ARG_hess_vec_prod_g_px,j,l1) || !ignoreUnsupported )
2001  set_hess_vec_prod_g_px(j,l1,inputOutArgs.get_hess_vec_prod_g_px(j,l1));
2002  }
2003  for ( int l2 = 0; l2 < min_Np; ++l2 ) {
2004  if( inputOutArgs.supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2) && nonnull(inputOutArgs.get_hess_vec_prod_g_pp(j,l1,l2)) ) {
2005  if ( supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2) || !ignoreUnsupported )
2006  set_hess_vec_prod_g_pp(j,l1,l2,inputOutArgs.get_hess_vec_prod_g_pp(j,l1,l2));
2007  }
2008  }
2009  }
2010  }
2011 
2012  // hess_f
2013  if( inputOutArgs.supports(OUT_ARG_hess_f_xx) && nonnull(inputOutArgs.get_hess_f_xx()) ) {
2014  if ( supports(OUT_ARG_hess_f_xx) || !ignoreUnsupported )
2015  set_hess_f_xx(inputOutArgs.get_hess_f_xx());
2016  }
2017  for ( int l1 = 0; l1 < min_Np; ++l1 ) {
2018  if( inputOutArgs.supports(OUT_ARG_hess_f_xp,l1) && nonnull(inputOutArgs.get_hess_f_xp(l1)) ) {
2019  if ( supports(OUT_ARG_hess_f_xp,l1) || !ignoreUnsupported )
2020  set_hess_f_xp(l1,inputOutArgs.get_hess_f_xp(l1));
2021  }
2022  for ( int l2 = 0; l2 < min_Np; ++l2 ) {
2023  if( inputOutArgs.supports(OUT_ARG_hess_f_pp,l1,l2) && nonnull(inputOutArgs.get_hess_f_pp(l1,l2)) ) {
2024  if ( supports(OUT_ARG_hess_f_pp,l1,l2) || !ignoreUnsupported )
2025  set_hess_f_pp(l1,l2,inputOutArgs.get_hess_f_pp(l1,l2));
2026  }
2027  }
2028  }
2029 
2030  // hess_g
2031  for ( int j = 0; j < min_Ng; ++j ) {
2032  if( inputOutArgs.supports(OUT_ARG_hess_g_xx,j) && nonnull(inputOutArgs.get_hess_g_xx(j)) ) {
2033  if ( supports(OUT_ARG_hess_g_xx,j) || !ignoreUnsupported )
2034  set_hess_g_xx(j,inputOutArgs.get_hess_g_xx(j));
2035  }
2036  for ( int l1 = 0; l1 < min_Np; ++l1 ) {
2037  if( inputOutArgs.supports(OUT_ARG_hess_g_xp,j,l1) && nonnull(inputOutArgs.get_hess_g_xp(j,l1)) ) {
2038  if ( supports(OUT_ARG_hess_g_xp,j,l1) || !ignoreUnsupported )
2039  set_hess_g_xp(j,l1,inputOutArgs.get_hess_g_xp(j,l1));
2040  }
2041  for ( int l2 = 0; l2 < min_Np; ++l2 ) {
2042  if( inputOutArgs.supports(OUT_ARG_hess_g_pp,j,l1,l2) && nonnull(inputOutArgs.get_hess_g_pp(j,l1,l2)) ) {
2043  if ( supports(OUT_ARG_hess_g_pp,j,l1,l2) || !ignoreUnsupported )
2044  set_hess_g_pp(j,l1,l2,inputOutArgs.get_hess_g_pp(j,l1,l2));
2045  }
2046  }
2047  }
2048  }
2049 
2050  // H
2051  if( inputOutArgs.supports(OUT_ARG_H_xx) && nonnull(inputOutArgs.get_H_xx()) ) {
2052  if ( supports(OUT_ARG_H_xx) || !ignoreUnsupported )
2053  set_H_xx(inputOutArgs.get_H_xx());
2054  }
2055  for ( int l1 = 0; l1 < min_Np; ++l1 ) {
2056  if( inputOutArgs.supports(OUT_ARG_H_xp,l1) && nonnull(inputOutArgs.get_H_xp(l1)) ) {
2057  if ( supports(OUT_ARG_H_xp,l1) || !ignoreUnsupported )
2058  set_H_xp(l1,inputOutArgs.get_H_xp(l1));
2059  }
2060  for ( int l2 = 0; l2 < min_Np; ++l2 ) {
2061  if( inputOutArgs.supports(OUT_ARG_H_pp,l1,l2) && nonnull(inputOutArgs.get_H_pp(l1,l2)) ) {
2062  if ( supports(OUT_ARG_H_pp,l1,l2) || !ignoreUnsupported )
2063  set_H_pp(l1,l2,inputOutArgs.get_H_pp(l1,l2));
2064  }
2065  }
2066  }
2067 
2068 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2069 
2070  // Extended outArgs
2071  this->extended_outargs_ = inputOutArgs.extended_outargs_;
2072 
2073  // ToDo: Add more args as needed!
2074 }
2075 
2076 
2077 template<class Scalar>
2079 {
2080  typedef Teuchos::ScalarTraits<Scalar> ST;
2081  isFailed_ = true;
2082  if( this->supports(OUT_ARG_f) && nonnull(this->get_f()) ) {
2083  assign(this->get_f().ptr(),ST::nan());
2084  }
2085  for( int j = 0; j < this->Ng(); ++j ) {
2086  if (nonnull(this->get_g(j)))
2087  assign(this->get_g(j).ptr(),ST::nan());
2088  }
2089  // ToDo: Set other objects to NaN as well!
2090 }
2091 
2092 
2093 template<class Scalar>
2095 {
2096  return isFailed_;
2097 }
2098 
2099 
2100 template<class Scalar>
2102 {
2103  if (!is_null(f_))
2104  return false;
2105  if (!is_null(W_))
2106  return false;
2107  if (!is_null(W_op_))
2108  return false;
2109  for ( int l = 0; l < Np(); ++l ) {
2110  if (!DfDp_[l].isEmpty())
2111  return false;
2112  }
2113 #ifdef HAVE_THYRA_ME_POLYNOMIAL
2114  if (!is_null(f_poly_))
2115  return false;
2116 #endif // HAVE_THYRA_ME_POLYNOMIAL
2117  for ( int j = 0; j < Ng(); ++j ) {
2118  if (!is_null(g_[j]))
2119  return false;
2120  if (!DgDx_dot_[j].isEmpty())
2121  return false;
2122  if (!DgDx_[j].isEmpty())
2123  return false;
2124  for ( int l = 0; l < Np(); ++l ) {
2125  if (!DgDp_[j*Np()+l].isEmpty())
2126  return false;
2127  }
2128  }
2129  return true;
2130 }
2131 
2132 
2133 template<class Scalar>
2135  const OutArgs<Scalar> &outArgs
2136  ) const
2137 {
2138 
2139  for ( int outArg_i = 0; outArg_i < NUM_E_OUT_ARGS_MEMBERS; ++outArg_i ) {
2140  const EOutArgsMembers outArg_arg = static_cast<EOutArgsMembers>(outArg_i);
2141  const std::string outArg_name = toString(outArg_arg);
2143  supports(outArg_arg) != outArgs.supports(outArg_arg), std::logic_error,
2144  "Error, the output argument "<<outArg_name<<" with support "<<outArgs.supports(outArg_arg)<<"\n"
2145  "in the OutArgs object for the model:\n\n"
2146  " "<<outArgs.modelEvalDescription()<<"\n\n"
2147  "is not the same the argument "<<outArg_name<<" with support "<<supports(outArg_arg)<<"\n"
2148  "in the OutArgs object for the model:\n\n"
2149  " "<<modelEvalDescription()<<"\n\n"
2150  "and these two OutArgs objects are not compatible!"
2151  );
2152  }
2153 
2154  const int l_Np = this->Np();
2155  const int l_Ng = this->Ng();
2156  TEUCHOS_ASSERT_EQUALITY( l_Np, outArgs.Np() );
2157  TEUCHOS_ASSERT_EQUALITY( l_Ng, outArgs.Ng() );
2158 
2159  if (supports(OUT_ARG_f)) {
2160  for ( int l = 0; l < l_Np; ++l ) {
2162  !supports(OUT_ARG_DfDp,l).isSameSupport(outArgs.supports(OUT_ARG_DfDp,l)),
2163  std::logic_error,
2164  "Error, the support for DfDp("<<l<<") is not the same for the models\n\n"
2165  " "<<outArgs.modelEvalDescription()<<"\n\n"
2166  "and:\n\n"
2167  " "<<modelEvalDescription()<<"\n\n"
2168  "and these two OutArgs objects are not compatible!"
2169  );
2170  }
2171  }
2172 
2173  for ( int j = 0; j < l_Ng; ++j ) {
2175  !supports(OUT_ARG_DgDx_dot,j).isSameSupport(outArgs.supports(OUT_ARG_DgDx_dot,j)),
2176  std::logic_error,
2177  "Error, the support for DgDx_dot("<<j<<") is not the same for the models\n\n"
2178  " "<<outArgs.modelEvalDescription()<<"\n\n"
2179  "and:\n\n"
2180  " "<<modelEvalDescription()<<"\n\n"
2181  "and these two OutArgs objects are not compatible!"
2182  );
2184  !supports(OUT_ARG_DgDx,j).isSameSupport(outArgs.supports(OUT_ARG_DgDx,j)),
2185  std::logic_error,
2186  "Error, the support for DgDx("<<j<<") is not the same for the models\n\n"
2187  " "<<outArgs.modelEvalDescription()<<"\n\n"
2188  "and:\n\n"
2189  " "<<modelEvalDescription()<<"\n\n"
2190  "and these two OutArgs objects are not compatible!"
2191  );
2192  for ( int l = 0; l < l_Np; ++l ) {
2194  !supports(OUT_ARG_DgDp,j,l).isSameSupport(outArgs.supports(OUT_ARG_DgDp,j,l)),
2195  std::logic_error,
2196  "Error, the support for DgDp("<<j<<","<<l<<") is not the same for the models\n\n"
2197  " "<<outArgs.modelEvalDescription()<<"\n\n"
2198  "and:\n\n"
2199  " "<<modelEvalDescription()<<"\n\n"
2200  "and these two OutArgs objects are not compatible!"
2201  );
2202  }
2203  }
2204 }
2205 
2206 
2207 template<class Scalar>
2209 {
2210  return modelEvalDescription_;
2211 }
2212 
2213 
2214 template<class Scalar>
2216 {
2217  typedef Teuchos::ScalarTraits<Scalar> ST;
2218  std::ostringstream oss;
2219  oss
2220  << "Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<">"
2221  << "{"
2222  << "model="<<modelEvalDescription_
2223  << ",Np="<<Np()
2224  << ",Ng="<<Ng()
2225  << "}";
2226  return oss.str();
2227 }
2228 
2229 
2230 template<class Scalar>
2232  Teuchos::FancyOStream &out_arg, const Teuchos::EVerbosityLevel verbLevel
2233  ) const
2234 {
2235 
2236  using Teuchos::OSTab;
2237  using Teuchos::describe;
2238  typedef Teuchos::ScalarTraits<Scalar> ST;
2239  typedef RCP<const VectorBase<Scalar> > CV_ptr;
2240  typedef RCP<const LinearOpBase<Scalar> > CLO_ptr;
2241  typedef RCP<const LinearOpWithSolveBase<Scalar> > CLOWS_ptr;
2242  typedef ModelEvaluatorBase MEB;
2243  typedef MEB::Derivative<Scalar> Deriv;
2244 
2245  if( verbLevel == Teuchos::VERB_NONE && verbLevel == Teuchos::VERB_DEFAULT )
2246  return;
2247 
2249  out = Teuchos::rcp(&out_arg,false);
2250  OSTab tab(out);
2251 
2252  *out <<"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<">:\n";
2253  tab.incrTab();
2254 
2255  *out <<"model = " << modelEvalDescription_ << "\n";
2256  *out <<"Np = " << Np() << "\n";
2257  *out <<"Ng = " << Ng() << "\n";
2258 
2259  CV_ptr f;
2260  if (this->supports(OUT_ARG_f) && !is_null(f=get_f()) ) {
2261  *out << "f = " << Teuchos::describe(*f,verbLevel);
2262  }
2263 
2264  for( int j = 0; j < Ng(); ++j ) {
2265  CV_ptr g_j;
2266  if (!is_null(g_j=this->get_g(j)))
2267  *out << "g("<<j<<") = " << Teuchos::describe(*g_j,verbLevel);
2268  }
2269 
2270  CLOWS_ptr W;
2271  if ( this->supports(OUT_ARG_W) && !is_null(W=get_W()) ) {
2272  *out << "W = " << Teuchos::describe(*W,verbLevel);
2273  }
2274 
2275  CLO_ptr W_op;
2276  if ( this->supports(OUT_ARG_W_op) && !is_null(W_op=get_W_op()) ) {
2277  *out << "W_op = " << Teuchos::describe(*W_op,verbLevel);
2278  }
2279 
2280  for( int l = 0; l < Np(); ++l ) {
2281  Deriv DfDp_l;
2282  if (
2283  !this->supports(OUT_ARG_DfDp,l).none()
2284  && !(DfDp_l=get_DfDp(l)).isEmpty()
2285  )
2286  {
2287  *out << "DfDp("<<l<<") = ";
2288  DfDp_l.describe(*out,verbLevel);
2289  }
2290  }
2291 
2292  for( int j = 0; j < Ng(); ++j ) {
2293 
2294  Deriv DgDx_dot_j;
2295  if (
2296  !this->supports(OUT_ARG_DgDx_dot,j).none()
2297  && !(DgDx_dot_j=get_DgDx_dot(j)).isEmpty()
2298  )
2299  {
2300  *out << "DgDx_dot("<<j<<") = ";
2301  DgDx_dot_j.describe(*out,verbLevel);
2302  }
2303 
2304  Deriv DgDx_j;
2305  if (
2306  !this->supports(OUT_ARG_DgDx,j).none()
2307  && !(DgDx_j=get_DgDx(j)).isEmpty()
2308  )
2309  {
2310  *out << "DgDx("<<j<<") = ";
2311  DgDx_j.describe(*out,verbLevel);
2312  }
2313 
2314  for( int l = 0; l < Np(); ++l ) {
2315 
2316  Deriv DgDp_j_l;
2317  if (
2318  !this->supports(OUT_ARG_DgDp,j,l).none()
2319  && !(DgDp_j_l=get_DgDp(j,l)).isEmpty()
2320  )
2321  {
2322  *out << "DgDp("<<j<<","<<l<<") = ";
2323  DgDp_j_l.describe(*out,verbLevel);
2324  }
2325  }
2326 
2327  }
2328 
2329  // ToDo: Add output for more objects?
2330 
2331 }
2332 
2333 
2334 // protected
2335 
2336 
2337 template<class Scalar>
2339  const std::string &modelEvalDescription_in
2340  )
2341 {
2342  modelEvalDescription_ = modelEvalDescription_in;
2343 }
2344 
2345 template<class Scalar>
2347 {
2348  if(Np_in) {
2349  supports_DfDp_.resize(Np_in);
2350  DfDp_.resize(Np_in); std::fill_n(DfDp_.begin(),Np_in,Derivative<Scalar>());
2351  DfDp_properties_.resize(Np_in); std::fill_n(DfDp_properties_.begin(),Np_in,DerivativeProperties());
2352 
2353  supports_DfDp_mp_.resize(Np_in);
2354  DfDp_mp_.resize(Np_in); std::fill_n(DfDp_mp_.begin(),Np_in,MPDerivative());
2355  DfDp_mp_properties_.resize(Np_in); std::fill_n(DfDp_mp_properties_.begin(),Np_in,DerivativeProperties());
2356  }
2357  if(Ng_in) {
2358  g_.resize(Ng_in); std::fill_n(g_.begin(),Ng_in,Teuchos::null);
2359  supports_DgDx_dot_.resize(Ng_in);
2360  DgDx_dot_.resize(Ng_in); std::fill_n(DgDx_dot_.begin(),Ng_in,Derivative<Scalar>());
2361  DgDx_dot_properties_.resize(Ng_in); std::fill_n(DgDx_dot_properties_.begin(),Ng_in,DerivativeProperties());
2362  supports_DgDx_.resize(Ng_in);
2363  DgDx_.resize(Ng_in); std::fill_n(DgDx_.begin(),Ng_in,Derivative<Scalar>());
2364  DgDx_properties_.resize(Ng_in); std::fill_n(DgDx_properties_.begin(),Ng_in,DerivativeProperties());
2365 
2366 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2367  supports_hess_vec_prod_g_xx_.resize(Ng_in);
2368  hess_vec_prod_g_xx_.resize(Ng_in); std::fill_n(hess_vec_prod_g_xx_.begin(),Ng_in,RCP<MultiVectorBase<Scalar> >());
2369 
2370  supports_hess_g_xx_.resize(Ng_in);
2371  hess_g_xx_.resize(Ng_in); std::fill_n(hess_g_xx_.begin(),Ng_in,RCP<LinearOpBase<Scalar> >());
2372 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2373 
2374  g_mp_.resize(Ng_in); std::fill_n(g_mp_.begin(),Ng_in,Teuchos::null);
2375  supports_g_mp_.resize(Ng_in);
2376  supports_DgDx_dot_mp_.resize(Ng_in);
2377  DgDx_dot_mp_.resize(Ng_in); std::fill_n(DgDx_dot_mp_.begin(),Ng_in,MPDerivative());
2378  DgDx_dot_mp_properties_.resize(Ng_in); std::fill_n(DgDx_dot_mp_properties_.begin(),Ng_in,DerivativeProperties());
2379  supports_DgDx_mp_.resize(Ng_in);
2380  DgDx_mp_.resize(Ng_in); std::fill_n(DgDx_mp_.begin(),Ng_in,MPDerivative());
2381  DgDx_mp_properties_.resize(Ng_in); std::fill_n(DgDx_mp_properties_.begin(),Ng_in,DerivativeProperties());
2382  }
2383 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2384  if(Np_in) {
2385  const int Np = Np_in;
2386  const int NpNp = Np_in*Np_in;
2387 
2388  supports_hess_vec_prod_f_xp_.resize(Np);
2389  hess_vec_prod_f_xp_.resize(Np); std::fill_n(hess_vec_prod_f_xp_.begin(),Np,RCP<MultiVectorBase<Scalar> >());
2390 
2391  supports_hess_vec_prod_f_px_.resize(Np);
2392  hess_vec_prod_f_px_.resize(Np); std::fill_n(hess_vec_prod_f_px_.begin(),Np,RCP<MultiVectorBase<Scalar> >());
2393 
2394  supports_hess_vec_prod_f_pp_.resize(NpNp);
2395  hess_vec_prod_f_pp_.resize(NpNp); std::fill_n(hess_vec_prod_f_pp_.begin(),NpNp,RCP<MultiVectorBase<Scalar> >());
2396 
2397  supports_hess_f_xp_.resize(Np);
2398  hess_f_xp_.resize(Np); std::fill_n(hess_f_xp_.begin(),Np,RCP<LinearOpBase<Scalar> >());
2399 
2400  supports_hess_f_pp_.resize(NpNp);
2401  hess_f_pp_.resize(NpNp); std::fill_n(hess_f_pp_.begin(),NpNp,RCP<LinearOpBase<Scalar> >());
2402 
2403  supports_H_xp_.resize(Np);
2404  H_xp_.resize(Np); std::fill_n(H_xp_.begin(),Np,RCP<LinearOpBase<Scalar> >());
2405 
2406  supports_H_pp_.resize(NpNp);
2407  H_pp_.resize(NpNp); std::fill_n(H_pp_.begin(),NpNp,RCP<LinearOpBase<Scalar> >());
2408  }
2409 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2410  if(Np_in && Ng_in) {
2411  const int NpNg = Np_in*Ng_in;
2412  const int NpNpNg = Np_in*Np_in*Ng_in;
2413  supports_DgDp_.resize(NpNg);
2414  DgDp_.resize(NpNg); std::fill_n(DgDp_.begin(),NpNg,Derivative<Scalar>());
2415  DgDp_properties_.resize(NpNg); std::fill_n(DgDp_properties_.begin(),NpNg,DerivativeProperties());
2416 
2417 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2418  supports_hess_vec_prod_g_xp_.resize(NpNg);
2419  hess_vec_prod_g_xp_.resize(NpNg); std::fill_n(hess_vec_prod_g_xp_.begin(),NpNg,RCP<MultiVectorBase<Scalar> >());
2420 
2421  supports_hess_vec_prod_g_px_.resize(NpNg);
2422  hess_vec_prod_g_px_.resize(NpNg); std::fill_n(hess_vec_prod_g_px_.begin(),NpNg,RCP<MultiVectorBase<Scalar> >());
2423 
2424  supports_hess_vec_prod_g_pp_.resize(NpNpNg);
2425  hess_vec_prod_g_pp_.resize(NpNpNg); std::fill_n(hess_vec_prod_g_pp_.begin(),NpNpNg,RCP<MultiVectorBase<Scalar> >());
2426 
2427  supports_hess_g_xp_.resize(NpNg);
2428  hess_g_xp_.resize(NpNg); std::fill_n(hess_g_xp_.begin(),NpNg,RCP<LinearOpBase<Scalar> >());
2429 
2430  supports_hess_g_pp_.resize(NpNpNg);
2431  hess_g_pp_.resize(NpNpNg); std::fill_n(hess_g_pp_.begin(),NpNpNg,RCP<LinearOpBase<Scalar> >());
2432 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2433 
2434  supports_DgDp_mp_.resize(NpNg);
2435  DgDp_mp_.resize(NpNg); std::fill_n(DgDp_mp_.begin(),NpNg,MPDerivative());
2436  DgDp_mp_properties_.resize(NpNg); std::fill_n(DgDp_mp_properties_.begin(),NpNg,DerivativeProperties());
2437  }
2438 }
2439 
2440 
2441 template<class Scalar>
2443  EOutArgsMembers arg, bool supports_in )
2444 {
2446  int(arg)>=NUM_E_OUT_ARGS_MEMBERS || int(arg) < 0,std::logic_error
2447  ,"model = \'"<<modelEvalDescription_
2448  <<"\': Error, arg="<<toString(arg)<<" is invalid!"
2449  );
2450  supports_[arg] = supports_in;
2451 }
2452 
2453 
2454 template<class Scalar>
2456  EOutArgsDfDp /* arg */, int l, const DerivativeSupport& supports_in
2457  )
2458 {
2459  assert_supports(OUT_ARG_f);
2460  assert_l(l);
2461  supports_DfDp_[l] = supports_in;
2462 }
2463 
2464 
2465 template<class Scalar>
2467  EOutArgsDgDx_dot /* arg */, int j, const DerivativeSupport& supports_in
2468  )
2469 {
2470  assert_j(j);
2471  supports_DgDx_dot_[j] = supports_in;
2472 }
2473 
2474 
2475 template<class Scalar>
2477  EOutArgsDgDx /* arg */, int j, const DerivativeSupport& supports_in
2478  )
2479 {
2480  assert_j(j);
2481  supports_DgDx_[j] = supports_in;
2482 }
2483 
2484 
2485 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2486 
2487 template<class Scalar>
2489  EOutArgs_hess_vec_prod_f_xx /* arg */, bool supports_in
2490  )
2491 {
2492  supports_hess_vec_prod_f_xx_ = supports_in;
2493 }
2494 
2495 template<class Scalar>
2497  EOutArgs_hess_vec_prod_f_xp /* arg */, int l, bool supports_in
2498  )
2499 {
2500  assert_l(l);
2501  supports_hess_vec_prod_f_xp_[l] = supports_in;
2502 }
2503 
2504 template<class Scalar>
2506  EOutArgs_hess_vec_prod_f_px /* arg */, int l, bool supports_in
2507  )
2508 {
2509  assert_l(l);
2510  supports_hess_vec_prod_f_px_[l] = supports_in;
2511 }
2512 
2513 template<class Scalar>
2515  EOutArgs_hess_vec_prod_f_pp /* arg */, int l1, int l2, bool supports_in
2516  )
2517 {
2518  assert_l(l1);
2519  assert_l(l2);
2520  supports_hess_vec_prod_f_pp_[ l1*Np()+ l2 ] = supports_in;
2521 }
2522 
2523 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2524 
2525 
2526 template<class Scalar>
2528  EOutArgsDgDp /* arg */, int j, int l, const DerivativeSupport& supports_in
2529  )
2530 {
2531  assert_j(j);
2532  assert_l(l);
2533  supports_DgDp_[ j*Np()+ l ] = supports_in;
2534 }
2535 
2536 
2537 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2538 
2539 template<class Scalar>
2541  EOutArgs_hess_vec_prod_g_xx /* arg */, int j, bool supports_in
2542  )
2543 {
2544  assert_j(j);
2545  supports_hess_vec_prod_g_xx_[j] = supports_in;
2546 }
2547 
2548 template<class Scalar>
2550  EOutArgs_hess_vec_prod_g_xp /* arg */, int j, int l, bool supports_in
2551  )
2552 {
2553  assert_j(j);
2554  assert_l(l);
2555  supports_hess_vec_prod_g_xp_[ j*Np()+ l ] = supports_in;
2556 }
2557 
2558 template<class Scalar>
2560  EOutArgs_hess_vec_prod_g_px /* arg */, int j, int l, bool supports_in
2561  )
2562 {
2563  assert_j(j);
2564  assert_l(l);
2565  supports_hess_vec_prod_g_px_[ j*Np()+ l ] = supports_in;
2566 }
2567 
2568 template<class Scalar>
2570  EOutArgs_hess_vec_prod_g_pp /* arg */, int j, int l1, int l2, bool supports_in
2571  )
2572 {
2573  assert_j(j);
2574  assert_l(l1);
2575  assert_l(l2);
2576  supports_hess_vec_prod_g_pp_[ j*Np()*Np()+ l1*Np() + l2 ] = supports_in;
2577 }
2578 
2579 
2580 template<class Scalar>
2582  EOutArgs_hess_f_xx /* arg */, bool supports_in
2583  )
2584 {
2585  supports_hess_f_xx_ = supports_in;
2586 }
2587 
2588 template<class Scalar>
2590  EOutArgs_hess_f_xp /* arg */, int l, bool supports_in
2591  )
2592 {
2593  assert_l(l);
2594  supports_hess_f_xp_[l] = supports_in;
2595 }
2596 
2597 template<class Scalar>
2599  EOutArgs_hess_f_pp /* arg */, int l1, int l2, bool supports_in
2600  )
2601 {
2602  assert_l(l1);
2603  assert_l(l2);
2604  supports_hess_f_pp_[ l1*Np()+ l2 ] = supports_in;
2605 }
2606 
2607 template<class Scalar>
2609  EOutArgs_hess_g_xx /* arg */, int j, bool supports_in
2610  )
2611 {
2612  assert_j(j);
2613  supports_hess_g_xx_[j] = supports_in;
2614 }
2615 
2616 template<class Scalar>
2618  EOutArgs_hess_g_xp /* arg */, int j, int l, bool supports_in
2619  )
2620 {
2621  assert_j(j);
2622  assert_l(l);
2623  supports_hess_g_xp_[ j*Np()+ l ] = supports_in;
2624 }
2625 
2626 template<class Scalar>
2628  EOutArgs_hess_g_pp /* arg */, int j, int l1, int l2, bool supports_in
2629  )
2630 {
2631  assert_j(j);
2632  assert_l(l1);
2633  assert_l(l2);
2634  supports_hess_g_pp_[ j*Np()*Np()+ l1*Np() + l2 ] = supports_in;
2635 }
2636 
2637 template<class Scalar>
2639  EOutArgs_H_xx /* arg */, bool supports_in
2640  )
2641 {
2642  supports_H_xx_ = supports_in;
2643 }
2644 
2645 template<class Scalar>
2647  EOutArgs_H_xp /* arg */, int l, bool supports_in
2648  )
2649 {
2650  assert_l(l);
2651  supports_H_xp_[l] = supports_in;
2652 }
2653 
2654 template<class Scalar>
2656  EOutArgs_H_pp /* arg */, int l1, int l2, bool supports_in
2657  )
2658 {
2659  assert_l(l1);
2660  assert_l(l2);
2661  supports_H_pp_[ l1*Np()+ l2 ] = supports_in;
2662 }
2663 
2664 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2665 
2666 
2667 template<class Scalar>
2669  EOutArgs_g_mp /* arg */, int j, bool supports_in
2670  )
2671 {
2672  //assert_supports(OUT_ARG_g_mp,j);
2673  assert_j(j);
2674  supports_g_mp_[j] = supports_in;
2675 }
2676 
2677 
2678 template<class Scalar>
2680  EOutArgsDfDp_mp /* arg */, int l, const DerivativeSupport& supports_in
2681  )
2682 {
2683  assert_supports(OUT_ARG_f_mp); //JF this is not in epetraext ME
2684  assert_l(l);
2685  supports_DfDp_mp_[l] = supports_in;
2686 }
2687 
2688 
2689 template<class Scalar>
2691  EOutArgsDgDx_dot_mp /* arg */, int j, const DerivativeSupport& supports_in
2692  )
2693 {
2694  assert_j(j);
2695  supports_DgDx_dot_mp_[j] = supports_in;
2696 }
2697 
2698 
2699 template<class Scalar>
2701  EOutArgsDgDx_mp /* arg */, int j, const DerivativeSupport& supports_in
2702  )
2703 {
2704  assert_j(j);
2705  supports_DgDx_mp_[j] = supports_in;
2706 }
2707 
2708 
2709 template<class Scalar>
2711  EOutArgsDgDp_mp /* arg */, int j, int l, const DerivativeSupport& supports_in
2712  )
2713 {
2714  assert_j(j);
2715  assert_l(l);
2716  supports_DgDp_mp_[ j*Np()+ l ] = supports_in;
2717 }
2718 
2719 
2720 template<class Scalar>
2722  const DerivativeProperties &properties
2723  )
2724 {
2725  W_properties_ = properties;
2726 }
2727 
2728 
2729 template<class Scalar>
2731  int l, const DerivativeProperties &properties
2732  )
2733 {
2734  assert_supports(OUT_ARG_DfDp,l);
2735  DfDp_properties_[l] = properties;
2736 }
2737 
2738 
2739 template<class Scalar>
2741  int j, const DerivativeProperties &properties
2742  )
2743 {
2744  assert_supports(OUT_ARG_DgDx_dot,j);
2745  DgDx_dot_properties_[j] = properties;
2746 }
2747 
2748 
2749 template<class Scalar>
2751  int j, const DerivativeProperties &properties
2752  )
2753 {
2754  assert_supports(OUT_ARG_DgDx,j);
2755  DgDx_properties_[j] = properties;
2756 }
2757 
2758 
2759 template<class Scalar>
2761  int j, int l, const DerivativeProperties &properties
2762  )
2763 {
2764  assert_supports(OUT_ARG_DgDp,j,l);
2765  DgDp_properties_[ j*Np()+ l ] = properties;
2766 }
2767 
2768 
2769 template<class Scalar>
2771  int l, const DerivativeProperties &properties
2772  )
2773 {
2774  assert_supports(OUT_ARG_DfDp_mp,l);
2775  DfDp_mp_properties_[l] = properties;
2776 }
2777 
2778 
2779 template<class Scalar>
2781  int j, const DerivativeProperties &properties
2782  )
2783 {
2784  assert_supports(OUT_ARG_DgDx_dot_mp,j);
2785  DgDx_dot_mp_properties_[j] = properties;
2786 }
2787 
2788 
2789 template<class Scalar>
2790 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_mp_properties(
2791  int j, const DerivativeProperties &properties
2792  )
2793 {
2794  assert_supports(OUT_ARG_DgDx_mp,j);
2795  DgDx_mp_properties_[j] = properties;
2796 }
2797 
2798 
2799 template<class Scalar>
2800 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDp_mp_properties(
2801  int j, int l, const DerivativeProperties &properties
2802  )
2803 {
2804  assert_supports(OUT_ARG_DgDp_mp,j,l);
2805  DgDp_mp_properties_[ j*Np()+ l ] = properties;
2806 }
2807 
2808 
2809 template<class Scalar>
2811  const OutArgs<Scalar>& inputOutArgs
2812  )
2813 {
2814  typedef ModelEvaluatorBase MEB;
2815  const int l_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.Np());
2816  const int l_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.Ng());
2817  std::copy(
2818  &inputOutArgs.supports_[0],
2819  &inputOutArgs.supports_[0] + NUM_E_OUT_ARGS_MEMBERS, &supports_[0] );
2820  for( int l = 0; l < l_Np; ++l ) {
2821  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DfDp,l);
2822  if (!ds.none()) {
2823  this->_setSupports(MEB::OUT_ARG_DfDp,l,ds);
2824  this->_set_DfDp_properties(l,inputOutArgs.get_DfDp_properties(l));
2825  }
2826  }
2827  for( int l = 0; l < l_Np; ++l ) {
2828  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DfDp_mp,l);
2829  if (!ds.none()) {
2830  this->_setSupports(MEB::OUT_ARG_DfDp_mp,l,ds);
2831  this->_set_DfDp_mp_properties(l,inputOutArgs.get_DfDp_mp_properties(l));
2832  }
2833  }
2834  for( int j = 0; j < l_Ng; ++j ) {
2835  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_dot,j);
2836  this->_setSupports(MEB::OUT_ARG_DgDx_dot,j,ds);
2837  if(!ds.none()) this->_set_DgDx_dot_properties(j,inputOutArgs.get_DgDx_dot_properties(j));
2838  }
2839  for( int j = 0; j < l_Ng; ++j ) {
2840  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_dot_mp,j);
2841  this->_setSupports(MEB::OUT_ARG_DgDx_dot_mp,j,ds);
2842  if(!ds.none()) this->_set_DgDx_dot_mp_properties(j,inputOutArgs.get_DgDx_dot_mp_properties(j));
2843  }
2844  for( int j = 0; j < l_Ng; ++j ) {
2845  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx,j);
2846  this->_setSupports(MEB::OUT_ARG_DgDx,j,ds);
2847  if(!ds.none()) this->_set_DgDx_properties(j,inputOutArgs.get_DgDx_properties(j));
2848  }
2849  for( int j = 0; j < l_Ng; ++j ) {
2850  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_mp,j);
2851  this->_setSupports(MEB::OUT_ARG_DgDx_mp,j,ds);
2852  if(!ds.none()) this->_set_DgDx_mp_properties(j,inputOutArgs.get_DgDx_mp_properties(j));
2853  }
2854  for( int j = 0; j < l_Ng; ++j ) for( int l = 0; l < l_Np; ++l ) {
2855  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDp,j,l);
2856  this->_setSupports(MEB::OUT_ARG_DgDp,j,l,ds);
2857  if(!ds.none()) this->_set_DgDp_properties(j,l,inputOutArgs.get_DgDp_properties(j,l));
2858  }
2859  for( int j = 0; j < l_Ng; ++j ) for( int l = 0; l < l_Np; ++l ) {
2860  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDp_mp,j,l);
2861  this->_setSupports(MEB::OUT_ARG_DgDp_mp,j,l,ds);
2862  if(!ds.none()) this->_set_DgDp_mp_properties(j,l,inputOutArgs.get_DgDp_mp_properties(j,l));
2863  }
2864  if(this->supports(OUT_ARG_W) || this->supports(OUT_ARG_W_op))
2865  this->_set_W_properties(inputOutArgs.get_W_properties());
2866  if(this->supports(OUT_ARG_W_mp))
2867  this->_set_W_properties(inputOutArgs.get_W_properties()); //JF should this be W_mp_properties?
2868 
2869 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2870  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xx,inputOutArgs.supports(OUT_ARG_hess_vec_prod_f_xx));
2871  for( int l1 = 0; l1 < l_Np; ++l1 ) {
2872  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1));
2873  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_px,l1,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_f_px,l1));
2874  for( int l2 = 0; l2 < l_Np; ++l2 ) {
2875  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2));
2876  }
2877  }
2878  for( int j = 0; j < l_Ng; ++j ) {
2879  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xx,j,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_g_xx,j));
2880  for( int l1 = 0; l1 < l_Np; ++l1 ) {
2881  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1));
2882  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1));
2883  for( int l2 = 0; l2 < l_Np; ++l2 ) {
2884  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2,inputOutArgs.supports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2));
2885  }
2886  }
2887  }
2888  this->_setSupports(MEB::OUT_ARG_hess_f_xx,inputOutArgs.supports(OUT_ARG_hess_f_xx));
2889  for( int l1 = 0; l1 < l_Np; ++l1 ) {
2890  this->_setSupports(MEB::OUT_ARG_hess_f_xp,l1,inputOutArgs.supports(MEB::OUT_ARG_hess_f_xp,l1));
2891  for( int l2 = 0; l2 < l_Np; ++l2 ) {
2892  this->_setSupports(MEB::OUT_ARG_hess_f_pp,l1,l2,inputOutArgs.supports(MEB::OUT_ARG_hess_f_pp,l1,l2));
2893  }
2894  }
2895  for( int j = 0; j < l_Ng; ++j ) {
2896  this->_setSupports(MEB::OUT_ARG_hess_g_xx,j,inputOutArgs.supports(MEB::OUT_ARG_hess_g_xx,j));
2897  for( int l1 = 0; l1 < l_Np; ++l1 ) {
2898  this->_setSupports(MEB::OUT_ARG_hess_g_xp,j,l1,inputOutArgs.supports(MEB::OUT_ARG_hess_g_xp,j,l1));
2899  for( int l2 = 0; l2 < l_Np; ++l2 ) {
2900  this->_setSupports(MEB::OUT_ARG_hess_g_pp,j,l1,l2,inputOutArgs.supports(MEB::OUT_ARG_hess_g_pp,j,l1,l2));
2901  }
2902  }
2903  }
2904  this->_setSupports(MEB::OUT_ARG_H_xx,inputOutArgs.supports(OUT_ARG_H_xx));
2905  for( int l1 = 0; l1 < l_Np; ++l1 ) {
2906  this->_setSupports(MEB::OUT_ARG_H_xp,l1,inputOutArgs.supports(MEB::OUT_ARG_H_xp,l1));
2907  for( int l2 = 0; l2 < l_Np; ++l2 ) {
2908  this->_setSupports(MEB::OUT_ARG_H_pp,l1,l2,inputOutArgs.supports(MEB::OUT_ARG_H_pp,l1,l2));
2909  }
2910  }
2911 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
2912 
2913  extended_outargs_ = inputOutArgs.extended_outargs_;
2914 }
2915 
2916 
2917 template<class Scalar>
2919  EInArgsMembers arg
2920  )
2921 {
2922  switch(arg) {
2923  case IN_ARG_x: {
2924  const int l_Ng = this->Ng();
2925  for( int j = 0; j < l_Ng; ++j ) {
2926  this->_setSupports(OUT_ARG_DgDx_dot,j,DerivativeSupport());
2927  this->_setSupports(OUT_ARG_DgDx,j,DerivativeSupport());
2928  }
2929  break;
2930  }
2931  case IN_ARG_x_mp: {
2932  const int l_Ng = this->Ng();
2933  for( int j = 0; j < l_Ng; ++j ) {
2934  this->_setSupports(OUT_ARG_DgDx_dot_mp,j,DerivativeSupport());
2935  this->_setSupports(OUT_ARG_DgDx_mp,j,DerivativeSupport());
2936  }
2937  break;
2938  }
2939  default:
2941  true ,std::logic_error,
2942  "Error, can not handle args other than IN_ARG_x yet!"
2943  );
2944  }
2945 }
2946 
2947 
2948 template<class Scalar>
2950  EOutArgsMembers arg
2951  )
2952 {
2953  switch(arg) {
2954  case OUT_ARG_f: {
2955  this->_setSupports(OUT_ARG_W,false);
2956  this->_setSupports(OUT_ARG_W_op,false);
2957  this->_setSupports(OUT_ARG_f_poly,false);
2958  const int l_Np = this->Np();
2959  for( int l = 0; l < l_Np; ++l )
2960  this->_setSupports(OUT_ARG_DfDp,l,DerivativeSupport());
2961  break;
2962  }
2963  case OUT_ARG_f_mp: {
2964  this->_setSupports(OUT_ARG_W_mp,false);
2965  this->_setSupports(OUT_ARG_W_op,false);
2966  this->_setSupports(OUT_ARG_f_poly,false);
2967  const int l_Np = this->Np();
2968  for( int l = 0; l < l_Np; ++l )
2969  this->_setSupports(OUT_ARG_DfDp_mp,l,DerivativeSupport());
2970  break;
2971  }
2972  default:
2974  true ,std::logic_error,
2975  "Error, can not handle args other than OUT_ARG_f yet!"
2976  );
2977  }
2978  this->_setSupports(arg,false);
2979 }
2980 
2981 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
2982 template<class Scalar>
2984  const bool supports
2985  )
2986 {
2987  typedef ModelEvaluatorBase MEB;
2988  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xx,supports);
2989  this->_setSupports(MEB::OUT_ARG_hess_f_xx,supports);
2990  this->_setSupports(MEB::OUT_ARG_H_xx,supports);
2991  for (int l1=0; l1<this->Np(); ++l1)
2992  {
2993  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_xp,l1,supports);
2994  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_px,l1,supports);
2995  this->_setSupports(MEB::OUT_ARG_hess_f_xp,l1,supports);
2996  this->_setSupports(MEB::OUT_ARG_H_xp,l1,supports);
2997  for (int l2=0; l2<this->Np(); ++l2)
2998  {
2999  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_f_pp,l1,l2,supports);
3000  this->_setSupports(MEB::OUT_ARG_hess_f_pp,l1,l2,supports);
3001  this->_setSupports(MEB::OUT_ARG_H_pp,l1,l2,supports);
3002  }
3003  }
3004 
3005  for (int j=0; j<this->Ng(); ++j)
3006  {
3007  this->_setSupports(MEB::OUT_ARG_hess_g_xx,j,supports);
3008  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xx,j,supports);
3009  for (int l1=0; l1<this->Np(); ++l1)
3010  {
3011  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_xp,j,l1,supports);
3012  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_px,j,l1,supports);
3013  this->_setSupports(MEB::OUT_ARG_hess_g_xp,j,l1,supports);
3014  for (int l2=0; l2<this->Np(); ++l2)
3015  {
3016  this->_setSupports(MEB::OUT_ARG_hess_vec_prod_g_pp,j,l1,l2,supports);
3017  this->_setSupports(MEB::OUT_ARG_hess_g_pp,j,l1,l2,supports);
3018  }
3019  }
3020  }
3021 }
3022 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3023 
3024 // private
3025 
3026 
3027 template<class Scalar>
3028 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(EOutArgsMembers arg) const
3029 {
3031  !this->supports(arg), std::logic_error
3032  ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(arg):\n\n"
3033  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3034  "Error, The argument arg = " << toString(arg) << " is not supported!"
3035  );
3036 }
3037 
3038 
3039 template<class Scalar>
3040 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3041  EOutArgsDfDp arg, int l, const Derivative<Scalar> &deriv
3042  ) const
3043 {
3044  const DerivativeSupport derivSupport = this->supports(arg,l);
3046  !deriv.isSupportedBy(derivSupport), std::logic_error,
3047  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp,l):\n\n"
3048  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3049  "Error, The argument DfDp("<<l<<") = " << deriv.description() << "\n"
3050  "is not supported!\n\n"
3051  "The supported types include " << derivSupport.description() << "!"
3052  );
3053 }
3054 
3055 
3056 template<class Scalar>
3057 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3058  EOutArgsDgDx_dot arg, int j, const Derivative<Scalar> &deriv
3059  ) const
3060 {
3061  const DerivativeSupport derivSupport = this->supports(arg,j);
3063  !deriv.isSupportedBy(derivSupport), std::logic_error,
3064  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot,j):\n\n"
3065  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3066  "Error, The argument DgDx_dot("<<j<<") = " << deriv.description() << "\n"
3067  "is not supported!\n\n"
3068  "The supported types include " << derivSupport.description() << "!"
3069  );
3070 }
3071 
3072 
3073 template<class Scalar>
3074 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3075  EOutArgsDgDx arg, int j, const Derivative<Scalar> &deriv
3076  ) const
3077 {
3078  const DerivativeSupport derivSupport = this->supports(arg,j);
3080  !deriv.isSupportedBy(derivSupport), std::logic_error,
3081  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx,j):\n\n"
3082  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3083  "Error, The argument DgDx("<<j<<") = " << deriv.description() << "\n"
3084  "is not supported!\n\n"
3085  "The supported types include " << derivSupport.description() << "!"
3086  );
3087 }
3088 
3089 
3090 template<class Scalar>
3091 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3092  EOutArgsDgDp arg, int j, int l, const Derivative<Scalar> &deriv
3093  ) const
3094 {
3095  const DerivativeSupport derivSupport = this->supports(arg,j,l);
3097  !deriv.isSupportedBy(derivSupport), std::logic_error,
3098  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp,j,l):\n\n"
3099  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3100  "Error, The argument DgDp("<<j<<","<<l<<") = " << deriv.description() << "\n"
3101  "is not supported!\n\n"
3102  "The supported types include " << derivSupport.description() << "!"
3103  );
3104 }
3105 
3106 
3107 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3108 
3109 template<class Scalar>
3110 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3111  EOutArgs_hess_vec_prod_f_xx arg
3112  ) const
3113 {
3114  const bool support = this->supports(arg);
3116  !support, std::logic_error,
3117  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_xx):\n\n"
3118  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3119  "Error, The argument hess_vec_prod_f_xx() is not supported!"
3120  );
3121 }
3122 
3123 template<class Scalar>
3124 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3125  EOutArgs_hess_vec_prod_f_xp arg, int l
3126  ) const
3127 {
3128  const bool support = this->supports(arg,l);
3130  !support, std::logic_error,
3131  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_xp,l):\n\n"
3132  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3133  "Error, The argument hess_vec_prod_f_xp("<<l<<") is not supported!"
3134  );
3135 }
3136 
3137 template<class Scalar>
3138 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3139  EOutArgs_hess_vec_prod_f_px arg, int l
3140  ) const
3141 {
3142  const bool support = this->supports(arg,l);
3144  !support, std::logic_error,
3145  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_px,l):\n\n"
3146  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3147  "Error, The argument hess_vec_prod_f_px("<<l<<") is not supported!"
3148  );
3149 }
3150 
3151 template<class Scalar>
3152 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3153  EOutArgs_hess_vec_prod_f_pp arg, int l1, int l2
3154  ) const
3155 {
3156  const bool support = this->supports(arg,l1,l2);
3158  !support, std::logic_error,
3159  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_f_pp,l1,l2):\n\n"
3160  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3161  "Error, The argument hess_vec_prod_f_pp("<<l1<<","<<l2<<") is not supported!"
3162  );
3163 }
3164 
3165 template<class Scalar>
3166 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3167  EOutArgs_hess_vec_prod_g_xx arg, int j
3168  ) const
3169 {
3170  const bool support = this->supports(arg,j);
3172  !support, std::logic_error,
3173  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_xx,j):\n\n"
3174  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3175  "Error, The argument hess_vec_prod_g_xx("<<j<<") is not supported!"
3176  );
3177 }
3178 
3179 template<class Scalar>
3180 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3181  EOutArgs_hess_vec_prod_g_xp arg, int j, int l
3182  ) const
3183 {
3184  const bool support = this->supports(arg,j,l);
3186  !support, std::logic_error,
3187  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_xp,j,l):\n\n"
3188  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3189  "Error, The argument hess_vec_prod_g_xp("<<j<<","<<l<<") is not supported!"
3190  );
3191 }
3192 
3193 template<class Scalar>
3194 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3195  EOutArgs_hess_vec_prod_g_px arg, int j, int l
3196  ) const
3197 {
3198  const bool support = this->supports(arg,j,l);
3200  !support, std::logic_error,
3201  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_px,j,l):\n\n"
3202  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3203  "Error, The argument hess_vec_prod_g_px("<<j<<","<<l<<") is not supported!"
3204  );
3205 }
3206 
3207 template<class Scalar>
3208 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3209  EOutArgs_hess_vec_prod_g_pp arg, int j, int l1, int l2
3210  ) const
3211 {
3212  const bool support = this->supports(arg,j,l1,l2);
3214  !support, std::logic_error,
3215  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_vec_prod_g_pp,j,l1,l2):\n\n"
3216  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3217  "Error, The argument hess_vec_prod_g_pp("<<j<<","<<l1<<","<<l2<<") is not supported!"
3218  );
3219 }
3220 
3221 template<class Scalar>
3222 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3223  EOutArgs_hess_f_xx arg
3224  ) const
3225 {
3226  const bool support = this->supports(arg);
3228  !support, std::logic_error,
3229  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_xx):\n\n"
3230  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3231  "Error, The argument hess_f_xx() is not supported!"
3232  );
3233 }
3234 
3235 template<class Scalar>
3236 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3237  EOutArgs_hess_f_xp arg, int l
3238  ) const
3239 {
3240  const bool support = this->supports(arg,l);
3242  !support, std::logic_error,
3243  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_xp,l):\n\n"
3244  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3245  "Error, The argument hess_f_xp() is not supported!"
3246  );
3247 }
3248 
3249 template<class Scalar>
3250 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3251  EOutArgs_hess_f_pp arg, int l1, int l2
3252  ) const
3253 {
3254  const bool support = this->supports(arg,l1,l2);
3256  !support, std::logic_error,
3257  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_f_pp,l1,l2):\n\n"
3258  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3259  "Error, The argument hess_f_pp() is not supported!"
3260  );
3261 }
3262 
3263 template<class Scalar>
3264 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3265  EOutArgs_hess_g_xx arg, int j
3266  ) const
3267 {
3268  const bool support = this->supports(arg,j);
3270  !support, std::logic_error,
3271  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_xx,j):\n\n"
3272  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3273  "Error, The argument hess_g_xx() is not supported!"
3274  );
3275 }
3276 
3277 template<class Scalar>
3278 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3279  EOutArgs_hess_g_xp arg, int j, int l
3280  ) const
3281 {
3282  const bool support = this->supports(arg,j,l);
3284  !support, std::logic_error,
3285  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_xp,j,l):\n\n"
3286  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3287  "Error, The argument hess_g_xp() is not supported!"
3288  );
3289 }
3290 
3291 template<class Scalar>
3292 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3293  EOutArgs_hess_g_pp arg, int j, int l1, int l2
3294  ) const
3295 {
3296  const bool support = this->supports(arg,j,l1,l2);
3298  !support, std::logic_error,
3299  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_hess_g_pp,j,l1,l2):\n\n"
3300  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3301  "Error, The argument hess_g_pp() is not supported!"
3302  );
3303 }
3304 
3305 template<class Scalar>
3306 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3307  EOutArgs_H_xx arg
3308  ) const
3309 {
3310  const bool support = this->supports(arg);
3312  !support, std::logic_error,
3313  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_xx):\n\n"
3314  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3315  "Error, The argument H_xx() is not supported!"
3316  );
3317 }
3318 
3319 template<class Scalar>
3320 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3321  EOutArgs_H_xp arg, int l
3322  ) const
3323 {
3324  const bool support = this->supports(arg,l);
3326  !support, std::logic_error,
3327  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_xp,l):\n\n"
3328  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3329  "Error, The argument H_xp() is not supported!"
3330  );
3331 }
3332 
3333 template<class Scalar>
3334 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3335  EOutArgs_H_pp arg, int l1, int l2
3336  ) const
3337 {
3338  const bool support = this->supports(arg,l1,l2);
3340  !support, std::logic_error,
3341  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_H_pp,l1,l2):\n\n"
3342  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3343  "Error, The argument H_pp() is not supported!"
3344  );
3345 }
3346 
3347 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3348 
3349 
3350 template<class Scalar>
3351 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3352  EOutArgs_g_mp /* arg */, int j
3353  ) const
3354 {
3355  assert_j(j);
3357  !supports_g_mp_[j], std::logic_error,
3358  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_g_mp,j):\n\n"
3359  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3360  "Error, The argument g_mp("<<j<<") \n"
3361  "is not supported!\n\n"
3362  );
3363 }
3364 
3365 
3366 template<class Scalar>
3367 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3368  EOutArgsDfDp_mp arg, int l, const MPDerivative &deriv
3369  ) const
3370 {
3371  const DerivativeSupport derivSupport = this->supports(arg,l);
3373  !deriv.isSupportedBy(derivSupport), std::logic_error,
3374  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp_mp,l):\n\n"
3375  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3376  "Error, The argument DfDp_mp("<<l<<") = " << deriv.description() << "\n"
3377  "is not supported!\n\n"
3378  "The supported types include " << derivSupport.description() << "!"
3379  );
3380 }
3381 
3382 
3383 template<class Scalar>
3384 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3385  EOutArgsDgDx_dot_mp arg, int j, const MPDerivative &deriv
3386  ) const
3387 {
3388  const DerivativeSupport derivSupport = this->supports(arg,j);
3390  !deriv.isSupportedBy(derivSupport), std::logic_error,
3391  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot_mp,j):\n\n"
3392  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3393  "Error, The argument DgDx_dot_mp("<<j<<") = " << deriv.description() << "\n"
3394  "is not supported!\n\n"
3395  "The supported types include " << derivSupport.description() << "!"
3396  );
3397 }
3398 
3399 
3400 template<class Scalar>
3401 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3402  EOutArgsDgDx_mp arg, int j, const MPDerivative &deriv
3403  ) const
3404 {
3405  const DerivativeSupport derivSupport = this->supports(arg,j);
3407  !deriv.isSupportedBy(derivSupport), std::logic_error,
3408  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_mp,j):\n\n"
3409  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3410  "Error, The argument DgDx_mp("<<j<<") = " << deriv.description() << "\n"
3411  "is not supported!\n\n"
3412  "The supported types include " << derivSupport.description() << "!"
3413  );
3414 }
3415 
3416 
3417 template<class Scalar>
3418 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
3419  EOutArgsDgDp_mp arg, int j, int l, const MPDerivative &deriv
3420  ) const
3421 {
3422  const DerivativeSupport derivSupport = this->supports(arg,j,l);
3424  !deriv.isSupportedBy(derivSupport), std::logic_error,
3425  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp_mp,j,l):\n\n"
3426  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3427  "Error, The argument DgDp_mp("<<j<<","<<l<<") = " << deriv.description() << "\n"
3428  "is not supported!\n\n"
3429  "The supported types include " << derivSupport.description() << "!"
3430  );
3431 }
3432 
3433 
3434 template<class Scalar>
3435 void ModelEvaluatorBase::OutArgs<Scalar>::assert_l(int l) const
3436 {
3438  !( 0 <= l && l < Np() ), std::logic_error
3439  ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_l(l):\n\n"
3440  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3441  "Error, The parameter subvector p("<<l<<")"
3442  " is not in the range [0,"<<Np()<<")!"
3443  );
3444 }
3445 
3446 
3447 template<class Scalar>
3448 void ModelEvaluatorBase::OutArgs<Scalar>::assert_j(int j) const
3449 {
3451  !( 0 <= j && j < Ng() ), std::logic_error
3452  ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_j(j):\n\n"
3453  "model = \'"<<modelEvalDescription_<<"\':\n\n"
3454  "Error, The auxiliary function g("<<j<<")"
3455  " is not in the range [0,"<<Ng()<<")!"
3456  );
3457 }
3458 
3459 
3460 //
3461 // ModelEvaluatorBase::InArgsSetup
3462 //
3463 
3464 
3465 template<class Scalar>
3467 {}
3468 
3469 
3470 template<class Scalar>
3472  :InArgs<Scalar>(inArgs)
3473 {}
3474 
3475 
3476 template<class Scalar>
3478  const std::string &modelEvalDescription_in )
3479 {
3480  this->_setModelEvalDescription(modelEvalDescription_in);
3481 }
3482 
3483 
3484 template<class Scalar>
3486 { this->_set_Np_Ng(Np_in, 0); }
3487 
3488 template<class Scalar>
3490 { this->_set_Np_Ng(Np_in, Ng_in); }
3491 
3492 template<class Scalar>
3494 { this->_setSupports(arg,supports_in); }
3495 
3496 
3497 template<class Scalar>
3498 void ModelEvaluatorBase::InArgsSetup<Scalar>::setSupports( EInArgs_p_mp arg, int l, bool supports_in )
3499 { this->_setSupports(arg,l,supports_in); }
3500 
3501 
3502 template<class Scalar>
3504  const InArgs<Scalar>& inArgs, const int Np_in
3505  )
3506 {
3507  this->_setSupports(inArgs, Np_in);
3508 }
3509 
3510 
3511 template<class Scalar>
3513  EInArgsMembers arg
3514  )
3515 {
3516  this->_setUnsupportsAndRelated(arg);
3517 }
3518 
3519 
3520 //
3521 // ModelEvaluatorBase::OutArgsSetup
3522 //
3523 
3524 
3525 template<class Scalar>
3527 {}
3528 
3529 
3530 template<class Scalar>
3532  const OutArgs<Scalar>& inputOutArgs
3533  )
3534  :OutArgs<Scalar>(inputOutArgs)
3535 {}
3536 
3537 
3538 template<class Scalar>
3540  const std::string &modelEvalDescription_in
3541  )
3542 { this->_setModelEvalDescription(modelEvalDescription_in); }
3543 
3544 
3545 template<class Scalar>
3547 { this->_set_Np_Ng(Np_in, Ng_in); }
3548 
3549 
3550 template<class Scalar>
3552  EOutArgsMembers arg, bool supports_in
3553  )
3554 { this->_setSupports(arg,supports_in); }
3555 
3556 
3557 template<class Scalar>
3559  EOutArgsDfDp arg, int l, const DerivativeSupport& supports_in
3560  )
3561 { this->_setSupports(arg,l,supports_in); }
3562 
3563 
3564 template<class Scalar>
3566  EOutArgsDgDx_dot arg, int j, const DerivativeSupport& supports_in
3567  )
3568 { this->_setSupports(arg,j,supports_in); }
3569 
3570 
3571 template<class Scalar>
3573  EOutArgsDgDx arg, int j, const DerivativeSupport& supports_in
3574  )
3575 { this->_setSupports(arg,j,supports_in); }
3576 
3577 
3578 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3579 
3580 template<class Scalar>
3582  EOutArgs_hess_vec_prod_f_xx arg, bool supports_in
3583  )
3584 { this->_setSupports(arg,supports_in); }
3585 
3586 template<class Scalar>
3588  EOutArgs_hess_vec_prod_f_xp arg, int l, bool supports_in
3589  )
3590 { this->_setSupports(arg,l,supports_in); }
3591 
3592 template<class Scalar>
3594  EOutArgs_hess_vec_prod_f_px arg, int l, bool supports_in
3595  )
3596 { this->_setSupports(arg,l,supports_in); }
3597 
3598 template<class Scalar>
3600  EOutArgs_hess_vec_prod_f_pp arg, int l1, int l2, bool supports_in
3601  )
3602 { this->_setSupports(arg,l1,l2,supports_in); }
3603 
3604 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3605 
3606 
3607 template<class Scalar>
3609  EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports_in
3610  )
3611 { this->_setSupports(arg,j,l,supports_in); }
3612 
3613 
3614 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3615 
3616 template<class Scalar>
3618  EOutArgs_hess_vec_prod_g_xx arg, int j, bool supports_in
3619  )
3620 { this->_setSupports(arg,j,supports_in); }
3621 
3622 template<class Scalar>
3624  EOutArgs_hess_vec_prod_g_xp arg, int j, int l, bool supports_in
3625  )
3626 { this->_setSupports(arg,j,l,supports_in); }
3627 
3628 template<class Scalar>
3630  EOutArgs_hess_vec_prod_g_px arg, int j, int l, bool supports_in
3631  )
3632 { this->_setSupports(arg,j,l,supports_in); }
3633 
3634 template<class Scalar>
3636  EOutArgs_hess_vec_prod_g_pp arg, int j, int l1, int l2, bool supports_in
3637  )
3638 { this->_setSupports(arg,j,l1,l2,supports_in); }
3639 
3640 template<class Scalar>
3642  EOutArgs_hess_f_xx arg, bool supports_in
3643  )
3644 { this->_setSupports(arg,supports_in); }
3645 
3646 template<class Scalar>
3648  EOutArgs_hess_f_xp arg, int l, bool supports_in
3649  )
3650 { this->_setSupports(arg,l,supports_in); }
3651 
3652 template<class Scalar>
3654  EOutArgs_hess_f_pp arg, int l1, int l2, bool supports_in
3655  )
3656 { this->_setSupports(arg,l1,l2,supports_in); }
3657 
3658 template<class Scalar>
3660  EOutArgs_hess_g_xx arg, int j, bool supports_in
3661  )
3662 { this->_setSupports(arg,j,supports_in); }
3663 
3664 template<class Scalar>
3666  EOutArgs_hess_g_xp arg, int j, int l, bool supports_in
3667  )
3668 { this->_setSupports(arg,j,l,supports_in); }
3669 
3670 template<class Scalar>
3672  EOutArgs_hess_g_pp arg, int j, int l1, int l2, bool supports_in
3673  )
3674 { this->_setSupports(arg,j,l1,l2,supports_in); }
3675 
3676 template<class Scalar>
3678  EOutArgs_H_xx arg, bool supports_in
3679  )
3680 { this->_setSupports(arg,supports_in); }
3681 
3682 template<class Scalar>
3684  EOutArgs_H_xp arg, int l, bool supports_in
3685  )
3686 { this->_setSupports(arg,l,supports_in); }
3687 
3688 template<class Scalar>
3690  EOutArgs_H_pp arg, int l1, int l2, bool supports_in
3691  )
3692 { this->_setSupports(arg,l1,l2,supports_in); }
3693 
3694 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3695 
3696 
3697 template<class Scalar>
3699  EOutArgs_g_mp arg, int j, bool supports_in
3700  )
3701 { this->_setSupports(arg,j,supports_in); }
3702 
3703 
3704 template<class Scalar>
3706  EOutArgsDfDp_mp arg, int l, const DerivativeSupport& supports_in
3707  )
3708 { this->_setSupports(arg,l,supports_in); }
3709 
3710 
3711 template<class Scalar>
3713  EOutArgsDgDx_dot_mp arg, int j, const DerivativeSupport& supports_in
3714  )
3715 { this->_setSupports(arg,j,supports_in); }
3716 
3717 
3718 template<class Scalar>
3720  EOutArgsDgDx_mp arg, int j, const DerivativeSupport& supports_in
3721  )
3722 { this->_setSupports(arg,j,supports_in); }
3723 
3724 
3725 template<class Scalar>
3727  EOutArgsDgDp_mp arg, int j, int l, const DerivativeSupport& supports_in
3728  )
3729 { this->_setSupports(arg,j,l,supports_in); }
3730 
3731 
3732 template<class Scalar>
3734  const DerivativeProperties &properties
3735  )
3736 { this->_set_W_properties(properties); }
3737 
3738 
3739 template<class Scalar>
3741  int l, const DerivativeProperties &properties
3742  )
3743 { this->_set_DfDp_properties(l,properties); }
3744 
3745 
3746 template<class Scalar>
3748  int j, const DerivativeProperties &properties
3749  )
3750 { this->_set_DgDx_dot_properties(j,properties); }
3751 
3752 
3753 template<class Scalar>
3755  int j, const DerivativeProperties &properties
3756  )
3757 { this->_set_DgDx_properties(j,properties); }
3758 
3759 
3760 template<class Scalar>
3762  int j, int l, const DerivativeProperties &properties
3763  )
3764 { this->_set_DgDp_properties(j,l,properties); }
3765 
3766 
3767 template<class Scalar>
3769  int l, const DerivativeProperties &properties
3770  )
3771 { this->_set_DfDp_mp_properties(l,properties); }
3772 
3773 
3774 template<class Scalar>
3776  int j, const DerivativeProperties &properties
3777  )
3778 { this->_set_DgDx_dot_mp_properties(j,properties); }
3779 
3780 
3781 template<class Scalar>
3782 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_mp_properties(
3783  int j, const DerivativeProperties &properties
3784  )
3785 { this->_set_DgDx_mp_properties(j,properties); }
3786 
3787 
3788 template<class Scalar>
3789 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDp_mp_properties(
3790  int j, int l, const DerivativeProperties &properties
3791  )
3792 { this->_set_DgDp_mp_properties(j,l,properties); }
3793 
3794 
3795 template<class Scalar>
3797  const OutArgs<Scalar>& inputOutArgs
3798  )
3799 { this->_setSupports(inputOutArgs); }
3800 
3801 
3802 template<class Scalar>
3804  EInArgsMembers arg
3805  )
3806 { this->_setUnsupportsAndRelated(arg); }
3807 
3808 
3809 template<class Scalar>
3811  EOutArgsMembers arg
3812  )
3813 { this->_setUnsupportsAndRelated(arg); }
3814 
3815 
3816 #ifdef Thyra_BUILD_HESSIAN_SUPPORT
3817 template<class Scalar>
3819  const bool supports
3820  )
3821 { this->_setHessianSupports(supports); }
3822 #endif // ifdef Thyra_BUILD_HESSIAN_SUPPORT
3823 
3824 } // namespace Thyra
3825 
3826 
3827 
3828 //
3829 // Explicit instantiation macro
3830 //
3831 // Must be expanded from within the Thyra namespace!
3832 //
3833 
3834 
3835 #define THYRA_MODEL_EVALUATOR_BASE_INSTANT(SCALAR) \
3836  \
3837  template class ModelEvaluatorBase::InArgs<SCALAR >; \
3838  \
3839  template std::string \
3840  ModelEvaluatorBase::Derivative<SCALAR >::description() const; \
3841  \
3842  template \
3843  void ModelEvaluatorBase::Derivative<SCALAR >::describe( \
3844  Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel \
3845  ) const; \
3846  \
3847  template class ModelEvaluatorBase::OutArgs<SCALAR >; \
3848  \
3849  template class ModelEvaluatorBase::InArgsSetup<SCALAR >; \
3850  \
3851  template class ModelEvaluatorBase::OutArgsSetup<SCALAR >;
3852 
3853 
3854 #endif // THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
int Ng() const
Return the number of axillary response functions g(j)(...) supported (Ng &gt;= 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_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
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.
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...
#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.
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.
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 &gt;= 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)
Interface for a collection of column vectors called a multi-vector.
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.
void _setModelEvalDescription(const std::string &modelEvalDescription)
Abstract interface for finite-dimensional dense vectors.
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 &lt;= l &amp;&amp; l &lt; this-&gt;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 &gt;= 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.
Scalar get_stage_number() const
Precondition: supports(IN_ARG_stage_number)==true.
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.
int Np() const
Return the number of parameter subvectors p(l) supported (Np &gt;= 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 &lt;= l &amp;&amp; l &lt; this-&gt;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.
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 &lt;= l &amp;&amp; l &lt; this-&gt;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...