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 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
43 #define THYRA_MODEL_EVALUATOR_BASE_DEF_HPP
44 
45 
46 #include "Thyra_ModelEvaluatorBase_decl.hpp"
47 #include "Thyra_MultiVectorBase.hpp"
48 #include "Thyra_VectorBase.hpp"
49 #include "Thyra_MultiVectorStdOps.hpp"
50 #include "Thyra_VectorStdOps.hpp"
51 
52 
53 namespace Thyra {
54 
55 
56 namespace ModelEvaluatorHelperPack {
57 
58 
59 template<class Scalar>
60 inline
61 RCP<const Thyra::VectorBase<Scalar> >
62 condCloneVec(
63  const RCP<const Thyra::VectorBase<Scalar> > &vec,
64  bool cloneObject
65  )
66 {
67  if(cloneObject)
68  return vec->clone_v();
69  return vec;
70 }
71 
72 inline
73 RCP<const Stokhos::ProductEpetraVector >
74 condCloneVec_mp(
75  const RCP<const Stokhos::ProductEpetraVector > &vec,
76  bool cloneObject
77  )
78 {
79  if(cloneObject)
80  {
81  printf("Warning: clone_v not implemented for ProductEpetraVector: %s %d\n",__FILE__,__LINE__);
82  //return vec->clone_v(); //JF clone_v not implemented for ProductEpetraVector
83  }
84  return vec;
85 }
86 
87 } // namespace ModelEvaluatorHelperPack
88 
89 
90 //
91 // ModelEvaluatorBase::InArgs
92 //
93 
94 
95 template<class Scalar>
97  :modelEvalDescription_("WARNING! THIS INARGS OBJECT IS UNINITIALIZED!")
98 {
101  std::fill_n(&supports_[0],NUM_E_IN_ARGS_MEMBERS,false);
102  t_ = SMT::zero();
103  alpha_ = ST::zero();
104  beta_ = ST::zero();
105  step_size_ = ST::zero();
106  stage_number_ = ST::one();
107 }
108 
109 
110 template<class Scalar>
112 { return p_.size(); }
113 
114 template<class Scalar>
116 {
118  int(arg)>=NUM_E_IN_ARGS_MEMBERS || int(arg) < 0,std::logic_error
119  ,"model = \'"<<modelEvalDescription_
120  <<"\': Error, arg="<<toString(arg)<<" is invalid!"
121  );
122  return supports_[arg];
123 }
124 
125 template<class Scalar>
127 {
128  assert_l(l);
129  return supports_p_mp_[l];
130 }
131 
132 template<class Scalar>
134  const RCP<const VectorBase<Scalar> > &x_dot_dot
135  )
136 { assert_supports(IN_ARG_x_dot_dot); x_dot_dot_ = x_dot_dot; }
137 
138 template<class Scalar>
141 { assert_supports(IN_ARG_x_dot_dot); return x_dot_dot_; }
142 
143 template<class Scalar>
145  const RCP<const VectorBase<Scalar> > &x_dot
146  )
147 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
148 
149 
150 template<class Scalar>
153 { assert_supports(IN_ARG_x_dot); return x_dot_; }
154 
155 
156 template<class Scalar>
158  const RCP<const VectorBase<Scalar> > &x
159  )
160 { assert_supports(IN_ARG_x); x_ = x; }
161 
162 
163 template<class Scalar>
166 { assert_supports(IN_ARG_x); return x_; }
167 
168 
169 template<class Scalar>
172  )
173 { assert_supports(IN_ARG_x_dot_mp); x_dot_mp_ = x_dot_mp; }
174 
175 
176 template<class Scalar>
179 { assert_supports(IN_ARG_x_dot_mp); return x_dot_mp_; }
180 
181 
182 template<class Scalar>
185  )
186 { assert_supports(IN_ARG_x_mp); x_mp_ = x_mp; }
187 
188 
189 template<class Scalar>
192 { assert_supports(IN_ARG_x_mp); return x_mp_; }
193 
194 
195 #ifdef HAVE_THYRA_ME_POLYNOMIAL
196 
197 template<class Scalar>
199  const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_dot_poly
200  )
201 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
202 
203 
204 template<class Scalar>
207 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; }
208 
209 
210 template<class Scalar>
211 void ModelEvaluatorBase::InArgs<Scalar>::set_x_poly(
212  const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_poly
213  )
214 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
215 
216 
217 template<class Scalar>
218 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > >
219 ModelEvaluatorBase::InArgs<Scalar>::get_x_poly() const
220 { assert_supports(IN_ARG_x_poly); return x_poly_; }
221 
222 
223 #endif // HAVE_THYRA_ME_POLYNOMIAL
224 
225 template<class Scalar>
227  int l, const RCP<const VectorBase<Scalar> > &p_l
228  )
229 { assert_l(l); p_[l] = p_l; }
230 
231 
232 template<class Scalar>
235 { assert_l(l); return p_[l]; }
236 
237 
238 template<class Scalar>
240  int l, const RCP<const Stokhos::ProductEpetraVector > &p_mp_l
241  )
242 { assert_supports(IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; }
243 
244 template<class Scalar>
247 { assert_supports(IN_ARG_p_mp, l); return p_mp_[l]; }
248 
249 
250 template<class Scalar>
252 { assert_supports(IN_ARG_t); t_ = t; }
253 
254 
255 template<class Scalar>
258 { assert_supports(IN_ARG_t); return t_; }
259 
260 
261 template<class Scalar>
263 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
264 
265 
266 template<class Scalar>
268 { assert_supports(IN_ARG_alpha); return alpha_; }
269 
270 
271 template<class Scalar>
273 { assert_supports(IN_ARG_beta); beta_ = beta; }
274 
275 
276 template<class Scalar>
278 { assert_supports(IN_ARG_beta); return beta_; }
279 
280 template<class Scalar>
282 { assert_supports(IN_ARG_W_x_dot_dot_coeff); W_x_dot_dot_coeff_ = W_x_dot_dot_coeff; }
283 
284 
285 template<class Scalar>
287 { assert_supports(IN_ARG_W_x_dot_dot_coeff); return W_x_dot_dot_coeff_; }
288 
289 template<class Scalar>
291 { assert_supports(IN_ARG_step_size); step_size_ = step_size; }
292 
293 template<class Scalar>
295 { assert_supports(IN_ARG_step_size); return step_size_; }
296 
297 template<class Scalar>
299 { assert_supports(IN_ARG_stage_number); return stage_number_; }
300 
301 
302 template<class Scalar>
304 { assert_supports(IN_ARG_stage_number); stage_number_ = stage_number; }
305 
306 
307 template<class Scalar>
309  const InArgs<Scalar>& inArgs, bool ignoreUnsupported, bool cloneObjects
310  )
311 {
312  using ModelEvaluatorHelperPack::condCloneVec;
313  using ModelEvaluatorHelperPack::condCloneVec_mp;
314  if( inArgs.supports(IN_ARG_x_dot_dot) && nonnull(inArgs.get_x_dot_dot()) ) {
315  if(supports(IN_ARG_x_dot_dot) || !ignoreUnsupported)
316  set_x_dot_dot(condCloneVec(inArgs.get_x_dot_dot(),cloneObjects));
317  }
318  if( inArgs.supports(IN_ARG_x_dot) && nonnull(inArgs.get_x_dot()) ) {
319  if(supports(IN_ARG_x_dot) || !ignoreUnsupported)
320  set_x_dot(condCloneVec(inArgs.get_x_dot(),cloneObjects));
321  }
322  if( inArgs.supports(IN_ARG_x_dot_mp) && nonnull(inArgs.get_x_dot_mp()) ) {
323  if(supports(IN_ARG_x_dot_mp) || !ignoreUnsupported)
324  set_x_dot_mp(condCloneVec_mp(inArgs.get_x_dot_mp(),cloneObjects));
325  }
326  if( inArgs.supports(IN_ARG_x) && nonnull(inArgs.get_x()) ) {
327  if(supports(IN_ARG_x) || !ignoreUnsupported)
328  set_x(condCloneVec(inArgs.get_x(),cloneObjects));
329  }
330  if( inArgs.supports(IN_ARG_x_mp) && nonnull(inArgs.get_x_mp()) ) {
331  if(supports(IN_ARG_x_mp) || !ignoreUnsupported)
332  set_x_mp(condCloneVec_mp(inArgs.get_x_mp(),cloneObjects));
333  }
334 #ifdef HAVE_THYRA_ME_POLYNOMIAL
335  if( inArgs.supports(IN_ARG_x_dot_poly) && nonnull(inArgs.get_x_dot_poly()) ) {
336  if(supports(IN_ARG_x_dot_poly) || !ignoreUnsupported) {
338  cloneObjects && "Have not implemented cloning for x_dot_poly yet!" );
339  set_x_dot_poly(inArgs.get_x_dot_poly());
340  }
341  }
342  if( inArgs.supports(IN_ARG_x_poly) && nonnull(inArgs.get_x_poly()) ) {
343  if(supports(IN_ARG_x_poly) || !ignoreUnsupported) {
345  cloneObjects && "Have not implemented cloning for x_poly yet!" );
346  set_x_poly(inArgs.get_x_poly());
347  }
348  }
349 #endif // HAVE_THYRA_ME_POLYNOMIAL
350  const int min_Np = TEUCHOS_MIN(this->Np(),inArgs.Np());
351  for (int l = 0; l < min_Np; ++l) {
352  if (nonnull(inArgs.get_p(l)))
353  set_p(l,condCloneVec(inArgs.get_p(l),cloneObjects));
354  }
355  for (int l = 0; l < min_Np; ++l) {
356  if (inArgs.supports(IN_ARG_p_mp,l)) {
357  if (nonnull(inArgs.get_p_mp(l)))
358  set_p_mp(l,condCloneVec_mp(inArgs.get_p_mp(l),cloneObjects));
359  }
360  }
361  if (inArgs.supports(IN_ARG_t)) {
362  if(supports(IN_ARG_t) || !ignoreUnsupported)
363  set_t(inArgs.get_t());
364  }
365  if (inArgs.supports(IN_ARG_alpha)) {
366  if(supports(IN_ARG_alpha) || !ignoreUnsupported)
367  set_alpha(inArgs.get_alpha());
368  }
369  if (inArgs.supports(IN_ARG_beta)) {
370  if(supports(IN_ARG_beta) || !ignoreUnsupported)
371  set_beta(inArgs.get_beta());
372  }
373  if (inArgs.supports(IN_ARG_W_x_dot_dot_coeff)) {
374  if(supports(IN_ARG_W_x_dot_dot_coeff) || !ignoreUnsupported)
375  set_W_x_dot_dot_coeff(inArgs.get_W_x_dot_dot_coeff());
376  }
377  if (inArgs.supports(IN_ARG_step_size)) {
378  if(supports(IN_ARG_step_size) || !ignoreUnsupported)
379  set_step_size(inArgs.get_step_size());
380  }
381  if (inArgs.supports(IN_ARG_stage_number)) {
382  if(supports(IN_ARG_stage_number) || !ignoreUnsupported)
383  set_stage_number(inArgs.get_stage_number());
384  }
385  // Extended inArgs
386  if (extended_inargs_.size() > 0)
387  TEUCHOS_TEST_FOR_EXCEPTION(cloneObjects,
388  std::runtime_error,
389  "Extended InArgs does not support cloning!");
390  this->extended_inargs_ = inArgs.extended_inargs_;
391 }
392 
393 
394 template<class Scalar>
396  const InArgs<Scalar> &inArgs
397  ) const
398 {
399  for ( int inArg_i = 0; inArg_i < NUM_E_IN_ARGS_MEMBERS; ++inArg_i ) {
400  const EInArgsMembers inArg_arg = static_cast<EInArgsMembers>(inArg_i);
401  const std::string inArg_name = toString(inArg_arg);
403  supports(inArg_arg) != inArgs.supports(inArg_arg), std::logic_error,
404  "Error, the input argument "<<inArg_name<<" with support "<<inArgs.supports(inArg_arg)<<"\n"
405  "in the InArgs object for the model:\n\n"
406  " "<<inArgs.modelEvalDescription()<<"\n\n"
407  "is not the same the argument "<<inArg_name<<" with support "<<supports(inArg_arg)<<"\n"
408  "in the InArgs object for the model:\n\n"
409  " "<<modelEvalDescription()<<"\n\n"
410  "and these two InArgs objects are not compatible!"
411  );
412  }
413  TEUCHOS_ASSERT_EQUALITY( this->Np(), inArgs.Np() );
414 }
415 
416 
417 template<class Scalar>
419 {
420  return modelEvalDescription_;
421 }
422 
423 
424 template<class Scalar>
426 {
428  std::ostringstream oss;
429  oss
430  << "Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<">"
431  << "{"
432  << "model="<<modelEvalDescription_
433  << ",Np="<<Np()
434  << "}";
435  return oss.str();
436 }
437 
438 
439 template<class Scalar>
441  Teuchos::FancyOStream &out_arg, const Teuchos::EVerbosityLevel verbLevel
442  ) const
443 {
444  using std::endl;
446  using Teuchos::OSTab;
447  using Teuchos::describe;
449  typedef RCP<const VectorBase<Scalar> > CV_ptr;
450 
451  if(verbLevel == Teuchos::VERB_NONE)
452  return;
453 
455  out = Teuchos::rcp(&out_arg,false);
456  const bool dump_x = includesVerbLevel(verbLevel,Teuchos::VERB_HIGH);
457  const Teuchos::EVerbosityLevel x_verbLevel =
458  dump_x?Teuchos::VERB_EXTREME:verbLevel;
459  const bool print_x_nrm = includesVerbLevel(verbLevel,Teuchos::VERB_LOW);
460  const bool dump_p = includesVerbLevel(verbLevel,Teuchos::VERB_MEDIUM);
461  const Teuchos::EVerbosityLevel p_verbLevel =
462  dump_p?Teuchos::VERB_EXTREME:verbLevel;
463  const bool print_p_nrm = includesVerbLevel(verbLevel,Teuchos::VERB_LOW);
464  OSTab tab(out);
465 
466  *out <<"Thyra::ModelEvaluatorBase::InArgs<"<<ST::name()<<">:\n";
467  tab.incrTab();
468 
469  *out <<"model = " << modelEvalDescription_ << "\n";
470  *out <<"Np = " << Np() << "\n";
471 
472  CV_ptr x_dot_dot;
473  if ( this->supports(IN_ARG_x_dot_dot) && !is_null(x_dot_dot=get_x_dot_dot()) ) {
474  *out << "x_dot_dot = " << Teuchos::describe(*x_dot_dot,x_verbLevel);
475  if (print_x_nrm)
476  *out << "||x_dot_dot|| = " << norm(*x_dot_dot) << endl;
477  }
478 
479  CV_ptr x_dot;
480  if ( this->supports(IN_ARG_x_dot) && !is_null(x_dot=get_x_dot()) ) {
481  *out << "x_dot = " << Teuchos::describe(*x_dot,x_verbLevel);
482  if (print_x_nrm)
483  *out << "||x_dot|| = " << norm(*x_dot) << endl;
484  }
485 
486  CV_ptr x;
487  if ( this->supports(IN_ARG_x) && !is_null(x=get_x()) ) {
488  *out << "x = " << Teuchos::describe(*x,x_verbLevel);
489  if (print_x_nrm)
490  *out << "||x|| = " << norm(*x) << endl;
491  }
492 
493  if (print_x_nrm) {
494  for( int l = 0; l < Np(); ++l ) {
495  CV_ptr p_l;
496  if ( !is_null(p_l = this->get_p(l)) ) {
497  *out << "p("<<l<<") = " << Teuchos::describe(*p_l,p_verbLevel);
498  if (print_p_nrm)
499  *out << "||p("<<l<<")|| = " << norm(*p_l) << endl;
500  }
501  }
502  }
503 
504  if (includesVerbLevel(verbLevel,Teuchos::VERB_MEDIUM)) {
505  if (this->supports(IN_ARG_t)) {
506  *out << "t = " << t_ << endl;
507  }
508  if (this->supports(IN_ARG_alpha)) {
509  *out << "alpha = " << alpha_ << endl;
510  }
511  if (this->supports(IN_ARG_beta)) {
512  *out << "beta = " << beta_ << endl;
513  }
514  if (this->supports(IN_ARG_W_x_dot_dot_coeff)) {
515  *out << "W_x_dot_dot_coeff = " << W_x_dot_dot_coeff_ << endl;
516  }
517  if (this->supports(IN_ARG_step_size)) {
518  *out << "step_size = " << step_size_ << endl;
519  }
520  if (this->supports(IN_ARG_stage_number)) {
521  *out << "stage_number = " << stage_number_ << endl;
522  }
523  }
524 
525 }
526 
527 
528 template<class Scalar>
530  const std::string &modelEvalDescription_in
531  )
532 {
533  modelEvalDescription_ = modelEvalDescription_in;
534 }
535 
536 
537 template<class Scalar>
539 {
540  p_.resize(Np_in);
541  p_mp_.resize(Np_in);
542  supports_p_mp_.resize(Np_in);
543 }
544 
545 
546 template<class Scalar>
548  EInArgsMembers arg, bool supports_in
549  )
550 {
552  int(arg)>=NUM_E_IN_ARGS_MEMBERS || int(arg) < 0,std::logic_error
553  ,"model = \'"<<modelEvalDescription_
554  <<"\': Error, arg="<<toString(arg)<<" is invalid!");
555  supports_[arg] = supports_in;
556 }
557 
558 template<class Scalar>
560  EInArgs_p_mp /* arg */, int l, bool supports_in
561  )
562 {
563  assert_l(l);
564  supports_p_mp_[l] = supports_in;
565 }
566 
567 
568 template<class Scalar>
570  const InArgs<Scalar>& inArgs, const int Np_in
571  )
572 {
573  std::copy(
574  &inArgs.supports_[0],
575  &inArgs.supports_[0] + NUM_E_IN_ARGS_MEMBERS, &supports_[0] );
576  this->_set_Np( Np_in >= 0 ? Np_in : inArgs.Np() );
577 }
578 
579 
580 template<class Scalar>
582  EInArgsMembers arg
583  )
584 {
585  switch(arg) {
586  case IN_ARG_x: {
587  this->_setSupports(IN_ARG_x_dot_dot,false);
588  this->_setSupports(IN_ARG_x_dot,false);
589  this->_setSupports(IN_ARG_x_dot_poly,false);
590  this->_setSupports(IN_ARG_alpha,false);
591  this->_setSupports(IN_ARG_beta,false);
592  this->_setSupports(IN_ARG_W_x_dot_dot_coeff,false);
593  this->_setSupports(IN_ARG_step_size,false);
594  this->_setSupports(IN_ARG_stage_number,false);
595  break;
596  }
597  default:
599  true ,std::logic_error,
600  "Error, can not handle args other than IN_ARG_x yet!"
601  );
602  }
603  this->_setSupports(arg,false);
604 }
605 
606 
607 template<class Scalar>
609  EInArgsMembers arg
610  ) const
611 {
613  !supports_[arg], std::logic_error
614  ,"Thyra::ModelEvaluatorBase::InArgs<"
615  << Teuchos::ScalarTraits<Scalar>::name() <<">::assert_supports(arg): "
616  "model = \'"<<modelEvalDescription_<<"\': Error, "
617  "The argument arg = " << toString(arg) << " is not supported!"
618  );
619 }
620 
621 template<class Scalar>
623  EInArgs_p_mp /* arg */, int l
624  ) const
625 {
626  assert_l(l);
628  !supports_p_mp_[l], std::logic_error
629  ,"Thyra::ModelEvaluatorBase::InArgs<"
630  << Teuchos::ScalarTraits<Scalar>::name() <<">::assert_supports(IN_ARG_p_mp,1): "
631  "model = \'"<<modelEvalDescription_<<"\': Error, "
632  "The argument p_mp(l) with index l = " << l << " is not supported!"
633  );
634 }
635 
636 
637 template<class Scalar>
638 void ModelEvaluatorBase::InArgs<Scalar>::assert_l(int l) const
639 {
641  !( 0 <= l && l < Np() ), std::logic_error
642  ,"Thyra::ModelEvaluatorBase::InArgs<Scalar>::assert_l(l):\n\n"
643  " model = \'"<<modelEvalDescription_<<"\':\n\n"
644  "Error, The parameter l = " << l << " is not in the range [0,"<<Np()<<")!"
645  );
646 }
647 
648 
649 //
650 // ModelEvaluatorBase::DerivativeMultiVector
651 //
652 
653 
654 template<class Scalar>
656 {
657  using std::endl;
658  std::ostringstream oss;
659  oss << "DerivativeMultiVector{";
660  if (is_null(getMultiVector())) {
661  oss << "NULL";
662  }
663  else {
664  oss
665  << "multiVec=" << getMultiVector()->description()
666  << ",orientation=" << toString(getOrientation());
667  }
668  oss << "}";
669  return oss.str();
670 }
671 
672 
673 template<class Scalar>
675  Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
676  ) const
677 {
678  using std::endl;
679  using Teuchos::describe;
680  Teuchos::OSTab tab1(out);
681  out << "DerivativeMultiVector\n";
682  Teuchos::OSTab tab2(out);
683  out
684  << "multiVec = "
685  << describe(*getMultiVector(),verbLevel)
686  << "orientation = "
687  << toString(getOrientation()) << endl;
688 }
689 
690 
691 // 2007/06/12: rabartl: The above description() and describe(...) functions
692 // have to be defined here and not in the class DerivativeMultiVector since it
693 // relies on the non-member function
694 // toString(ModelEvaluatorBase::EDerivativeMultiVectorOrientation) which is
695 // defined after the class definition for ModelEvaluatorBase. This was caught
696 // by the intel compiler. I am not sure why this worked with gcc.
697 
698 
699 //
700 // ModelEvaluatorBase::Derivative
701 //
702 
703 
704 template<class Scalar>
705 std::string
707 {
708  using std::endl;
709  std::ostringstream oss;
710  oss << "Derivative{";
711  if (isEmpty()) {
712  oss << "NULL";
713  }
714  else if (!is_null(getLinearOp())) {
715  oss << "linearOp=" << getLinearOp()->description();
716  }
717  else {
718  oss << "derivMultiVec=" << getDerivativeMultiVector().description();
719  }
720  oss << "}";
721  return oss.str();
722 }
723 
724 
725 template<class Scalar>
727  Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
728  ) const
729 {
730  using std::endl;
731  using Teuchos::describe;
732  Teuchos::OSTab tab1(out);
733  out << "Derivative:";
734  if (isEmpty()) {
735  out << " NULL\n";
736  }
737  else if (!is_null(getLinearOp())) {
738  out
739  << endl
740  << "linearOp = " << describe(*getLinearOp(),verbLevel);
741  }
742  else {
743  out
744  << endl
745  << "derivMultiVec = ";
746  getDerivativeMultiVector().describe(out,verbLevel);
747  }
748 }
749 
750 
751 //
752 // ModelEvaluatorBase::OutArgs
753 //
754 
755 
756 template<class Scalar>
758  :modelEvalDescription_("WARNING! THIS OUTARGS OBJECT IS UNINITIALIZED!"),
759  isFailed_(false)
760 { std::fill_n(&supports_[0],NUM_E_OUT_ARGS_MEMBERS,false); }
761 
762 
763 template<class Scalar>
765 { return DfDp_.size(); }
766 
767 
768 template<class Scalar>
770 { return g_.size(); }
771 
772 
773 template<class Scalar>
775  EOutArgsMembers arg
776  ) const
777 {
779  int(arg)>=NUM_E_OUT_ARGS_MEMBERS || int(arg) < 0,std::logic_error
780  ,"model = \'"<<modelEvalDescription_
781  <<"\': Error, arg="<<toString(arg)<<" is invalid!"
782  );
783  return supports_[arg];
784 }
785 
786 
787 template<class Scalar>
790  EOutArgsDfDp /* arg */, int l
791  ) const
792 {
793  assert_l(l);
794  return supports_DfDp_[l];
795 }
796 
797 
798 template<class Scalar>
801  EOutArgsDgDx_dot /* arg */, int j
802  ) const
803 {
804  assert_j(j);
805  return supports_DgDx_dot_[j];
806 }
807 
808 
809 template<class Scalar>
812  EOutArgsDgDx /* arg */, int j
813  ) const
814 {
815  assert_j(j);
816  return supports_DgDx_[j];
817 }
818 
819 
820 template<class Scalar>
823  EOutArgsDgDp /* arg */, int j, int l
824  ) const
825 {
826  assert_j(j);
827  assert_l(l);
828  return supports_DgDp_[ j*Np() + l ];
829 }
830 
831 
832 template<class Scalar>
833 bool
835  EOutArgs_g_mp /* arg */, int j
836  ) const
837 {
838  assert_j(j);
839  return supports_g_mp_[j];
840 }
841 
842 template<class Scalar>
845  EOutArgsDfDp_mp /* arg */, int l
846  ) const
847 {
848  assert_l(l);
849  return supports_DfDp_mp_[l];
850 }
851 
852 
853 template<class Scalar>
854 const ModelEvaluatorBase::DerivativeSupport&
856  EOutArgsDgDx_dot_mp /* arg */, int j
857  ) const
858 {
859  assert_j(j);
860  return supports_DgDx_dot_mp_[j];
861 }
862 
863 
864 template<class Scalar>
865 const ModelEvaluatorBase::DerivativeSupport&
867  EOutArgsDgDx_mp /* arg */, int j
868  ) const
869 {
870  assert_j(j);
871  return supports_DgDx_mp_[j];
872 }
873 
874 
875 template<class Scalar>
876 const ModelEvaluatorBase::DerivativeSupport&
878  EOutArgsDgDp_mp /* arg */, int j, int l
879  ) const
880 {
881  assert_j(j);
882  assert_l(l);
883  return supports_DgDp_mp_[ j*Np() + l ];
884 }
885 
886 
887 
888 template<class Scalar>
890  const Evaluation<VectorBase<Scalar> > &f
891  )
892 {
893  assert_supports(OUT_ARG_f);
894  f_ = f;
895 }
896 
897 
898 template<class Scalar>
901 {
902  assert_supports(OUT_ARG_f);
903  return f_;
904 }
905 
906 
907 template<class Scalar>
909  int j, const Evaluation<VectorBase<Scalar> > &g_j
910  )
911 {
912  assert_j(j);
913  g_[j] = g_j;
914 }
915 
916 
917 template<class Scalar>
920 {
921  assert_j(j);
922  return g_[j];
923 }
924 
925 
926 template<class Scalar>
929  )
930 {
931  assert_supports(OUT_ARG_f_mp);
932  f_mp_ = f_mp;
933 }
934 
935 
936 template<class Scalar>
939 {
940  assert_supports(OUT_ARG_f_mp);
941  return f_mp_;
942 }
943 
944 
945 template<class Scalar>
947  int j, const RCP<Stokhos::ProductEpetraVector> &g_mp_j
948  )
949 {
950  assert_supports(OUT_ARG_g_mp,j);
951  g_mp_[j] = g_mp_j;
952 }
953 
954 
955 template<class Scalar>
958 {
959  assert_supports(OUT_ARG_g_mp,j);
960  return g_mp_[j];
961 }
962 
963 
964 template<class Scalar>
967  )
968 {
969  assert_supports(OUT_ARG_W);
970  W_ = W;
971 }
972 
973 
974 template<class Scalar>
977 {
978  assert_supports(OUT_ARG_W);
979  return W_;
980 }
981 
982 
983 template<class Scalar>
986  )
987 {
988  assert_supports(OUT_ARG_W_mp);
989  W_mp_ = W_mp;
990 }
991 
992 
993 template<class Scalar>
996 {
997  assert_supports(OUT_ARG_W_mp);
998  return W_mp_;
999 }
1000 
1001 
1002 template<class Scalar>
1004  const RCP<LinearOpBase<Scalar> > &W_op
1005  )
1006 {
1007  assert_supports(OUT_ARG_W_op);
1008  W_op_ = W_op;
1009 }
1010 
1011 
1012 template<class Scalar>
1015 {
1016  assert_supports(OUT_ARG_W_op);
1017  return W_op_;
1018 }
1019 
1020 
1021 template<class Scalar>
1023  const RCP<PreconditionerBase<Scalar> > &W_prec
1024  )
1025 {
1026  assert_supports(OUT_ARG_W_prec);
1027  W_prec_ = W_prec;
1028 }
1029 
1030 
1031 template<class Scalar>
1034 {
1035  assert_supports(OUT_ARG_W_prec);
1036  return W_prec_;
1037 }
1038 
1039 
1040 template<class Scalar>
1043 {
1044  assert_supports(OUT_ARG_f);
1045  return W_properties_;
1046 }
1047 
1048 
1049 template<class Scalar>
1051  int l, const Derivative<Scalar> &DfDp_l
1052  )
1053 {
1054  assert_supports(OUT_ARG_DfDp,l,DfDp_l);
1055  DfDp_[l] = DfDp_l;
1056 }
1057 
1058 
1059 template<class Scalar>
1062 {
1063  assert_supports(OUT_ARG_DfDp,l);
1064  return DfDp_[l];
1065 }
1066 
1067 
1068 template<class Scalar>
1071 {
1072  assert_supports(OUT_ARG_DfDp,l);
1073  return DfDp_properties_[l];
1074 }
1075 
1076 
1077 template<class Scalar>
1079  int l, const MPDerivative &DfDp_mp_l
1080  )
1081 {
1082  assert_supports(OUT_ARG_DfDp_mp,l,DfDp_mp_l);
1083  DfDp_mp_[l] = DfDp_mp_l;
1084 }
1085 
1086 
1087 template<class Scalar>
1090 {
1091  assert_supports(OUT_ARG_DfDp_mp,l);
1092  return DfDp_mp_[l];
1093 }
1094 
1095 
1096 template<class Scalar>
1097 ModelEvaluatorBase::DerivativeProperties
1098 ModelEvaluatorBase::OutArgs<Scalar>::get_DfDp_mp_properties(int l) const
1099 {
1100  assert_supports(OUT_ARG_DfDp_mp,l);
1101  return DfDp_mp_properties_[l];
1102 }
1103 
1104 
1105 template<class Scalar>
1107  int j, const Derivative<Scalar> &DgDx_dot_j
1108  )
1109 {
1110  assert_supports(OUT_ARG_DgDx_dot,j,DgDx_dot_j);
1111  DgDx_dot_[j] = DgDx_dot_j;
1112 }
1113 
1114 
1115 template<class Scalar>
1118 {
1119  assert_supports(OUT_ARG_DgDx_dot,j);
1120  return DgDx_dot_[j];
1121 }
1122 
1123 
1124 template<class Scalar>
1127 {
1128  assert_supports(OUT_ARG_DgDx_dot,j);
1129  return DgDx_dot_properties_[j];
1130 }
1131 
1132 
1133 template<class Scalar>
1135  int j, const MPDerivative &DgDx_dot_mp_j
1136  )
1137 {
1138  assert_supports(OUT_ARG_DgDx_dot_mp,j,DgDx_dot_mp_j);
1139  DgDx_dot_mp_[j] = DgDx_dot_mp_j;
1140 }
1141 
1142 
1143 template<class Scalar>
1146 {
1147  assert_supports(OUT_ARG_DgDx_dot_mp,j);
1148  return DgDx_dot_mp_[j];
1149 }
1150 
1151 
1152 template<class Scalar>
1153 ModelEvaluatorBase::DerivativeProperties
1154 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_dot_mp_properties(int j) const
1155 {
1156  assert_supports(OUT_ARG_DgDx_dot_mp,j);
1157  return DgDx_dot_mp_properties_[j];
1158 }
1159 
1160 
1161 template<class Scalar>
1163  int j, const Derivative<Scalar> &DgDx_j
1164  )
1165 {
1166  assert_supports(OUT_ARG_DgDx,j,DgDx_j);
1167  DgDx_[j] = DgDx_j;
1168 }
1169 
1170 
1171 template<class Scalar>
1174 {
1175  assert_supports(OUT_ARG_DgDx,j);
1176  return DgDx_[j];
1177 }
1178 
1179 
1180 template<class Scalar>
1183 {
1184  assert_supports(OUT_ARG_DgDx,j);
1185  return DgDx_properties_[j];
1186 }
1187 
1188 
1189 template<class Scalar>
1191  int j, const MPDerivative &DgDx_mp_j
1192  )
1193 {
1194  assert_supports(OUT_ARG_DgDx_mp,j,DgDx_mp_j);
1195  DgDx_mp_[j] = DgDx_mp_j;
1196 }
1197 
1198 
1199 template<class Scalar>
1202 {
1203  assert_supports(OUT_ARG_DgDx_mp,j);
1204  return DgDx_mp_[j];
1205 }
1206 
1207 
1208 template<class Scalar>
1209 ModelEvaluatorBase::DerivativeProperties
1210 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDx_mp_properties(int j) const
1211 {
1212  assert_supports(OUT_ARG_DgDx_mp,j);
1213  return DgDx_mp_properties_[j];
1214 }
1215 
1216 
1217 template<class Scalar>
1219  int j, int l, const Derivative<Scalar> &DgDp_j_l
1220  )
1221 {
1222  assert_supports(OUT_ARG_DgDp,j,l,DgDp_j_l);
1223  DgDp_[ j*Np() + l ] = DgDp_j_l;
1224 }
1225 
1226 
1227 template<class Scalar>
1230 {
1231  assert_supports(OUT_ARG_DgDp,j,l);
1232  return DgDp_[ j*Np() + l ];
1233 }
1234 
1235 
1236 template<class Scalar>
1239 {
1240  assert_supports(OUT_ARG_DgDp,j,l);
1241  return DgDp_properties_[ j*Np() + l ];
1242 }
1243 
1244 
1245 template<class Scalar>
1247  int j, int l, const MPDerivative &DgDp_mp_j_l
1248  )
1249 {
1250  assert_supports(OUT_ARG_DgDp_mp,j,l,DgDp_mp_j_l);
1251  DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l;
1252 }
1253 
1254 
1255 template<class Scalar>
1258 {
1259  assert_supports(OUT_ARG_DgDp_mp,j,l);
1260  return DgDp_mp_[ j*Np() + l ];
1261 }
1262 
1263 
1264 template<class Scalar>
1265 ModelEvaluatorBase::DerivativeProperties
1266 ModelEvaluatorBase::OutArgs<Scalar>::get_DgDp_mp_properties(int j, int l) const
1267 {
1268  assert_supports(OUT_ARG_DgDp_mp,j,l);
1269  return DgDp_mp_properties_[ j*Np() + l ];
1270 }
1271 
1272 
1273 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1274 
1275 
1276 template<class Scalar>
1277 void ModelEvaluatorBase::OutArgs<Scalar>::set_f_poly(
1278  const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly
1279  )
1280 {
1281  f_poly_ = f_poly;
1282 }
1283 
1284 
1285 template<class Scalar>
1286 RCP<Teuchos::Polynomial< VectorBase<Scalar> > >
1287 ModelEvaluatorBase::OutArgs<Scalar>::get_f_poly() const
1288 {
1289  return f_poly_;
1290 }
1291 
1292 
1293 #endif // HAVE_THYRA_ME_POLYNOMIAL
1294 
1295 
1296 template<class Scalar>
1298  const OutArgs<Scalar>& inputOutArgs, bool ignoreUnsupported
1299  )
1300 {
1301  typedef ModelEvaluatorBase MEB;
1302  const int min_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.Np());
1303  const int min_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.Ng());
1304  // f
1305  if ( inputOutArgs.supports(OUT_ARG_f) && nonnull(inputOutArgs.get_f()) ) {
1306  if ( supports(OUT_ARG_f) || !ignoreUnsupported )
1307  set_f(inputOutArgs.get_f());
1308  }
1309  if ( inputOutArgs.supports(OUT_ARG_f_mp) && nonnull(inputOutArgs.get_f_mp()) ) {
1310  if ( supports(OUT_ARG_f_mp) || !ignoreUnsupported )
1311  set_f_mp(inputOutArgs.get_f_mp());
1312  }
1313 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1314  // f_poly
1315  if ( inputOutArgs.supports(OUT_ARG_f_poly) && nonnull(inputOutArgs.get_f_poly()) ) {
1316  if ( supports(OUT_ARG_f_poly) || !ignoreUnsupported )
1317  set_f_poly(inputOutArgs.get_f_poly());
1318  }
1319 #endif // HAVE_THYRA_ME_POLYNOMIAL
1320  // g(j)
1321  for ( int j = 0; j < min_Ng; ++j ) {
1322  if ( nonnull(inputOutArgs.get_g(j)) )
1323  set_g(j,inputOutArgs.get_g(j));
1324  }
1325  for ( int j = 0; j < min_Ng; ++j ) {
1326  if ( inputOutArgs.supports(OUT_ARG_g_mp,j) && nonnull(inputOutArgs.get_g_mp(j)) ) {
1327  if ( supports(OUT_ARG_g_mp,j) || !ignoreUnsupported )
1328  set_g_mp(j,inputOutArgs.get_g_mp(j));
1329  }
1330  }
1331  // W
1332  if( inputOutArgs.supports(OUT_ARG_W) && nonnull(inputOutArgs.get_W()) ) {
1333  if ( supports(OUT_ARG_W) || !ignoreUnsupported )
1334  set_W(inputOutArgs.get_W());
1335  }
1336  if( inputOutArgs.supports(OUT_ARG_W_mp) && nonnull(inputOutArgs.get_W_mp()) ) {
1337  if ( supports(OUT_ARG_W_mp) || !ignoreUnsupported )
1338  set_W_mp(inputOutArgs.get_W_mp());
1339  }
1340  // W_op
1341  if( inputOutArgs.supports(OUT_ARG_W_op) && nonnull(inputOutArgs.get_W_op()) ) {
1342  if ( supports(OUT_ARG_W_op) || !ignoreUnsupported )
1343  set_W_op(inputOutArgs.get_W_op());
1344  }
1345  // W_prec
1346  if( inputOutArgs.supports(OUT_ARG_W_prec) && nonnull(inputOutArgs.get_W_prec()) ) {
1347  if ( supports(OUT_ARG_W_prec) || !ignoreUnsupported )
1348  set_W_prec(inputOutArgs.get_W_prec());
1349  }
1350  // DfDp(l)
1351  for ( int l = 0; l < min_Np; ++l ) {
1352  MEB::Derivative<Scalar> DfDp_l;
1353  if ( !inputOutArgs.supports(OUT_ARG_DfDp,l).none()
1354  && !(DfDp_l=inputOutArgs.get_DfDp(l)).isEmpty() )
1355  {
1356  if ( DfDp_l.isSupportedBy(supports(OUT_ARG_DfDp,l)) || !ignoreUnsupported )
1357  set_DfDp(l,DfDp_l);
1358  }
1359  }
1360  for ( int l = 0; l < min_Np; ++l ) {
1361  MEB::MPDerivative DfDp_mp_l;
1362  if ( !inputOutArgs.supports(OUT_ARG_DfDp_mp,l).none()
1363  && !(DfDp_mp_l=inputOutArgs.get_DfDp_mp(l)).isEmpty() )
1364  {
1365  if ( DfDp_mp_l.isSupportedBy(supports(OUT_ARG_DfDp_mp,l)) || !ignoreUnsupported )
1366  set_DfDp_mp(l,DfDp_mp_l);
1367  }
1368  }
1369  // DgDx_dot(j) and DgDx(j)
1370  for ( int j = 0; j < min_Ng; ++j ) {
1371  // DgDx_dot(j)
1372  MEB::Derivative<Scalar> DgDx_dot_j;
1373  if ( !inputOutArgs.supports(OUT_ARG_DgDx_dot,j).none()
1374  && !(DgDx_dot_j=inputOutArgs.get_DgDx_dot(j)).isEmpty() )
1375  {
1376  if( DgDx_dot_j.isSupportedBy(supports(OUT_ARG_DgDx_dot,j)) || !ignoreUnsupported )
1377  set_DgDx_dot(j,DgDx_dot_j);
1378  }
1379  // DgDx(j)
1380  MEB::Derivative<Scalar> DgDx_j;
1381  if ( !inputOutArgs.supports(OUT_ARG_DgDx,j).none()
1382  && !(DgDx_j=inputOutArgs.get_DgDx(j)).isEmpty() ) {
1383  if ( DgDx_j.isSupportedBy(supports(OUT_ARG_DgDx,j)) || !ignoreUnsupported )
1384  set_DgDx(j,DgDx_j);
1385  }
1386  }
1387  for ( int j = 0; j < min_Ng; ++j ) {
1388  // DgDx_dot(j)
1389  MEB::MPDerivative DgDx_dot_mp_j;
1390  if ( !inputOutArgs.supports(OUT_ARG_DgDx_dot_mp,j).none()
1391  && !(DgDx_dot_mp_j=inputOutArgs.get_DgDx_dot_mp(j)).isEmpty() )
1392  {
1393  if( DgDx_dot_mp_j.isSupportedBy(supports(OUT_ARG_DgDx_dot_mp,j)) || !ignoreUnsupported )
1394  set_DgDx_dot_mp(j,DgDx_dot_mp_j);
1395  }
1396  // DgDx(j)
1397  MEB::MPDerivative DgDx_mp_j;
1398  if ( !inputOutArgs.supports(OUT_ARG_DgDx_mp,j).none()
1399  && !(DgDx_mp_j=inputOutArgs.get_DgDx_mp(j)).isEmpty() ) {
1400  if ( DgDx_mp_j.isSupportedBy(supports(OUT_ARG_DgDx_mp,j)) || !ignoreUnsupported )
1401  set_DgDx_mp(j,DgDx_mp_j);
1402  }
1403  }
1404  // DgDp(j,l)
1405  for ( int l = 0; l < min_Np; ++l ) {
1406  for ( int j = 0; j < min_Ng; ++j ) {
1407  MEB::Derivative<Scalar> DgDp_j_l;
1408  if ( !inputOutArgs.supports(OUT_ARG_DgDp,j,l).none()
1409  && !(DgDp_j_l=inputOutArgs.get_DgDp(j,l)).isEmpty() )
1410  {
1411  if ( DgDp_j_l.isSupportedBy(supports(OUT_ARG_DgDp,j,l)) || !ignoreUnsupported )
1412  set_DgDp(j,l,DgDp_j_l);
1413  }
1414  }
1415  }
1416  for ( int l = 0; l < min_Np; ++l ) {
1417  for ( int j = 0; j < min_Ng; ++j ) {
1418  MEB::MPDerivative DgDp_mp_j_l;
1419  if ( !inputOutArgs.supports(OUT_ARG_DgDp_mp,j,l).none()
1420  && !(DgDp_mp_j_l=inputOutArgs.get_DgDp_mp(j,l)).isEmpty() )
1421  {
1422  if ( DgDp_mp_j_l.isSupportedBy(supports(OUT_ARG_DgDp_mp,j,l)) || !ignoreUnsupported )
1423  set_DgDp_mp(j,l,DgDp_mp_j_l);
1424  }
1425  }
1426  }
1427  // Extended outArgs
1428  this->extended_outargs_ = inputOutArgs.extended_outargs_;
1429 
1430  // ToDo: Add more args as needed!
1431 }
1432 
1433 
1434 template<class Scalar>
1436 {
1437  typedef Teuchos::ScalarTraits<Scalar> ST;
1438  isFailed_ = true;
1439  if( this->supports(OUT_ARG_f) && nonnull(this->get_f()) ) {
1440  assign(this->get_f().ptr(),ST::nan());
1441  }
1442  for( int j = 0; j < this->Ng(); ++j ) {
1443  if (nonnull(this->get_g(j)))
1444  assign(this->get_g(j).ptr(),ST::nan());
1445  }
1446  // ToDo: Set other objects to NaN as well!
1447 }
1448 
1449 
1450 template<class Scalar>
1452 {
1453  return isFailed_;
1454 }
1455 
1456 
1457 template<class Scalar>
1459 {
1460  if (!is_null(f_))
1461  return false;
1462  if (!is_null(W_))
1463  return false;
1464  if (!is_null(W_op_))
1465  return false;
1466  for ( int l = 0; l < Np(); ++l ) {
1467  if (!DfDp_[l].isEmpty())
1468  return false;
1469  }
1470 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1471  if (!is_null(f_poly_))
1472  return false;
1473 #endif // HAVE_THYRA_ME_POLYNOMIAL
1474  for ( int j = 0; j < Ng(); ++j ) {
1475  if (!is_null(g_[j]))
1476  return false;
1477  if (!DgDx_dot_[j].isEmpty())
1478  return false;
1479  if (!DgDx_[j].isEmpty())
1480  return false;
1481  for ( int l = 0; l < Np(); ++l ) {
1482  if (!DgDp_[j*Np()+l].isEmpty())
1483  return false;
1484  }
1485  }
1486  return true;
1487 }
1488 
1489 
1490 template<class Scalar>
1492  const OutArgs<Scalar> &outArgs
1493  ) const
1494 {
1495 
1496  for ( int outArg_i = 0; outArg_i < NUM_E_OUT_ARGS_MEMBERS; ++outArg_i ) {
1497  const EOutArgsMembers outArg_arg = static_cast<EOutArgsMembers>(outArg_i);
1498  const std::string outArg_name = toString(outArg_arg);
1500  supports(outArg_arg) != outArgs.supports(outArg_arg), std::logic_error,
1501  "Error, the output argument "<<outArg_name<<" with support "<<outArgs.supports(outArg_arg)<<"\n"
1502  "in the OutArgs object for the model:\n\n"
1503  " "<<outArgs.modelEvalDescription()<<"\n\n"
1504  "is not the same the argument "<<outArg_name<<" with support "<<supports(outArg_arg)<<"\n"
1505  "in the OutArgs object for the model:\n\n"
1506  " "<<modelEvalDescription()<<"\n\n"
1507  "and these two OutArgs objects are not compatible!"
1508  );
1509  }
1510 
1511  const int l_Np = this->Np();
1512  const int l_Ng = this->Ng();
1513  TEUCHOS_ASSERT_EQUALITY( l_Np, outArgs.Np() );
1514  TEUCHOS_ASSERT_EQUALITY( l_Ng, outArgs.Ng() );
1515 
1516  if (supports(OUT_ARG_f)) {
1517  for ( int l = 0; l < l_Np; ++l ) {
1519  !supports(OUT_ARG_DfDp,l).isSameSupport(outArgs.supports(OUT_ARG_DfDp,l)),
1520  std::logic_error,
1521  "Error, the support for DfDp("<<l<<") is not the same for the models\n\n"
1522  " "<<outArgs.modelEvalDescription()<<"\n\n"
1523  "and:\n\n"
1524  " "<<modelEvalDescription()<<"\n\n"
1525  "and these two OutArgs objects are not compatible!"
1526  );
1527  }
1528  }
1529 
1530  for ( int j = 0; j < l_Ng; ++j ) {
1532  !supports(OUT_ARG_DgDx_dot,j).isSameSupport(outArgs.supports(OUT_ARG_DgDx_dot,j)),
1533  std::logic_error,
1534  "Error, the support for DgDx_dot("<<j<<") is not the same for the models\n\n"
1535  " "<<outArgs.modelEvalDescription()<<"\n\n"
1536  "and:\n\n"
1537  " "<<modelEvalDescription()<<"\n\n"
1538  "and these two OutArgs objects are not compatible!"
1539  );
1541  !supports(OUT_ARG_DgDx,j).isSameSupport(outArgs.supports(OUT_ARG_DgDx,j)),
1542  std::logic_error,
1543  "Error, the support for DgDx("<<j<<") is not the same for the models\n\n"
1544  " "<<outArgs.modelEvalDescription()<<"\n\n"
1545  "and:\n\n"
1546  " "<<modelEvalDescription()<<"\n\n"
1547  "and these two OutArgs objects are not compatible!"
1548  );
1549  for ( int l = 0; l < l_Np; ++l ) {
1551  !supports(OUT_ARG_DgDp,j,l).isSameSupport(outArgs.supports(OUT_ARG_DgDp,j,l)),
1552  std::logic_error,
1553  "Error, the support for DgDp("<<j<<","<<l<<") is not the same for the models\n\n"
1554  " "<<outArgs.modelEvalDescription()<<"\n\n"
1555  "and:\n\n"
1556  " "<<modelEvalDescription()<<"\n\n"
1557  "and these two OutArgs objects are not compatible!"
1558  );
1559  }
1560  }
1561 }
1562 
1563 
1564 template<class Scalar>
1566 {
1567  return modelEvalDescription_;
1568 }
1569 
1570 
1571 template<class Scalar>
1573 {
1574  typedef Teuchos::ScalarTraits<Scalar> ST;
1575  std::ostringstream oss;
1576  oss
1577  << "Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<">"
1578  << "{"
1579  << "model="<<modelEvalDescription_
1580  << ",Np="<<Np()
1581  << ",Ng="<<Ng()
1582  << "}";
1583  return oss.str();
1584 }
1585 
1586 
1587 template<class Scalar>
1589  Teuchos::FancyOStream &out_arg, const Teuchos::EVerbosityLevel verbLevel
1590  ) const
1591 {
1592 
1593  using Teuchos::OSTab;
1594  using Teuchos::describe;
1595  typedef Teuchos::ScalarTraits<Scalar> ST;
1596  typedef RCP<const VectorBase<Scalar> > CV_ptr;
1597  typedef RCP<const LinearOpBase<Scalar> > CLO_ptr;
1598  typedef RCP<const LinearOpWithSolveBase<Scalar> > CLOWS_ptr;
1599  typedef ModelEvaluatorBase MEB;
1600  typedef MEB::Derivative<Scalar> Deriv;
1601 
1602  if( verbLevel == Teuchos::VERB_NONE && verbLevel == Teuchos::VERB_DEFAULT )
1603  return;
1604 
1606  out = Teuchos::rcp(&out_arg,false);
1607  OSTab tab(out);
1608 
1609  *out <<"Thyra::ModelEvaluatorBase::OutArgs<"<<ST::name()<<">:\n";
1610  tab.incrTab();
1611 
1612  *out <<"model = " << modelEvalDescription_ << "\n";
1613  *out <<"Np = " << Np() << "\n";
1614  *out <<"Ng = " << Ng() << "\n";
1615 
1616  CV_ptr f;
1617  if (this->supports(OUT_ARG_f) && !is_null(f=get_f()) ) {
1618  *out << "f = " << Teuchos::describe(*f,verbLevel);
1619  }
1620 
1621  for( int j = 0; j < Ng(); ++j ) {
1622  CV_ptr g_j;
1623  if (!is_null(g_j=this->get_g(j)))
1624  *out << "g("<<j<<") = " << Teuchos::describe(*g_j,verbLevel);
1625  }
1626 
1627  CLOWS_ptr W;
1628  if ( this->supports(OUT_ARG_W) && !is_null(W=get_W()) ) {
1629  *out << "W = " << Teuchos::describe(*W,verbLevel);
1630  }
1631 
1632  CLO_ptr W_op;
1633  if ( this->supports(OUT_ARG_W_op) && !is_null(W_op=get_W_op()) ) {
1634  *out << "W_op = " << Teuchos::describe(*W_op,verbLevel);
1635  }
1636 
1637  for( int l = 0; l < Np(); ++l ) {
1638  Deriv DfDp_l;
1639  if (
1640  !this->supports(OUT_ARG_DfDp,l).none()
1641  && !(DfDp_l=get_DfDp(l)).isEmpty()
1642  )
1643  {
1644  *out << "DfDp("<<l<<") = ";
1645  DfDp_l.describe(*out,verbLevel);
1646  }
1647  }
1648 
1649  for( int j = 0; j < Ng(); ++j ) {
1650 
1651  Deriv DgDx_dot_j;
1652  if (
1653  !this->supports(OUT_ARG_DgDx_dot,j).none()
1654  && !(DgDx_dot_j=get_DgDx_dot(j)).isEmpty()
1655  )
1656  {
1657  *out << "DgDx_dot("<<j<<") = ";
1658  DgDx_dot_j.describe(*out,verbLevel);
1659  }
1660 
1661  Deriv DgDx_j;
1662  if (
1663  !this->supports(OUT_ARG_DgDx,j).none()
1664  && !(DgDx_j=get_DgDx(j)).isEmpty()
1665  )
1666  {
1667  *out << "DgDx("<<j<<") = ";
1668  DgDx_j.describe(*out,verbLevel);
1669  }
1670 
1671  for( int l = 0; l < Np(); ++l ) {
1672 
1673  Deriv DgDp_j_l;
1674  if (
1675  !this->supports(OUT_ARG_DgDp,j,l).none()
1676  && !(DgDp_j_l=get_DgDp(j,l)).isEmpty()
1677  )
1678  {
1679  *out << "DgDp("<<j<<","<<l<<") = ";
1680  DgDp_j_l.describe(*out,verbLevel);
1681  }
1682  }
1683 
1684  }
1685 
1686  // ToDo: Add output for more objects?
1687 
1688 }
1689 
1690 
1691 // protected
1692 
1693 
1694 template<class Scalar>
1696  const std::string &modelEvalDescription_in
1697  )
1698 {
1699  modelEvalDescription_ = modelEvalDescription_in;
1700 }
1701 
1702 template<class Scalar>
1704 {
1705  if(Np_in) {
1706  supports_DfDp_.resize(Np_in);
1707  DfDp_.resize(Np_in); std::fill_n(DfDp_.begin(),Np_in,Derivative<Scalar>());
1708  DfDp_properties_.resize(Np_in); std::fill_n(DfDp_properties_.begin(),Np_in,DerivativeProperties());
1709 
1710  supports_DfDp_mp_.resize(Np_in);
1711  DfDp_mp_.resize(Np_in); std::fill_n(DfDp_mp_.begin(),Np_in,MPDerivative());
1712  DfDp_mp_properties_.resize(Np_in); std::fill_n(DfDp_mp_properties_.begin(),Np_in,DerivativeProperties());
1713  }
1714  if(Ng_in) {
1715  g_.resize(Ng_in); std::fill_n(g_.begin(),Ng_in,Teuchos::null);
1716  supports_DgDx_dot_.resize(Ng_in);
1717  DgDx_dot_.resize(Ng_in); std::fill_n(DgDx_dot_.begin(),Ng_in,Derivative<Scalar>());
1718  DgDx_dot_properties_.resize(Ng_in); std::fill_n(DgDx_dot_properties_.begin(),Ng_in,DerivativeProperties());
1719  supports_DgDx_.resize(Ng_in);
1720  DgDx_.resize(Ng_in); std::fill_n(DgDx_.begin(),Ng_in,Derivative<Scalar>());
1721  DgDx_properties_.resize(Ng_in); std::fill_n(DgDx_properties_.begin(),Ng_in,DerivativeProperties());
1722 
1723  g_mp_.resize(Ng_in); std::fill_n(g_mp_.begin(),Ng_in,Teuchos::null);
1724  supports_g_mp_.resize(Ng_in);
1725  supports_DgDx_dot_mp_.resize(Ng_in);
1726  DgDx_dot_mp_.resize(Ng_in); std::fill_n(DgDx_dot_mp_.begin(),Ng_in,MPDerivative());
1727  DgDx_dot_mp_properties_.resize(Ng_in); std::fill_n(DgDx_dot_mp_properties_.begin(),Ng_in,DerivativeProperties());
1728  supports_DgDx_mp_.resize(Ng_in);
1729  DgDx_mp_.resize(Ng_in); std::fill_n(DgDx_mp_.begin(),Ng_in,MPDerivative());
1730  DgDx_mp_properties_.resize(Ng_in); std::fill_n(DgDx_mp_properties_.begin(),Ng_in,DerivativeProperties());
1731  }
1732  if(Np_in && Ng_in) {
1733  const int NpNg = Np_in*Ng_in;
1734  supports_DgDp_.resize(NpNg);
1735  DgDp_.resize(NpNg); std::fill_n(DgDp_.begin(),NpNg,Derivative<Scalar>());
1736  DgDp_properties_.resize(NpNg); std::fill_n(DgDp_properties_.begin(),NpNg,DerivativeProperties());
1737 
1738  supports_DgDp_mp_.resize(NpNg);
1739  DgDp_mp_.resize(NpNg); std::fill_n(DgDp_mp_.begin(),NpNg,MPDerivative());
1740  DgDp_mp_properties_.resize(NpNg); std::fill_n(DgDp_mp_properties_.begin(),NpNg,DerivativeProperties());
1741  }
1742 }
1743 
1744 
1745 template<class Scalar>
1747  EOutArgsMembers arg, bool supports_in )
1748 {
1750  int(arg)>=NUM_E_OUT_ARGS_MEMBERS || int(arg) < 0,std::logic_error
1751  ,"model = \'"<<modelEvalDescription_
1752  <<"\': Error, arg="<<toString(arg)<<" is invalid!"
1753  );
1754  supports_[arg] = supports_in;
1755 }
1756 
1757 
1758 template<class Scalar>
1760  EOutArgsDfDp /* arg */, int l, const DerivativeSupport& supports_in
1761  )
1762 {
1763  assert_supports(OUT_ARG_f);
1764  assert_l(l);
1765  supports_DfDp_[l] = supports_in;
1766 }
1767 
1768 
1769 template<class Scalar>
1771  EOutArgsDgDx_dot /* arg */, int j, const DerivativeSupport& supports_in
1772  )
1773 {
1774  assert_j(j);
1775  supports_DgDx_dot_[j] = supports_in;
1776 }
1777 
1778 
1779 template<class Scalar>
1781  EOutArgsDgDx /* arg */, int j, const DerivativeSupport& supports_in
1782  )
1783 {
1784  assert_j(j);
1785  supports_DgDx_[j] = supports_in;
1786 }
1787 
1788 
1789 template<class Scalar>
1791  EOutArgsDgDp /* arg */, int j, int l, const DerivativeSupport& supports_in
1792  )
1793 {
1794  assert_j(j);
1795  assert_l(l);
1796  supports_DgDp_[ j*Np()+ l ] = supports_in;
1797 }
1798 
1799 
1800 template<class Scalar>
1802  EOutArgs_g_mp /* arg */, int j, bool supports_in
1803  )
1804 {
1805  //assert_supports(OUT_ARG_g_mp,j);
1806  assert_j(j);
1807  supports_g_mp_[j] = supports_in;
1808 }
1809 
1810 
1811 template<class Scalar>
1813  EOutArgsDfDp_mp /* arg */, int l, const DerivativeSupport& supports_in
1814  )
1815 {
1816  assert_supports(OUT_ARG_f_mp); //JF this is not in epetraext ME
1817  assert_l(l);
1818  supports_DfDp_mp_[l] = supports_in;
1819 }
1820 
1821 
1822 template<class Scalar>
1824  EOutArgsDgDx_dot_mp /* arg */, int j, const DerivativeSupport& supports_in
1825  )
1826 {
1827  assert_j(j);
1828  supports_DgDx_dot_mp_[j] = supports_in;
1829 }
1830 
1831 
1832 template<class Scalar>
1834  EOutArgsDgDx_mp /* arg */, int j, const DerivativeSupport& supports_in
1835  )
1836 {
1837  assert_j(j);
1838  supports_DgDx_mp_[j] = supports_in;
1839 }
1840 
1841 
1842 template<class Scalar>
1844  EOutArgsDgDp_mp /* arg */, int j, int l, const DerivativeSupport& supports_in
1845  )
1846 {
1847  assert_j(j);
1848  assert_l(l);
1849  supports_DgDp_mp_[ j*Np()+ l ] = supports_in;
1850 }
1851 
1852 
1853 template<class Scalar>
1855  const DerivativeProperties &properties
1856  )
1857 {
1858  W_properties_ = properties;
1859 }
1860 
1861 
1862 template<class Scalar>
1864  int l, const DerivativeProperties &properties
1865  )
1866 {
1867  assert_supports(OUT_ARG_DfDp,l);
1868  DfDp_properties_[l] = properties;
1869 }
1870 
1871 
1872 template<class Scalar>
1874  int j, const DerivativeProperties &properties
1875  )
1876 {
1877  assert_supports(OUT_ARG_DgDx_dot,j);
1878  DgDx_dot_properties_[j] = properties;
1879 }
1880 
1881 
1882 template<class Scalar>
1884  int j, const DerivativeProperties &properties
1885  )
1886 {
1887  assert_supports(OUT_ARG_DgDx,j);
1888  DgDx_properties_[j] = properties;
1889 }
1890 
1891 
1892 template<class Scalar>
1894  int j, int l, const DerivativeProperties &properties
1895  )
1896 {
1897  assert_supports(OUT_ARG_DgDp,j,l);
1898  DgDp_properties_[ j*Np()+ l ] = properties;
1899 }
1900 
1901 
1902 template<class Scalar>
1904  int l, const DerivativeProperties &properties
1905  )
1906 {
1907  assert_supports(OUT_ARG_DfDp_mp,l);
1908  DfDp_mp_properties_[l] = properties;
1909 }
1910 
1911 
1912 template<class Scalar>
1914  int j, const DerivativeProperties &properties
1915  )
1916 {
1917  assert_supports(OUT_ARG_DgDx_dot_mp,j);
1918  DgDx_dot_mp_properties_[j] = properties;
1919 }
1920 
1921 
1922 template<class Scalar>
1923 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDx_mp_properties(
1924  int j, const DerivativeProperties &properties
1925  )
1926 {
1927  assert_supports(OUT_ARG_DgDx_mp,j);
1928  DgDx_mp_properties_[j] = properties;
1929 }
1930 
1931 
1932 template<class Scalar>
1933 void ModelEvaluatorBase::OutArgs<Scalar>::_set_DgDp_mp_properties(
1934  int j, int l, const DerivativeProperties &properties
1935  )
1936 {
1937  assert_supports(OUT_ARG_DgDp_mp,j,l);
1938  DgDp_mp_properties_[ j*Np()+ l ] = properties;
1939 }
1940 
1941 
1942 template<class Scalar>
1944  const OutArgs<Scalar>& inputOutArgs
1945  )
1946 {
1947  typedef ModelEvaluatorBase MEB;
1948  const int l_Np = TEUCHOS_MIN(this->Np(),inputOutArgs.Np());
1949  const int l_Ng = TEUCHOS_MIN(this->Ng(),inputOutArgs.Ng());
1950  std::copy(
1951  &inputOutArgs.supports_[0],
1952  &inputOutArgs.supports_[0] + NUM_E_OUT_ARGS_MEMBERS, &supports_[0] );
1953  for( int l = 0; l < l_Np; ++l ) {
1954  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DfDp,l);
1955  if (!ds.none()) {
1956  this->_setSupports(MEB::OUT_ARG_DfDp,l,ds);
1957  this->_set_DfDp_properties(l,inputOutArgs.get_DfDp_properties(l));
1958  }
1959  }
1960  for( int l = 0; l < l_Np; ++l ) {
1961  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DfDp_mp,l);
1962  if (!ds.none()) {
1963  this->_setSupports(MEB::OUT_ARG_DfDp_mp,l,ds);
1964  this->_set_DfDp_mp_properties(l,inputOutArgs.get_DfDp_mp_properties(l));
1965  }
1966  }
1967  for( int j = 0; j < l_Ng; ++j ) {
1968  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_dot,j);
1969  this->_setSupports(MEB::OUT_ARG_DgDx_dot,j,ds);
1970  if(!ds.none()) this->_set_DgDx_dot_properties(j,inputOutArgs.get_DgDx_dot_properties(j));
1971  }
1972  for( int j = 0; j < l_Ng; ++j ) {
1973  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_dot_mp,j);
1974  this->_setSupports(MEB::OUT_ARG_DgDx_dot_mp,j,ds);
1975  if(!ds.none()) this->_set_DgDx_dot_mp_properties(j,inputOutArgs.get_DgDx_dot_mp_properties(j));
1976  }
1977  for( int j = 0; j < l_Ng; ++j ) {
1978  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx,j);
1979  this->_setSupports(MEB::OUT_ARG_DgDx,j,ds);
1980  if(!ds.none()) this->_set_DgDx_properties(j,inputOutArgs.get_DgDx_properties(j));
1981  }
1982  for( int j = 0; j < l_Ng; ++j ) {
1983  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDx_mp,j);
1984  this->_setSupports(MEB::OUT_ARG_DgDx_mp,j,ds);
1985  if(!ds.none()) this->_set_DgDx_mp_properties(j,inputOutArgs.get_DgDx_mp_properties(j));
1986  }
1987  for( int j = 0; j < l_Ng; ++j ) for( int l = 0; l < l_Np; ++l ) {
1988  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDp,j,l);
1989  this->_setSupports(MEB::OUT_ARG_DgDp,j,l,ds);
1990  if(!ds.none()) this->_set_DgDp_properties(j,l,inputOutArgs.get_DgDp_properties(j,l));
1991  }
1992  for( int j = 0; j < l_Ng; ++j ) for( int l = 0; l < l_Np; ++l ) {
1993  DerivativeSupport ds = inputOutArgs.supports(MEB::OUT_ARG_DgDp_mp,j,l);
1994  this->_setSupports(MEB::OUT_ARG_DgDp_mp,j,l,ds);
1995  if(!ds.none()) this->_set_DgDp_mp_properties(j,l,inputOutArgs.get_DgDp_mp_properties(j,l));
1996  }
1997  if(this->supports(OUT_ARG_W) || this->supports(OUT_ARG_W_op))
1998  this->_set_W_properties(inputOutArgs.get_W_properties());
1999  if(this->supports(OUT_ARG_W_mp))
2000  this->_set_W_properties(inputOutArgs.get_W_properties()); //JF should this be W_mp_properties?
2001 
2002  extended_outargs_ = inputOutArgs.extended_outargs_;
2003 }
2004 
2005 
2006 template<class Scalar>
2008  EInArgsMembers arg
2009  )
2010 {
2011  switch(arg) {
2012  case IN_ARG_x: {
2013  const int l_Ng = this->Ng();
2014  for( int j = 0; j < l_Ng; ++j ) {
2015  this->_setSupports(OUT_ARG_DgDx_dot,j,DerivativeSupport());
2016  this->_setSupports(OUT_ARG_DgDx,j,DerivativeSupport());
2017  }
2018  break;
2019  }
2020  case IN_ARG_x_mp: {
2021  const int l_Ng = this->Ng();
2022  for( int j = 0; j < l_Ng; ++j ) {
2023  this->_setSupports(OUT_ARG_DgDx_dot_mp,j,DerivativeSupport());
2024  this->_setSupports(OUT_ARG_DgDx_mp,j,DerivativeSupport());
2025  }
2026  break;
2027  }
2028  default:
2030  true ,std::logic_error,
2031  "Error, can not handle args other than IN_ARG_x yet!"
2032  );
2033  }
2034 }
2035 
2036 
2037 template<class Scalar>
2039  EOutArgsMembers arg
2040  )
2041 {
2042  switch(arg) {
2043  case OUT_ARG_f: {
2044  this->_setSupports(OUT_ARG_W,false);
2045  this->_setSupports(OUT_ARG_W_op,false);
2046  this->_setSupports(OUT_ARG_f_poly,false);
2047  const int l_Np = this->Np();
2048  for( int l = 0; l < l_Np; ++l )
2049  this->_setSupports(OUT_ARG_DfDp,l,DerivativeSupport());
2050  break;
2051  }
2052  case OUT_ARG_f_mp: {
2053  this->_setSupports(OUT_ARG_W_mp,false);
2054  this->_setSupports(OUT_ARG_W_op,false);
2055  this->_setSupports(OUT_ARG_f_poly,false);
2056  const int l_Np = this->Np();
2057  for( int l = 0; l < l_Np; ++l )
2058  this->_setSupports(OUT_ARG_DfDp_mp,l,DerivativeSupport());
2059  break;
2060  }
2061  default:
2063  true ,std::logic_error,
2064  "Error, can not handle args other than OUT_ARG_f yet!"
2065  );
2066  }
2067  this->_setSupports(arg,false);
2068 }
2069 
2070 
2071 // private
2072 
2073 
2074 template<class Scalar>
2076 {
2078  !this->supports(arg), std::logic_error
2079  ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(arg):\n\n"
2080  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2081  "Error, The argument arg = " << toString(arg) << " is not supported!"
2082  );
2083 }
2084 
2085 
2086 template<class Scalar>
2088  EOutArgsDfDp arg, int l, const Derivative<Scalar> &deriv
2089  ) const
2090 {
2091  const DerivativeSupport derivSupport = this->supports(arg,l);
2093  !deriv.isSupportedBy(derivSupport), std::logic_error,
2094  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp,l):\n\n"
2095  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2096  "Error, The argument DfDp("<<l<<") = " << deriv.description() << "\n"
2097  "is not supported!\n\n"
2098  "The supported types include " << derivSupport.description() << "!"
2099  );
2100 }
2101 
2102 
2103 template<class Scalar>
2104 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2105  EOutArgsDgDx_dot arg, int j, const Derivative<Scalar> &deriv
2106  ) const
2107 {
2108  const DerivativeSupport derivSupport = this->supports(arg,j);
2110  !deriv.isSupportedBy(derivSupport), std::logic_error,
2111  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot,j):\n\n"
2112  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2113  "Error, The argument DgDx_dot("<<j<<") = " << deriv.description() << "\n"
2114  "is not supported!\n\n"
2115  "The supported types include " << derivSupport.description() << "!"
2116  );
2117 }
2118 
2119 
2120 template<class Scalar>
2121 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2122  EOutArgsDgDx arg, int j, const Derivative<Scalar> &deriv
2123  ) const
2124 {
2125  const DerivativeSupport derivSupport = this->supports(arg,j);
2127  !deriv.isSupportedBy(derivSupport), std::logic_error,
2128  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx,j):\n\n"
2129  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2130  "Error, The argument DgDx("<<j<<") = " << deriv.description() << "\n"
2131  "is not supported!\n\n"
2132  "The supported types include " << derivSupport.description() << "!"
2133  );
2134 }
2135 
2136 
2137 template<class Scalar>
2138 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2139  EOutArgsDgDp arg, int j, int l, const Derivative<Scalar> &deriv
2140  ) const
2141 {
2142  const DerivativeSupport derivSupport = this->supports(arg,j,l);
2144  !deriv.isSupportedBy(derivSupport), std::logic_error,
2145  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp,j,l):\n\n"
2146  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2147  "Error, The argument DgDp("<<j<<","<<l<<") = " << deriv.description() << "\n"
2148  "is not supported!\n\n"
2149  "The supported types include " << derivSupport.description() << "!"
2150  );
2151 }
2152 
2153 
2154 template<class Scalar>
2155 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2156  EOutArgs_g_mp /* arg */, int j
2157  ) const
2158 {
2159  assert_j(j);
2161  !supports_g_mp_[j], std::logic_error,
2162  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_g_mp,j):\n\n"
2163  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2164  "Error, The argument g_mp("<<j<<") \n"
2165  "is not supported!\n\n"
2166  );
2167 }
2168 
2169 
2170 template<class Scalar>
2171 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2172  EOutArgsDfDp_mp arg, int l, const MPDerivative &deriv
2173  ) const
2174 {
2175  const DerivativeSupport derivSupport = this->supports(arg,l);
2177  !deriv.isSupportedBy(derivSupport), std::logic_error,
2178  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DfDp_mp,l):\n\n"
2179  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2180  "Error, The argument DfDp_mp("<<l<<") = " << deriv.description() << "\n"
2181  "is not supported!\n\n"
2182  "The supported types include " << derivSupport.description() << "!"
2183  );
2184 }
2185 
2186 
2187 template<class Scalar>
2188 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2189  EOutArgsDgDx_dot_mp arg, int j, const MPDerivative &deriv
2190  ) const
2191 {
2192  const DerivativeSupport derivSupport = this->supports(arg,j);
2194  !deriv.isSupportedBy(derivSupport), std::logic_error,
2195  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_dot_mp,j):\n\n"
2196  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2197  "Error, The argument DgDx_dot_mp("<<j<<") = " << deriv.description() << "\n"
2198  "is not supported!\n\n"
2199  "The supported types include " << derivSupport.description() << "!"
2200  );
2201 }
2202 
2203 
2204 template<class Scalar>
2205 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2206  EOutArgsDgDx_mp arg, int j, const MPDerivative &deriv
2207  ) const
2208 {
2209  const DerivativeSupport derivSupport = this->supports(arg,j);
2211  !deriv.isSupportedBy(derivSupport), std::logic_error,
2212  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDx_mp,j):\n\n"
2213  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2214  "Error, The argument DgDx_mp("<<j<<") = " << deriv.description() << "\n"
2215  "is not supported!\n\n"
2216  "The supported types include " << derivSupport.description() << "!"
2217  );
2218 }
2219 
2220 
2221 template<class Scalar>
2222 void ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(
2223  EOutArgsDgDp_mp arg, int j, int l, const MPDerivative &deriv
2224  ) const
2225 {
2226  const DerivativeSupport derivSupport = this->supports(arg,j,l);
2228  !deriv.isSupportedBy(derivSupport), std::logic_error,
2229  "Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_supports(OUT_ARG_DgDp_mp,j,l):\n\n"
2230  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2231  "Error, The argument DgDp_mp("<<j<<","<<l<<") = " << deriv.description() << "\n"
2232  "is not supported!\n\n"
2233  "The supported types include " << derivSupport.description() << "!"
2234  );
2235 }
2236 
2237 
2238 template<class Scalar>
2239 void ModelEvaluatorBase::OutArgs<Scalar>::assert_l(int l) const
2240 {
2242  !( 0 <= l && l < Np() ), std::logic_error
2243  ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_l(l):\n\n"
2244  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2245  "Error, The parameter subvector p("<<l<<")"
2246  " is not in the range [0,"<<Np()<<")!"
2247  );
2248 }
2249 
2250 
2251 template<class Scalar>
2252 void ModelEvaluatorBase::OutArgs<Scalar>::assert_j(int j) const
2253 {
2255  !( 0 <= j && j < Ng() ), std::logic_error
2256  ,"Thyra::ModelEvaluatorBase::OutArgs<Scalar>::assert_j(j):\n\n"
2257  "model = \'"<<modelEvalDescription_<<"\':\n\n"
2258  "Error, The auxiliary function g("<<j<<")"
2259  " is not in the range [0,"<<Ng()<<")!"
2260  );
2261 }
2262 
2263 
2264 //
2265 // ModelEvaluatorBase::InArgsSetup
2266 //
2267 
2268 
2269 template<class Scalar>
2271 {}
2272 
2273 
2274 template<class Scalar>
2276  :InArgs<Scalar>(inArgs)
2277 {}
2278 
2279 
2280 template<class Scalar>
2282  const std::string &modelEvalDescription_in )
2283 {
2284  this->_setModelEvalDescription(modelEvalDescription_in);
2285 }
2286 
2287 
2288 template<class Scalar>
2290 { this->_set_Np(Np_in); }
2291 
2292 
2293 template<class Scalar>
2295 { this->_setSupports(arg,supports_in); }
2296 
2297 
2298 template<class Scalar>
2299 void ModelEvaluatorBase::InArgsSetup<Scalar>::setSupports( EInArgs_p_mp arg, int l, bool supports_in )
2300 { this->_setSupports(arg,l,supports_in); }
2301 
2302 
2303 template<class Scalar>
2305  const InArgs<Scalar>& inArgs, const int Np_in
2306  )
2307 {
2308  this->_setSupports(inArgs, Np_in);
2309 }
2310 
2311 
2312 template<class Scalar>
2314  EInArgsMembers arg
2315  )
2316 {
2317  this->_setUnsupportsAndRelated(arg);
2318 }
2319 
2320 
2321 //
2322 // ModelEvaluatorBase::OutArgsSetup
2323 //
2324 
2325 
2326 template<class Scalar>
2328 {}
2329 
2330 
2331 template<class Scalar>
2333  const OutArgs<Scalar>& inputOutArgs
2334  )
2335  :OutArgs<Scalar>(inputOutArgs)
2336 {}
2337 
2338 
2339 template<class Scalar>
2341  const std::string &modelEvalDescription_in
2342  )
2343 { this->_setModelEvalDescription(modelEvalDescription_in); }
2344 
2345 
2346 template<class Scalar>
2348 { this->_set_Np_Ng(Np_in, Ng_in); }
2349 
2350 
2351 template<class Scalar>
2353  EOutArgsMembers arg, bool supports_in
2354  )
2355 { this->_setSupports(arg,supports_in); }
2356 
2357 
2358 template<class Scalar>
2360  EOutArgsDfDp arg, int l, const DerivativeSupport& supports_in
2361  )
2362 { this->_setSupports(arg,l,supports_in); }
2363 
2364 
2365 template<class Scalar>
2367  EOutArgsDgDx_dot arg, int j, const DerivativeSupport& supports_in
2368  )
2369 { this->_setSupports(arg,j,supports_in); }
2370 
2371 
2372 template<class Scalar>
2374  EOutArgsDgDx arg, int j, const DerivativeSupport& supports_in
2375  )
2376 { this->_setSupports(arg,j,supports_in); }
2377 
2378 
2379 template<class Scalar>
2381  EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports_in
2382  )
2383 { this->_setSupports(arg,j,l,supports_in); }
2384 
2385 
2386 template<class Scalar>
2388  EOutArgs_g_mp arg, int j, bool supports_in
2389  )
2390 { this->_setSupports(arg,j,supports_in); }
2391 
2392 
2393 template<class Scalar>
2395  EOutArgsDfDp_mp arg, int l, const DerivativeSupport& supports_in
2396  )
2397 { this->_setSupports(arg,l,supports_in); }
2398 
2399 
2400 template<class Scalar>
2402  EOutArgsDgDx_dot_mp arg, int j, const DerivativeSupport& supports_in
2403  )
2404 { this->_setSupports(arg,j,supports_in); }
2405 
2406 
2407 template<class Scalar>
2409  EOutArgsDgDx_mp arg, int j, const DerivativeSupport& supports_in
2410  )
2411 { this->_setSupports(arg,j,supports_in); }
2412 
2413 
2414 template<class Scalar>
2416  EOutArgsDgDp_mp arg, int j, int l, const DerivativeSupport& supports_in
2417  )
2418 { this->_setSupports(arg,j,l,supports_in); }
2419 
2420 
2421 template<class Scalar>
2423  const DerivativeProperties &properties
2424  )
2425 { this->_set_W_properties(properties); }
2426 
2427 
2428 template<class Scalar>
2430  int l, const DerivativeProperties &properties
2431  )
2432 { this->_set_DfDp_properties(l,properties); }
2433 
2434 
2435 template<class Scalar>
2437  int j, const DerivativeProperties &properties
2438  )
2439 { this->_set_DgDx_dot_properties(j,properties); }
2440 
2441 
2442 template<class Scalar>
2444  int j, const DerivativeProperties &properties
2445  )
2446 { this->_set_DgDx_properties(j,properties); }
2447 
2448 
2449 template<class Scalar>
2451  int j, int l, const DerivativeProperties &properties
2452  )
2453 { this->_set_DgDp_properties(j,l,properties); }
2454 
2455 
2456 template<class Scalar>
2458  int l, const DerivativeProperties &properties
2459  )
2460 { this->_set_DfDp_mp_properties(l,properties); }
2461 
2462 
2463 template<class Scalar>
2465  int j, const DerivativeProperties &properties
2466  )
2467 { this->_set_DgDx_dot_mp_properties(j,properties); }
2468 
2469 
2470 template<class Scalar>
2471 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDx_mp_properties(
2472  int j, const DerivativeProperties &properties
2473  )
2474 { this->_set_DgDx_mp_properties(j,properties); }
2475 
2476 
2477 template<class Scalar>
2478 void ModelEvaluatorBase::OutArgsSetup<Scalar>::set_DgDp_mp_properties(
2479  int j, int l, const DerivativeProperties &properties
2480  )
2481 { this->_set_DgDp_mp_properties(j,l,properties); }
2482 
2483 
2484 template<class Scalar>
2486  const OutArgs<Scalar>& inputOutArgs
2487  )
2488 { this->_setSupports(inputOutArgs); }
2489 
2490 
2491 template<class Scalar>
2493  EInArgsMembers arg
2494  )
2495 { this->_setUnsupportsAndRelated(arg); }
2496 
2497 
2498 template<class Scalar>
2500  EOutArgsMembers arg
2501  )
2502 { this->_setUnsupportsAndRelated(arg); }
2503 
2504 
2505 } // namespace Thyra
2506 
2507 
2508 
2509 //
2510 // Explicit instantiation macro
2511 //
2512 // Must be expanded from within the Thyra namespace!
2513 //
2514 
2515 
2516 #define THYRA_MODEL_EVALUATOR_BASE_INSTANT(SCALAR) \
2517  \
2518  template class ModelEvaluatorBase::InArgs<SCALAR >; \
2519  \
2520  template std::string \
2521  ModelEvaluatorBase::Derivative<SCALAR >::description() const; \
2522  \
2523  template \
2524  void ModelEvaluatorBase::Derivative<SCALAR >::describe( \
2525  Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel \
2526  ) const; \
2527  \
2528  template class ModelEvaluatorBase::OutArgs<SCALAR >; \
2529  \
2530  template class ModelEvaluatorBase::InArgsSetup<SCALAR >; \
2531  \
2532  template class ModelEvaluatorBase::OutArgsSetup<SCALAR >;
2533 
2534 
2535 #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< 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)
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 _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_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.
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_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.
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 VectorBase< Scalar > > get_x_dot_dot() const
Precondition: supports(IN_ARG_x_dot_dot)==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.
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...