Thyra Package Browser (Single Doxygen Collection)  Version of the Day
Thyra_EpetraModelEvaluator.cpp
Go to the documentation of this file.
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 
43 #include "Thyra_LinearOpWithSolveFactoryHelpers.hpp"
45 #include "Thyra_EpetraLinearOp.hpp"
46 #include "Thyra_DetachedMultiVectorView.hpp"
47 #include "Thyra_ModelEvaluatorDelegatorBase.hpp" // Gives verbose macros!
48 #include "EpetraExt_ModelEvaluatorScalingTools.h"
49 #include "Epetra_RowMatrix.h"
50 #include "Teuchos_Time.hpp"
51 #include "Teuchos_implicit_cast.hpp"
52 #include "Teuchos_Assert.hpp"
53 #include "Teuchos_StandardParameterEntryValidators.hpp"
54 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
55 
56 
57 namespace {
58 
59 
60 const std::string StateFunctionScaling_name = "State Function Scaling";
61 Teuchos::RCP<
62  Teuchos::StringToIntegralParameterEntryValidator<
64  >
65  >
66 stateFunctionScalingValidator;
67 const std::string StateFunctionScaling_default = "None";
68 
69 
70 // Extract out the Epetra_RowMatrix from the set W in an Epetra OutArgs object
71 Teuchos::RCP<Epetra_RowMatrix>
72 get_Epetra_RowMatrix(
73  const EpetraExt::ModelEvaluator::OutArgs &epetraOutArgs
74  )
75 {
76  using Teuchos::RCP;
77  const RCP<Epetra_Operator>
78  eW = epetraOutArgs.get_W();
79  const RCP<Epetra_RowMatrix>
80  ermW = Teuchos::rcp_dynamic_cast<Epetra_RowMatrix>(eW,false);
81  TEUCHOS_TEST_FOR_EXCEPTION(
82  is_null(ermW), std::logic_error,
83  "Thyra::EpetraModelEvaluator::evalModel(...): Error, if\n"
84  "scaling is turned on, the underlying Epetra_Operator created\n"
85  "an initialized by the underlying epetra model evaluator\n"
86  "\"" << epetraOutArgs.modelEvalDescription() << "\"\n"
87  "must support the Epetra_RowMatrix interface through a dynamic cast.\n"
88  "The concrete type " << Teuchos::typeName(*eW) << " does not support\n"
89  "Epetra_RowMatrix!"
90  );
91  return ermW;
92 }
93 
94 
95 Teuchos::RCP<Epetra_Operator>
96 create_and_assert_W(
97  const EpetraExt::ModelEvaluator &epetraModel
98  )
99 {
100  using Teuchos::RCP;
101  RCP<Epetra_Operator>
102  eW = epetraModel.create_W();
103  TEUCHOS_TEST_FOR_EXCEPTION(
104  is_null(eW), std::logic_error,
105  "Error, the call to create_W() returned null on the "
106  "EpetraExt::ModelEvaluator object "
107  "\"" << epetraModel.description() << "\". This may mean that "
108  "the underlying model does not support more than one copy of "
109  "W at one time!" );
110  return eW;
111 }
112 
113 
114 } // namespace
115 
116 
117 namespace Thyra {
118 
119 
120 // Constructors/initializers/accessors.
121 
122 
124  :nominalValuesAndBoundsAreUpdated_(false), stateFunctionScaling_(STATE_FUNC_SCALING_NONE),
125  currentInArgsOutArgs_(false), finalPointWasSolved_(false)
126 {}
127 
128 
130  const RCP<const EpetraExt::ModelEvaluator> &epetraModel,
131  const RCP<LinearOpWithSolveFactoryBase<double> > &W_factory
132  )
133  :nominalValuesAndBoundsAreUpdated_(false), stateFunctionScaling_(STATE_FUNC_SCALING_NONE),
134  currentInArgsOutArgs_(false), finalPointWasSolved_(false)
135 {
136  initialize(epetraModel,W_factory);
137 }
138 
139 
141  const RCP<const EpetraExt::ModelEvaluator> &epetraModel,
142  const RCP<LinearOpWithSolveFactoryBase<double> > &W_factory
143  )
144 {
145  using Teuchos::implicit_cast;
146  //typedef ModelEvaluatorBase MEB; // unused
147  //
148  epetraModel_ = epetraModel;
149  //
150  W_factory_ = W_factory;
151  //
152  x_map_ = epetraModel_->get_x_map();
153  f_map_ = epetraModel_->get_f_map();
154  if (!is_null(x_map_)) {
157  }
158  //
159  EpetraExt::ModelEvaluator::InArgs inArgs = epetraModel_->createInArgs();
160  p_map_.resize(inArgs.Np()); p_space_.resize(inArgs.Np());
161  p_map_is_local_.resize(inArgs.Np(),false);
162  for( int l = 0; l < implicit_cast<int>(p_space_.size()); ++l ) {
163  RCP<const Epetra_Map>
164  p_map_l = ( p_map_[l] = epetraModel_->get_p_map(l) );
165 #ifdef TEUCHOS_DEBUG
166  TEUCHOS_TEST_FOR_EXCEPTION(
167  is_null(p_map_l), std::logic_error,
168  "Error, the the map p["<<l<<"] for the model \""
169  <<epetraModel->description()<<"\" can not be null!");
170 #endif
171 
172  p_map_is_local_[l] = !p_map_l->DistributedGlobal();
173  p_space_[l] = create_VectorSpace(p_map_l);
174  }
175  //
176  EpetraExt::ModelEvaluator::OutArgs outArgs = epetraModel_->createOutArgs();
177  g_map_.resize(outArgs.Ng()); g_space_.resize(outArgs.Ng());
178  g_map_is_local_.resize(outArgs.Ng(),false);
179  for( int j = 0; j < implicit_cast<int>(g_space_.size()); ++j ) {
180  RCP<const Epetra_Map>
181  g_map_j = ( g_map_[j] = epetraModel_->get_g_map(j) );
182  g_map_is_local_[j] = !g_map_j->DistributedGlobal();
183  g_space_[j] = create_VectorSpace( g_map_j );
184  }
185  //
186  epetraInArgsScaling_ = epetraModel_->createInArgs();
187  epetraOutArgsScaling_ = epetraModel_->createOutArgs();
189  finalPointWasSolved_ = false;
190  stateFunctionScalingVec_ = Teuchos::null; // Must set new scaling!
191  //
192  currentInArgsOutArgs_ = false;
193 }
194 
195 
196 RCP<const EpetraExt::ModelEvaluator>
198 {
199  return epetraModel_;
200 }
201 
202 
204  const ModelEvaluatorBase::InArgs<double>& nominalValues
205  )
206 {
207  nominalValues_.setArgs(nominalValues);
208  // Note: These must be the scaled values so we don't need to scale!
209 }
210 
211 
213  const RCP<const Epetra_Vector> &stateVariableScalingVec
214  )
215 {
216 #ifdef TEUCHOS_DEBUG
217  typedef ModelEvaluatorBase MEB;
218  TEUCHOS_TEST_FOR_EXCEPT( !this->createInArgs().supports(MEB::IN_ARG_x) );
219 #endif
220  stateVariableScalingVec_ = stateVariableScalingVec.assert_not_null();
221  invStateVariableScalingVec_ = Teuchos::null;
223 }
224 
225 
226 RCP<const Epetra_Vector>
228 {
230 }
231 
232 
233 RCP<const Epetra_Vector>
235 {
238 }
239 
240 
242  const RCP<const Epetra_Vector> &stateFunctionScalingVec
243  )
244 {
245  stateFunctionScalingVec_ = stateFunctionScalingVec;
246 }
247 
248 
249 RCP<const Epetra_Vector>
251 {
253 }
254 
255 
257  RCP<const EpetraExt::ModelEvaluator> *epetraModel,
258  RCP<LinearOpWithSolveFactoryBase<double> > *W_factory
259  )
260 {
261  if(epetraModel) *epetraModel = epetraModel_;
262  if(W_factory) *W_factory = W_factory_;
263  epetraModel_ = Teuchos::null;
264  W_factory_ = Teuchos::null;
265  stateFunctionScalingVec_ = Teuchos::null;
266  stateVariableScalingVec_ = Teuchos::null;
267  invStateVariableScalingVec_ = Teuchos::null;
268  currentInArgsOutArgs_ = false;
269 }
270 
271 
272 const ModelEvaluatorBase::InArgs<double>&
274 {
275  return finalPoint_;
276 }
277 
278 
280 {
281  return finalPointWasSolved_;
282 }
283 
284 
285 // Public functions overridden from Teuchos::Describable
286 
287 
289 {
290  std::ostringstream oss;
291  oss << "Thyra::EpetraModelEvaluator{";
292  oss << "epetraModel=";
293  if(epetraModel_.get())
294  oss << "\'"<<epetraModel_->description()<<"\'";
295  else
296  oss << "NULL";
297  oss << ",W_factory=";
298  if(W_factory_.get())
299  oss << "\'"<<W_factory_->description()<<"\'";
300  else
301  oss << "NULL";
302  oss << "}";
303  return oss.str();
304 }
305 
306 
307 // Overridden from Teuchos::ParameterListAcceptor
308 
309 
311  RCP<Teuchos::ParameterList> const& paramList
312  )
313 {
314  TEUCHOS_TEST_FOR_EXCEPT(is_null(paramList));
315  paramList->validateParameters(*getValidParameters(),0); // Just validate my params
316  paramList_ = paramList;
317  const EStateFunctionScaling stateFunctionScaling_old = stateFunctionScaling_;
318  stateFunctionScaling_ = stateFunctionScalingValidator->getIntegralValue(
319  *paramList_, StateFunctionScaling_name, StateFunctionScaling_default
320  );
321  if( stateFunctionScaling_ != stateFunctionScaling_old )
322  stateFunctionScalingVec_ = Teuchos::null;
323  Teuchos::readVerboseObjectSublist(&*paramList_,this);
324 #ifdef TEUCHOS_DEBUG
325  paramList_->validateParameters(*getValidParameters(),0);
326 #endif // TEUCHOS_DEBUG
327 }
328 
329 
330 RCP<Teuchos::ParameterList>
332 {
333  return paramList_;
334 }
335 
336 
337 RCP<Teuchos::ParameterList>
339 {
340  RCP<Teuchos::ParameterList> _paramList = paramList_;
341  paramList_ = Teuchos::null;
342  return _paramList;
343 }
344 
345 
346 RCP<const Teuchos::ParameterList>
348 {
349  return paramList_;
350 }
351 
352 
353 RCP<const Teuchos::ParameterList>
355 {
356  using Teuchos::rcp;
357  using Teuchos::StringToIntegralParameterEntryValidator;
358  using Teuchos::tuple;
359  using Teuchos::rcp_implicit_cast;
360  typedef Teuchos::ParameterEntryValidator PEV;
361  static RCP<const Teuchos::ParameterList> validPL;
362  if(is_null(validPL)) {
363  RCP<Teuchos::ParameterList>
364  pl = Teuchos::rcp(new Teuchos::ParameterList());
365  stateFunctionScalingValidator = rcp(
366  new StringToIntegralParameterEntryValidator<EStateFunctionScaling>(
367  tuple<std::string>(
368  "None",
369  "Row Sum"
370  ),
371  tuple<std::string>(
372  "Do not scale the state function f(...) in this class.",
373 
374  "Scale the state function f(...) and all its derivatives\n"
375  "using the row sum scaling from the initial Jacobian\n"
376  "W=d(f)/d(x). Note, this only works with Epetra_CrsMatrix\n"
377  "currently."
378  ),
379  tuple<EStateFunctionScaling>(
382  ),
383  StateFunctionScaling_name
384  )
385  );
386  pl->set(StateFunctionScaling_name,StateFunctionScaling_default,
387  "Determines if and how the state function f(...) and all of its\n"
388  "derivatives are scaled. The scaling is done explicitly so there should\n"
389  "be no impact on the meaning of inner products or tolerances for\n"
390  "linear solves.",
391  rcp_implicit_cast<const PEV>(stateFunctionScalingValidator)
392  );
393  Teuchos::setupVerboseObjectSublist(&*pl);
394  validPL = pl;
395  }
396  return validPL;
397 }
398 
399 
400 // Overridden from ModelEvaulator.
401 
402 
404 {
405  return p_space_.size();
406 }
407 
408 
410 {
411  return g_space_.size();
412 }
413 
414 
415 RCP<const VectorSpaceBase<double> >
417 {
418  return x_space_;
419 }
420 
421 
422 RCP<const VectorSpaceBase<double> >
424 {
425  return f_space_;
426 }
427 
428 
429 RCP<const VectorSpaceBase<double> >
431 {
432 #ifdef TEUCHOS_DEBUG
433  TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( l, 0, this->Np() );
434 #endif
435  return p_space_[l];
436 }
437 
438 
439 RCP<const Teuchos::Array<std::string> >
441 {
442 #ifdef TEUCHOS_DEBUG
443  TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( l, 0, this->Np() );
444 #endif
445  return epetraModel_->get_p_names(l);
446 }
447 
448 
449 RCP<const VectorSpaceBase<double> >
451 {
452  TEUCHOS_TEST_FOR_EXCEPT( ! ( 0 <= j && j < this->Ng() ) );
453  return g_space_[j];
454 }
455 
456 
457 Teuchos::ArrayView<const std::string>
459 {
460 #ifdef TEUCHOS_DEBUG
461  TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE( j, 0, this->Ng() );
462 #endif
463  return epetraModel_->get_g_names(j);
464 }
465 
466 
467 ModelEvaluatorBase::InArgs<double>
469 {
471  return nominalValues_;
472 }
473 
474 
475 ModelEvaluatorBase::InArgs<double>
477 {
479  return lowerBounds_;
480 }
481 
482 
483 ModelEvaluatorBase::InArgs<double>
485 {
487  return upperBounds_;
488 }
489 
490 
491 RCP<LinearOpBase<double> >
493 {
494  return this->create_epetra_W_op();
495 }
496 
497 
498 RCP<PreconditionerBase<double> >
500 {
501  return Teuchos::null;
502 }
503 
504 
505 RCP<const LinearOpWithSolveFactoryBase<double> >
507 {
508  return W_factory_;
509 }
510 
511 
512 ModelEvaluatorBase::InArgs<double> EpetraModelEvaluator::createInArgs() const
513 {
516  return prototypeInArgs_;
517 }
518 
519 
521  const ModelEvaluatorBase::InArgs<double> &finalPoint,
522  const bool wasSolved
523  )
524 {
525  finalPoint_ = this->createInArgs();
526  finalPoint_.setArgs(finalPoint);
527  finalPointWasSolved_ = wasSolved;
528 }
529 
530 
531 // Private functions overridden from ModelEvaulatorDefaultBase
532 
533 
534 RCP<LinearOpBase<double> >
536 {
537  TEUCHOS_TEST_FOR_EXCEPT(true);
538  return Teuchos::null;
539 }
540 
541 
542 RCP<LinearOpBase<double> >
544 {
545  TEUCHOS_TEST_FOR_EXCEPT(true);
546  return Teuchos::null;
547 }
548 
549 
550 RCP<LinearOpBase<double> >
552 {
553  TEUCHOS_TEST_FOR_EXCEPT(true);
554  return Teuchos::null;
555 }
556 
557 
558 RCP<LinearOpBase<double> >
560 {
561  TEUCHOS_TEST_FOR_EXCEPT(true);
562  return Teuchos::null;
563 }
564 
565 
566 ModelEvaluatorBase::OutArgs<double>
568 {
571  return prototypeOutArgs_;
572 }
573 
574 
576  const ModelEvaluatorBase::InArgs<double>& inArgs_in,
577  const ModelEvaluatorBase::OutArgs<double>& outArgs
578  ) const
579 {
580 
581  using Teuchos::rcp;
582  using Teuchos::rcp_const_cast;
583  using Teuchos::rcp_dynamic_cast;
584  using Teuchos::OSTab;
585  using Teuchos::includesVerbLevel;
586  typedef EpetraExt::ModelEvaluator EME;
587 
588  //
589  // A) Initial setup
590  //
591 
592  // Make sure that we are fully initialized!
594 
595  // Make sure we grab the initial guess first!
596  InArgs<double> inArgs = this->getNominalValues();
597  // Now, copy the parameters from the input inArgs_in object to the inArgs
598  // object. Any input objects that are set in inArgs_in will overwrite those
599  // in inArgs that will already contain the nominal values. This will insure
600  // that all input parameters are set and those that are not set by the
601  // client will be at their nominal values (as defined by the underlying
602  // EpetraExt::ModelEvaluator object). The full set of Thyra input arguments
603  // must be set before these can be translated into Epetra input arguments.
604  inArgs.setArgs(inArgs_in);
605 
606  // This is a special exception: see evalModel() in Thyra::ME
607  // documentation. If inArgs() supports x_dot but the evaluate call
608  // passes in a null value, then we need to make sure the null value
609  // gets passed on instead of the nominal value.
610  if (inArgs.supports(Thyra::ModelEvaluatorBase::IN_ARG_x_dot)) {
611  if (is_null(inArgs_in.get_x_dot()))
612  inArgs.set_x_dot(Teuchos::null);
613  }
614 
615  // Print the header and the values of the inArgs and outArgs objects!
616  typedef double Scalar; // Needed for below macro!
617  THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_GEN_BEGIN(
618  "Thyra::EpetraModelEvaluator",inArgs,outArgs,Teuchos::null
619  );
620 
621  // State function Scaling
622  const bool firstTimeStateFuncScaling
623  = (
625  && is_null(stateFunctionScalingVec_)
626  );
627 
628  typedef Teuchos::VerboseObjectTempState<LinearOpWithSolveFactoryBase<double> > VOTSLOWSF;
629  VOTSLOWSF W_factory_outputTempState(W_factory_,out,verbLevel);
630 
631  Teuchos::Time timer("");
632 
633  //
634  // B) Prepressess the InArgs and OutArgs in preparation to call
635  // the underlying EpetraExt::ModelEvaluator
636  //
637 
638  //
639  // B.1) Translate InArgs from Thyra to Epetra objects
640  //
641 
642  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
643  *out << "\nSetting-up/creating input arguments ...\n";
644  timer.start(true);
645 
646  // Unwrap input Thyra objects to get Epetra objects
647  EME::InArgs epetraScaledInArgs = epetraModel_->createInArgs();
648  convertInArgsFromThyraToEpetra( inArgs, &epetraScaledInArgs );
649 
650  // Unscale the input Epetra objects which will be passed to the underlying
651  // EpetraExt::ModelEvaluator object.
652  EME::InArgs epetraInArgs = epetraModel_->createInArgs();
653  EpetraExt::unscaleModelVars(
654  epetraScaledInArgs, epetraInArgsScaling_, &epetraInArgs,
655  out.get(), verbLevel
656  );
657 
658  timer.stop();
659  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
660  OSTab(out).o() << "\nTime to setup InArgs = "<<timer.totalElapsedTime()<<" sec\n";
661 
662  //
663  // B.2) Convert from Thyra to Epetra OutArgs
664  //
665 
666  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
667  *out << "\nSetting-up/creating output arguments ...\n";
668  timer.start(true);
669 
670  // The unscaled Epetra OutArgs that will be passed to the
671  // underlying EpetraExt::ModelEvaluator object
672  EME::OutArgs epetraUnscaledOutArgs = epetraModel_->createOutArgs();
673 
674  // Various objects that are needed later (see documentation in
675  // the function convertOutArgsFromThyraToEpetra(...)
676  RCP<LinearOpBase<double> > W_op;
677  RCP<EpetraLinearOp> efwdW;
678  RCP<Epetra_Operator> eW;
679 
680  // Convert from Thyra to Epetra OutArgs and grap some of the intermediate
681  // objects accessed along the way that are needed later.
683  outArgs,
684  &epetraUnscaledOutArgs,
685  &W_op, &efwdW, &eW
686  );
687 
688  //
689  // B.3) Setup OutArgs to computing scaling if needed
690  //
691 
692  if (firstTimeStateFuncScaling) {
693  preEvalScalingSetup(&epetraInArgs,&epetraUnscaledOutArgs,out,verbLevel);
694  }
695 
696  timer.stop();
697  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
698  OSTab(out).o()
699  << "\nTime to setup OutArgs = "
700  << timer.totalElapsedTime() <<" sec\n";
701 
702  //
703  // C) Evaluate the underlying EpetraExt model to compute the Epetra outputs
704  //
705 
706  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
707  *out << "\nEvaluating the Epetra output functions ...\n";
708  timer.start(true);
709 
710  epetraModel_->evalModel(epetraInArgs,epetraUnscaledOutArgs);
711 
712  timer.stop();
713  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
714  OSTab(out).o()
715  << "\nTime to evaluate Epetra output functions = "
716  << timer.totalElapsedTime() <<" sec\n";
717 
718  //
719  // D) Postprocess the output objects
720  //
721 
722  //
723  // D.1) Compute the scaling factors if needed
724  //
725 
726  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
727  *out << "\nCompute scale factors if needed ...\n";
728  timer.start(true);
729 
730  if (firstTimeStateFuncScaling) {
731  postEvalScalingSetup(epetraUnscaledOutArgs,out,verbLevel);
732  }
733 
734  timer.stop();
735  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
736  OSTab(out).o()
737  << "\nTime to compute scale factors = "
738  << timer.totalElapsedTime() <<" sec\n";
739 
740  //
741  // D.2) Scale the output Epetra objects
742  //
743 
744  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
745  *out << "\nScale the output objects ...\n";
746  timer.start(true);
747 
748  EME::OutArgs epetraOutArgs = epetraModel_->createOutArgs();
749  bool allFuncsWhereScaled = false;
750  EpetraExt::scaleModelFuncs(
751  epetraUnscaledOutArgs, epetraInArgsScaling_, epetraOutArgsScaling_,
752  &epetraOutArgs, &allFuncsWhereScaled,
753  out.get(), verbLevel
754  );
755  // AGS: This test precluded use of matrix-free Operators (vs. RowMatrix)
757  TEUCHOS_TEST_FOR_EXCEPTION(
758  !allFuncsWhereScaled, std::logic_error,
759  "Error, we can not currently handle epetra output objects that could not be"
760  " scaled. Special code will have to be added to handle this (i.e. using"
761  " implicit diagonal and multiplied linear operators to implicitly do"
762  " the scaling."
763  );
764 
765  timer.stop();
766  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
767  OSTab(out).o()
768  << "\nTime to scale the output objects = "
769  << timer.totalElapsedTime() << " sec\n";
770 
771  //
772  // D.3) Convert any Epetra objects to Thyra OutArgs objects that still need to
773  // be converted
774  //
775 
776  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
777  *out << "\nFinish processing and wrapping the output objects ...\n";
778  timer.start(true);
779 
781  epetraOutArgs, W_op, efwdW, eW,
782  outArgs
783  );
784 
785  timer.stop();
786  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW))
787  OSTab(out).o()
788  << "\nTime to finish processing and wrapping the output objects = "
789  << timer.totalElapsedTime() <<" sec\n";
790 
791  //
792  // E) Print footer to end the function
793  //
794 
795  THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_END();
796 
797 }
798 
799 
800 // private
801 
802 
804  const EpetraExt::ModelEvaluator::InArgs &epetraInArgs,
805  ModelEvaluatorBase::InArgs<double> *inArgs
806  ) const
807 {
808 
809  using Teuchos::implicit_cast;
810  typedef ModelEvaluatorBase MEB;
811 
812  TEUCHOS_TEST_FOR_EXCEPT(!inArgs);
813 
814  if(inArgs->supports(MEB::IN_ARG_x)) {
815  inArgs->set_x( create_Vector( epetraInArgs.get_x(), x_space_ ) );
816  }
817 
818  if(inArgs->supports(MEB::IN_ARG_x_dot)) {
819  inArgs->set_x_dot( create_Vector( epetraInArgs.get_x_dot(), x_space_ ) );
820  }
821 
822  if(inArgs->supports(MEB::IN_ARG_x_mp)) {
823  inArgs->set_x_mp( epetraInArgs.get_x_mp() );
824  }
825 
826  if(inArgs->supports(MEB::IN_ARG_x_dot_mp)) {
827  inArgs->set_x_dot_mp( epetraInArgs.get_x_dot_mp() );
828  }
829 
830  const int l_Np = inArgs->Np();
831  for( int l = 0; l < l_Np; ++l ) {
832  inArgs->set_p( l, create_Vector( epetraInArgs.get_p(l), p_space_[l] ) );
833  }
834  for( int l = 0; l < l_Np; ++l ) {
835  if(inArgs->supports(MEB::IN_ARG_p_mp, l))
836  inArgs->set_p_mp( l, epetraInArgs.get_p_mp(l) );
837  }
838 
839  if(inArgs->supports(MEB::IN_ARG_t)) {
840  inArgs->set_t(epetraInArgs.get_t());
841  }
842 
843 }
844 
845 
847  const ModelEvaluatorBase::InArgs<double> &inArgs,
848  EpetraExt::ModelEvaluator::InArgs *epetraInArgs
849  ) const
850 {
851 
852  using Teuchos::rcp;
853  using Teuchos::rcp_const_cast;
854 #ifdef HAVE_THYRA_ME_POLYNOMIAL
855  using Teuchos::Polynomial;
856 #endif // HAVE_THYRA_ME_POLYNOMIAL
857 
858 
859  TEUCHOS_TEST_FOR_EXCEPT(0==epetraInArgs);
860 
861  RCP<const VectorBase<double> > x_dot;
862  if( inArgs.supports(IN_ARG_x_dot) && (x_dot = inArgs.get_x_dot()).get() ) {
863  RCP<const Epetra_Vector> e_x_dot = get_Epetra_Vector(*x_map_,x_dot);
864  epetraInArgs->set_x_dot(e_x_dot);
865  }
866  RCP<const Stokhos::ProductEpetraVector > x_dot_mp;
867  if( inArgs.supports(IN_ARG_x_dot_mp) && (x_dot_mp = inArgs.get_x_dot_mp()).get() ) {
868  epetraInArgs->set_x_dot_mp(x_dot_mp);
869  }
870 
871  RCP<const VectorBase<double> > x;
872  if( inArgs.supports(IN_ARG_x) && (x = inArgs.get_x()).get() ) {
873  RCP<const Epetra_Vector> e_x = get_Epetra_Vector(*x_map_,x);
874  epetraInArgs->set_x(e_x);
875  }
876  RCP<const Stokhos::ProductEpetraVector > x_mp;
877  if( inArgs.supports(IN_ARG_x_mp) && (x_mp = inArgs.get_x_mp()).get() ) {
878  epetraInArgs->set_x_mp(x_mp);
879  }
880 
881  RCP<const VectorBase<double> > p_l;
882  for(int l = 0; l < inArgs.Np(); ++l ) {
883  p_l = inArgs.get_p(l);
884  if(p_l.get()) epetraInArgs->set_p(l,get_Epetra_Vector(*p_map_[l],p_l));
885  }
886  RCP<const Stokhos::ProductEpetraVector > p_mp_l;
887  for(int l = 0; l < inArgs.Np(); ++l ) {
888  if (inArgs.supports(IN_ARG_p_mp,l)) {
889  p_mp_l = inArgs.get_p_mp(l);
890  if(p_mp_l.get()) epetraInArgs->set_p_mp(l,p_mp_l);
891  }
892  }
893 
894 #ifdef HAVE_THYRA_ME_POLYNOMIAL
895 
896  RCP<const Polynomial< VectorBase<double> > > x_dot_poly;
897  RCP<Epetra_Vector> epetra_ptr;
898  if(
899  inArgs.supports(IN_ARG_x_dot_poly)
900  && (x_dot_poly = inArgs.get_x_dot_poly()).get()
901  )
902  {
903  RCP<Polynomial<Epetra_Vector> > epetra_x_dot_poly =
904  rcp(new Polynomial<Epetra_Vector>(x_dot_poly->degree()));
905  for (unsigned int i=0; i<=x_dot_poly->degree(); i++) {
906  epetra_ptr = rcp_const_cast<Epetra_Vector>(
907  get_Epetra_Vector(*x_map_, x_dot_poly->getCoefficient(i)) );
908  epetra_x_dot_poly->setCoefficientPtr(i,epetra_ptr);
909  }
910  epetraInArgs->set_x_dot_poly(epetra_x_dot_poly);
911  }
912 
913  RCP<const Polynomial< VectorBase<double> > > x_poly;
914  if(
915  inArgs.supports(IN_ARG_x_poly)
916  && (x_poly = inArgs.get_x_poly()).get()
917  )
918  {
919  RCP<Polynomial<Epetra_Vector> > epetra_x_poly =
920  rcp(new Polynomial<Epetra_Vector>(x_poly->degree()));
921  for (unsigned int i=0; i<=x_poly->degree(); i++) {
922  epetra_ptr = rcp_const_cast<Epetra_Vector>(
923  get_Epetra_Vector(*x_map_, x_poly->getCoefficient(i)) );
924  epetra_x_poly->setCoefficientPtr(i,epetra_ptr);
925  }
926  epetraInArgs->set_x_poly(epetra_x_poly);
927  }
928 
929 #endif // HAVE_THYRA_ME_POLYNOMIAL
930 
931  if( inArgs.supports(IN_ARG_t) )
932  epetraInArgs->set_t(inArgs.get_t());
933 
934  if( inArgs.supports(IN_ARG_alpha) )
935  epetraInArgs->set_alpha(inArgs.get_alpha());
936 
937  if( inArgs.supports(IN_ARG_beta) )
938  epetraInArgs->set_beta(inArgs.get_beta());
939 
940  if( inArgs.supports(IN_ARG_step_size) )
941  epetraInArgs->set_step_size(inArgs.get_step_size());
942 
943  if( inArgs.supports(IN_ARG_stage_number) )
944  epetraInArgs->set_stage_number(inArgs.get_stage_number());
945 }
946 
947 
949  const ModelEvaluatorBase::OutArgs<double> &outArgs,
950  EpetraExt::ModelEvaluator::OutArgs *epetraUnscaledOutArgs_inout,
951  RCP<LinearOpBase<double> > *W_op_out,
952  RCP<EpetraLinearOp> *efwdW_out,
953  RCP<Epetra_Operator> *eW_out
954  ) const
955 {
956 
957  using Teuchos::rcp;
958  using Teuchos::rcp_const_cast;
959  using Teuchos::rcp_dynamic_cast;
960  using Teuchos::OSTab;
961  using Teuchos::implicit_cast;
963  //typedef EpetraExt::ModelEvaluator EME; // unused
964 
965  // Assert input
966 #ifdef TEUCHOS_DEBUG
967  TEUCHOS_ASSERT(epetraUnscaledOutArgs_inout);
968  TEUCHOS_ASSERT(W_op_out);
969  TEUCHOS_ASSERT(efwdW_out);
970  TEUCHOS_ASSERT(eW_out);
971 #endif
972 
973  // Create easy to use references
974  EpetraExt::ModelEvaluator::OutArgs &epetraUnscaledOutArgs = *epetraUnscaledOutArgs_inout;
975  RCP<LinearOpBase<double> > &W_op = *W_op_out;
976  RCP<EpetraLinearOp> &efwdW = *efwdW_out;
977  RCP<Epetra_Operator> &eW = *eW_out;
978 
979  // f
980  {
981  RCP<VectorBase<double> > f;
982  if( outArgs.supports(OUT_ARG_f) && (f = outArgs.get_f()).get() )
983  epetraUnscaledOutArgs.set_f(get_Epetra_Vector(*f_map_,f));
984  RCP<Stokhos::ProductEpetraVector > f_mp;
985  if( outArgs.supports(OUT_ARG_f_mp) && (f_mp = outArgs.get_f_mp()).get() )
986  epetraUnscaledOutArgs.set_f_mp(f_mp);
987  }
988 
989  // g
990  {
991  RCP<VectorBase<double> > g_j;
992  for(int j = 0; j < outArgs.Ng(); ++j ) {
993  g_j = outArgs.get_g(j);
994  if(g_j.get()) epetraUnscaledOutArgs.set_g(j,get_Epetra_Vector(*g_map_[j],g_j));
995  }
996  RCP<Stokhos::ProductEpetraVector > g_mp_j;
997  for(int j = 0; j < outArgs.Ng(); ++j ) {
998  if (outArgs.supports(OUT_ARG_g_mp,j)) {
999  g_mp_j = outArgs.get_g_mp(j);
1000  if(g_mp_j.get()) epetraUnscaledOutArgs.set_g_mp(j,g_mp_j);
1001  }
1002  }
1003  }
1004 
1005  // W_op
1006  {
1007  RCP<Stokhos::ProductEpetraOperator > W_mp;
1008  if( outArgs.supports(OUT_ARG_W_mp) && (W_mp = outArgs.get_W_mp()).get() )
1009  epetraUnscaledOutArgs.set_W_mp(W_mp);
1010  }
1011 
1012  // W_op
1013  {
1014 
1015  if (outArgs.supports(OUT_ARG_W_op) && nonnull(W_op = outArgs.get_W_op())) {
1016  if (nonnull(W_op) && is_null(efwdW)) {
1017  efwdW = rcp_const_cast<EpetraLinearOp>(
1018  rcp_dynamic_cast<const EpetraLinearOp>(W_op, true));
1019  }
1020  }
1021 
1022  if (nonnull(efwdW)) {
1023  // By the time we get here, if we have an object in efwdW, then it
1024  // should already be embeadded with an underlying Epetra_Operator object
1025  // that was allocated by the EpetraExt::ModelEvaluator object.
1026  // Therefore, we should just have to grab this object and be on our way.
1027  eW = efwdW->epetra_op();
1028  epetraUnscaledOutArgs.set_W(eW);
1029  }
1030 
1031  // Note: The following derivative objects update in place!
1032 
1033  }
1034 
1035  // DfDp
1036  {
1037  Derivative<double> DfDp_l;
1038  for(int l = 0; l < outArgs.Np(); ++l ) {
1039  if( !outArgs.supports(OUT_ARG_DfDp,l).none()
1040  && !(DfDp_l = outArgs.get_DfDp(l)).isEmpty() )
1041  {
1042  epetraUnscaledOutArgs.set_DfDp(l,convert(DfDp_l,f_map_,p_map_[l]));
1043  }
1044  }
1045  MPDerivative DfDp_mp_l;
1046  for(int l = 0; l < outArgs.Np(); ++l ) {
1047  if( !outArgs.supports(OUT_ARG_DfDp_mp,l).none()
1048  && !(DfDp_mp_l = outArgs.get_DfDp_mp(l)).isEmpty() )
1049  {
1050  epetraUnscaledOutArgs.set_DfDp_mp(l,convert(DfDp_mp_l,f_map_,p_map_[l]));
1051  }
1052  }
1053  }
1054 
1055  // DgDx_dot
1056  {
1057  Derivative<double> DgDx_dot_j;
1058  for(int j = 0; j < outArgs.Ng(); ++j ) {
1059  if( !outArgs.supports(OUT_ARG_DgDx_dot,j).none()
1060  && !(DgDx_dot_j = outArgs.get_DgDx_dot(j)).isEmpty() )
1061  {
1062  epetraUnscaledOutArgs.set_DgDx_dot(j,convert(DgDx_dot_j,g_map_[j],x_map_));
1063  }
1064  }
1065  MPDerivative DgDx_dot_mp_j;
1066  for(int j = 0; j < outArgs.Ng(); ++j ) {
1067  if( !outArgs.supports(OUT_ARG_DgDx_dot_mp,j).none()
1068  && !(DgDx_dot_mp_j = outArgs.get_DgDx_dot_mp(j)).isEmpty() )
1069  {
1070  epetraUnscaledOutArgs.set_DgDx_dot_mp(j,convert(DgDx_dot_mp_j,g_map_[j],x_map_));
1071  }
1072  }
1073  }
1074 
1075  // DgDx
1076  {
1077  Derivative<double> DgDx_j;
1078  for(int j = 0; j < outArgs.Ng(); ++j ) {
1079  if( !outArgs.supports(OUT_ARG_DgDx,j).none()
1080  && !(DgDx_j = outArgs.get_DgDx(j)).isEmpty() )
1081  {
1082  epetraUnscaledOutArgs.set_DgDx(j,convert(DgDx_j,g_map_[j],x_map_));
1083  }
1084  }
1085  MPDerivative DgDx_mp_j;
1086  for(int j = 0; j < outArgs.Ng(); ++j ) {
1087  if( !outArgs.supports(OUT_ARG_DgDx_mp,j).none()
1088  && !(DgDx_mp_j = outArgs.get_DgDx_mp(j)).isEmpty() )
1089  {
1090  epetraUnscaledOutArgs.set_DgDx_mp(j,convert(DgDx_mp_j,g_map_[j],x_map_));
1091  }
1092  }
1093  }
1094 
1095  // DgDp
1096  {
1097  DerivativeSupport DgDp_j_l_support;
1098  Derivative<double> DgDp_j_l;
1099  for (int j = 0; j < outArgs.Ng(); ++j ) {
1100  for (int l = 0; l < outArgs.Np(); ++l ) {
1101  if (!(DgDp_j_l_support = outArgs.supports(OUT_ARG_DgDp,j,l)).none()
1102  && !(DgDp_j_l = outArgs.get_DgDp(j,l)).isEmpty() )
1103  {
1104  epetraUnscaledOutArgs.set_DgDp(j,l,convert(DgDp_j_l,g_map_[j],p_map_[l]));
1105  }
1106  }
1107  }
1108  DerivativeSupport DgDp_mp_j_l_support;
1109  MPDerivative DgDp_mp_j_l;
1110  for (int j = 0; j < outArgs.Ng(); ++j ) {
1111  for (int l = 0; l < outArgs.Np(); ++l ) {
1112  if (!(DgDp_mp_j_l_support = outArgs.supports(OUT_ARG_DgDp_mp,j,l)).none()
1113  && !(DgDp_mp_j_l = outArgs.get_DgDp_mp(j,l)).isEmpty() )
1114  {
1115  epetraUnscaledOutArgs.set_DgDp_mp(j,l,convert(DgDp_mp_j_l,g_map_[j],p_map_[l]));
1116  }
1117  }
1118  }
1119  }
1120 
1121 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1122 
1123  // f_poly
1124  RCP<const Teuchos::Polynomial< VectorBase<double> > > f_poly;
1125  if( outArgs.supports(OUT_ARG_f_poly) && (f_poly = outArgs.get_f_poly()).get() )
1126  {
1127  RCP<Teuchos::Polynomial<Epetra_Vector> > epetra_f_poly =
1128  Teuchos::rcp(new Teuchos::Polynomial<Epetra_Vector>(f_poly->degree()));
1129  for (unsigned int i=0; i<=f_poly->degree(); i++) {
1130  RCP<Epetra_Vector> epetra_ptr
1131  = Teuchos::rcp_const_cast<Epetra_Vector>(get_Epetra_Vector(*f_map_,
1132  f_poly->getCoefficient(i)));
1133  epetra_f_poly->setCoefficientPtr(i,epetra_ptr);
1134  }
1135  epetraUnscaledOutArgs.set_f_poly(epetra_f_poly);
1136  }
1137 
1138 #endif // HAVE_THYRA_ME_POLYNOMIAL
1139 
1140 }
1141 
1142 
1144  EpetraExt::ModelEvaluator::InArgs *epetraInArgs_inout,
1145  EpetraExt::ModelEvaluator::OutArgs *epetraUnscaledOutArgs_inout,
1146  const RCP<Teuchos::FancyOStream> &out,
1147  const Teuchos::EVerbosityLevel verbLevel
1148  ) const
1149 {
1150 
1151  typedef EpetraExt::ModelEvaluator EME;
1152 
1153 #ifdef TEUCHOS_DEBUG
1154  TEUCHOS_ASSERT(epetraInArgs_inout);
1155  TEUCHOS_ASSERT(epetraUnscaledOutArgs_inout);
1156 #endif
1157 
1158  EpetraExt::ModelEvaluator::InArgs
1159  &epetraInArgs = *epetraInArgs_inout;
1160  EpetraExt::ModelEvaluator::OutArgs
1161  &epetraUnscaledOutArgs = *epetraUnscaledOutArgs_inout;
1162 
1163  if (
1165  &&
1166  (
1167  epetraUnscaledOutArgs.supports(EME::OUT_ARG_f)
1168  &&
1169  epetraUnscaledOutArgs.funcOrDerivesAreSet(EME::OUT_ARG_f)
1170  )
1171  &&
1172  (
1173  epetraUnscaledOutArgs.supports(EME::OUT_ARG_W)
1174  &&
1175  is_null(epetraUnscaledOutArgs.get_W())
1176  )
1177  )
1178  {
1179  // This is the first pass through with scaling turned on and the client
1180  // turned on automatic scaling but did not ask for W. We must compute W
1181  // in order to compute the scale factors so we must allocate a temporary W
1182  // just to compute the scale factors and then throw it away. If the
1183  // client wants to evaluate W at the same point, then it should have
1184  // passed W in but that is not our problem here. The ModelEvaluator
1185  // relies on the client to set up the calls to allow for efficient
1186  // evaluation.
1187 
1188  if(out.get() && verbLevel >= Teuchos::VERB_LOW)
1189  *out
1190  << "\nCreating a temporary Epetra W to compute scale factors"
1191  << " for f(...) ...\n";
1192  epetraUnscaledOutArgs.set_W(create_and_assert_W(*epetraModel_));
1193  if( epetraInArgs.supports(EME::IN_ARG_beta) )
1194  epetraInArgs.set_beta(1.0);
1195  if( epetraInArgs.supports(EME::IN_ARG_alpha) )
1196  epetraInArgs.set_alpha(0.0);
1197  if( epetraInArgs.supports(EME::IN_ARG_step_size) )
1198  epetraInArgs.set_step_size(0.0);
1199  if( epetraInArgs.supports(EME::IN_ARG_stage_number) )
1200  epetraInArgs.set_stage_number(1.0);
1201  }
1202 
1203 }
1204 
1205 
1207  const EpetraExt::ModelEvaluator::OutArgs &epetraUnscaledOutArgs,
1208  const RCP<Teuchos::FancyOStream> &out,
1209  const Teuchos::EVerbosityLevel verbLevel
1210  ) const
1211 {
1212 
1213  using Teuchos::OSTab;
1214  using Teuchos::rcp;
1215  using Teuchos::rcp_const_cast;
1216  using Teuchos::includesVerbLevel;
1217 
1218  // Compute the scale factors for the state function f(...)
1219  switch(stateFunctionScaling_) {
1220 
1222 
1223  // Compute the inverse row-sum scaling from W
1224 
1225  const RCP<Epetra_RowMatrix>
1226  ermW = get_Epetra_RowMatrix(epetraUnscaledOutArgs);
1227  // Note: Above, we get the Epetra W object directly from the Epetra
1228  // OutArgs object since this might be a temporary matrix just to
1229  // compute scaling factors. In this case, the stack funtion variable
1230  // eW might be empty!
1231 
1232  RCP<Epetra_Vector>
1233  invRowSums = rcp(new Epetra_Vector(ermW->OperatorRangeMap()));
1234  // Above: From the documentation is seems that the RangeMap should be
1235  // okay but who knows for sure!
1236 
1237  ermW->InvRowSums(*invRowSums);
1238 
1239  if (out.get() && includesVerbLevel(verbLevel,Teuchos::VERB_LOW)) {
1240  *out
1241  << "\nComputed inverse row sum scaling from W that"
1242  " will be used to scale f(...) and its derivatives:\n";
1243  double minVal = 0, maxVal = 0, avgVal = 0;
1244  invRowSums->MinValue(&minVal);
1245  invRowSums->MaxValue(&maxVal);
1246  invRowSums->MeanValue(&avgVal);
1247  OSTab tab(out);
1248  *out
1249  << "min(invRowSums) = " << minVal << "\n"
1250  << "max(invRowSums) = " << maxVal << "\n"
1251  << "avg(invRowSums) = " << avgVal << "\n";
1252  }
1253 
1254  stateFunctionScalingVec_ = invRowSums;
1255 
1256  break;
1257 
1258  }
1259 
1260  default:
1261  TEUCHOS_TEST_FOR_EXCEPT("Should never get here!");
1262 
1263  }
1264 
1265  epetraOutArgsScaling_ = epetraModel_->createOutArgs();
1266 
1267  epetraOutArgsScaling_.set_f(
1268  rcp_const_cast<Epetra_Vector>(stateFunctionScalingVec_) );
1269 
1270 }
1271 
1272 
1274  const EpetraExt::ModelEvaluator::OutArgs &epetraOutArgs,
1275  RCP<LinearOpBase<double> > &W_op,
1276  RCP<EpetraLinearOp> &efwdW,
1277  RCP<Epetra_Operator> &eW,
1278  const ModelEvaluatorBase::OutArgs<double> &outArgs
1279  ) const
1280 {
1281 
1282  using Teuchos::rcp_dynamic_cast;
1283  //typedef EpetraExt::ModelEvaluator EME; // unused
1284 
1285  if (nonnull(efwdW)) {
1286  efwdW->setFullyInitialized(true);
1287  // NOTE: Above will directly update W_op also if W.get()==NULL!
1288  }
1289 
1290  if (nonnull(W_op)) {
1291  if (W_op.shares_resource(efwdW)) {
1292  // W_op was already updated above since *efwdW is the same object as *W_op
1293  }
1294  else {
1295  rcp_dynamic_cast<EpetraLinearOp>(W_op, true)->setFullyInitialized(true);
1296  }
1297  }
1298 
1299 }
1300 
1301 
1303 {
1304 
1305  using Teuchos::rcp;
1306  using Teuchos::implicit_cast;
1307  //typedef ModelEvaluatorBase MEB; // unused
1308  typedef EpetraExt::ModelEvaluator EME;
1309 
1311 
1312  // Gather the nominal values and bounds into Epetra InArgs objects
1313 
1314  EME::InArgs epetraOrigNominalValues;
1315  EpetraExt::gatherModelNominalValues(
1316  *epetraModel_, &epetraOrigNominalValues );
1317 
1318  EME::InArgs epetraOrigLowerBounds;
1319  EME::InArgs epetraOrigUpperBounds;
1320  EpetraExt::gatherModelBounds(
1321  *epetraModel_, &epetraOrigLowerBounds, &epetraOrigUpperBounds );
1322 
1323  // Set up Epetra InArgs scaling object
1324 
1325  epetraInArgsScaling_ = epetraModel_->createInArgs();
1326 
1327  if( !is_null(stateVariableScalingVec_) ) {
1329  = EpetraExt::createInverseModelScalingVector(stateVariableScalingVec_);
1330  if( epetraOrigNominalValues.supports(EME::IN_ARG_x_dot) ) {
1332  }
1333  if( epetraOrigNominalValues.supports(EME::IN_ARG_x) ) {
1335  }
1336  }
1337 
1338  // Scale the original variables and bounds
1339 
1340  EME::InArgs epetraScaledNominalValues = epetraModel_->createInArgs();
1341  EpetraExt::scaleModelVars(
1342  epetraOrigNominalValues, epetraInArgsScaling_, &epetraScaledNominalValues
1343  );
1344 
1345  EME::InArgs epetraScaledLowerBounds = epetraModel_->createInArgs();
1346  EME::InArgs epetraScaledUpperBounds = epetraModel_->createInArgs();
1347  EpetraExt::scaleModelBounds(
1348  epetraOrigLowerBounds, epetraOrigUpperBounds, epetraModel_->getInfBound(),
1350  &epetraScaledLowerBounds, &epetraScaledUpperBounds
1351  );
1352 
1353  // Wrap the scaled epetra InArgs objects as Thyra InArgs objects!
1354 
1355  nominalValues_ = this->createInArgs();
1356  lowerBounds_ = this->createInArgs();
1357  upperBounds_ = this->createInArgs();
1358  convertInArgsFromEpetraToThyra(epetraScaledNominalValues, &nominalValues_);
1359  convertInArgsFromEpetraToThyra(epetraScaledLowerBounds, &lowerBounds_);
1360  convertInArgsFromEpetraToThyra(epetraScaledUpperBounds, &upperBounds_);
1361 
1363 
1364  }
1365  else {
1366 
1367  // The nominal values and bounds should already be updated an should have
1368  // the currect scaling!
1369 
1370  }
1371 
1372 }
1373 
1374 
1376 {
1377 
1378  typedef EpetraExt::ModelEvaluator EME;
1379 
1380  const EpetraExt::ModelEvaluator &epetraModel = *epetraModel_;
1381  EME::InArgs epetraInArgs = epetraModel.createInArgs();
1382  EME::OutArgs epetraOutArgs = epetraModel.createOutArgs();
1383  const int l_Np = epetraOutArgs.Np();
1384  const int l_Ng = epetraOutArgs.Ng();
1385 
1386  //
1387  // InArgs
1388  //
1389 
1390  InArgsSetup<double> inArgs;
1391  inArgs.setModelEvalDescription(this->description());
1392  inArgs.set_Np(epetraInArgs.Np());
1393  inArgs.setSupports(IN_ARG_x_dot, epetraInArgs.supports(EME::IN_ARG_x_dot));
1394  inArgs.setSupports(IN_ARG_x, epetraInArgs.supports(EME::IN_ARG_x));
1395  inArgs.setSupports(IN_ARG_x_dot_mp, epetraInArgs.supports(EME::IN_ARG_x_dot_mp));
1396  inArgs.setSupports(IN_ARG_x_mp, epetraInArgs.supports(EME::IN_ARG_x_mp));
1397 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1398  inArgs.setSupports(IN_ARG_x_dot_poly,
1399  epetraInArgs.supports(EME::IN_ARG_x_dot_poly));
1400  inArgs.setSupports(IN_ARG_x_poly, epetraInArgs.supports(EME::IN_ARG_x_poly));
1401 #endif // HAVE_THYRA_ME_POLYNOMIAL
1402  inArgs.setSupports(IN_ARG_t, epetraInArgs.supports(EME::IN_ARG_t));
1403  inArgs.setSupports(IN_ARG_alpha, epetraInArgs.supports(EME::IN_ARG_alpha));
1404  inArgs.setSupports(IN_ARG_beta, epetraInArgs.supports(EME::IN_ARG_beta));
1405  inArgs.setSupports(IN_ARG_step_size, epetraInArgs.supports(EME::IN_ARG_step_size));
1406  inArgs.setSupports(IN_ARG_stage_number, epetraInArgs.supports(EME::IN_ARG_stage_number));
1407  for(int l=0; l<l_Np; ++l) {
1408  inArgs.setSupports(IN_ARG_p_mp, l, epetraInArgs.supports(EME::IN_ARG_p_mp, l));
1409  }
1410  prototypeInArgs_ = inArgs;
1411 
1412  //
1413  // OutArgs
1414  //
1415 
1416  OutArgsSetup<double> outArgs;
1417  outArgs.setModelEvalDescription(this->description());
1418  outArgs.set_Np_Ng(l_Np, l_Ng);
1419  // f
1420  outArgs.setSupports(OUT_ARG_f, epetraOutArgs.supports(EME::OUT_ARG_f));
1421  outArgs.setSupports(OUT_ARG_f_mp, epetraOutArgs.supports(EME::OUT_ARG_f_mp));
1422  if (outArgs.supports(OUT_ARG_f)) {
1423  // W_op
1424  outArgs.setSupports(OUT_ARG_W_op, epetraOutArgs.supports(EME::OUT_ARG_W));
1425  outArgs.set_W_properties(convert(epetraOutArgs.get_W_properties()));
1426  // DfDp
1427  for(int l=0; l<l_Np; ++l) {
1428  outArgs.setSupports(OUT_ARG_DfDp, l,
1429  convert(epetraOutArgs.supports(EME::OUT_ARG_DfDp, l)));
1430  if(!outArgs.supports(OUT_ARG_DfDp, l).none())
1431  outArgs.set_DfDp_properties(l,
1432  convert(epetraOutArgs.get_DfDp_properties(l)));
1433  if (outArgs.supports(OUT_ARG_f_mp))
1434  {
1435  outArgs.setSupports(OUT_ARG_DfDp_mp, l,
1436  convert(epetraOutArgs.supports(EME::OUT_ARG_DfDp_mp, l)));
1437  if(!outArgs.supports(OUT_ARG_DfDp_mp, l).none())
1438  outArgs.set_DfDp_mp_properties(l,
1439  convert(epetraOutArgs.get_DfDp_mp_properties(l)));
1440  }
1441  }
1442  }
1443  // DgDx_dot and DgDx
1444  for(int j=0; j<l_Ng; ++j) {
1445  if (inArgs.supports(IN_ARG_x_dot))
1446  outArgs.setSupports(OUT_ARG_DgDx_dot, j,
1447  convert(epetraOutArgs.supports(EME::OUT_ARG_DgDx_dot, j)));
1448  if(!outArgs.supports(OUT_ARG_DgDx_dot, j).none())
1449  outArgs.set_DgDx_dot_properties(j,
1450  convert(epetraOutArgs.get_DgDx_dot_properties(j)));
1451  if (inArgs.supports(IN_ARG_x))
1452  outArgs.setSupports(OUT_ARG_DgDx, j,
1453  convert(epetraOutArgs.supports(EME::OUT_ARG_DgDx, j)));
1454  if(!outArgs.supports(OUT_ARG_DgDx, j).none())
1455  outArgs.set_DgDx_properties(j,
1456  convert(epetraOutArgs.get_DgDx_properties(j)));
1457  if (inArgs.supports(IN_ARG_x_dot_mp))
1458  outArgs.setSupports(OUT_ARG_DgDx_dot_mp, j,
1459  convert(epetraOutArgs.supports(EME::OUT_ARG_DgDx_dot_mp, j)));
1460  if(!outArgs.supports(OUT_ARG_DgDx_dot_mp, j).none())
1461  outArgs.set_DgDx_dot_mp_properties(j,
1462  convert(epetraOutArgs.get_DgDx_dot_mp_properties(j)));
1463  if (inArgs.supports(IN_ARG_x_mp))
1464  outArgs.setSupports(OUT_ARG_DgDx_mp, j,
1465  convert(epetraOutArgs.supports(EME::OUT_ARG_DgDx_mp, j)));
1466  if(!outArgs.supports(OUT_ARG_DgDx_mp, j).none())
1467  outArgs.set_DgDx_mp_properties(j,
1468  convert(epetraOutArgs.get_DgDx_mp_properties(j)));
1469  }
1470  // DgDp
1471  for(int j=0; j < l_Ng; ++j) for(int l=0; l < l_Np; ++l) {
1472  const EME::DerivativeSupport epetra_DgDp_j_l_support =
1473  epetraOutArgs.supports(EME::OUT_ARG_DgDp, j, l);
1474  outArgs.setSupports(OUT_ARG_DgDp, j, l,
1475  convert(epetra_DgDp_j_l_support));
1476  if(!outArgs.supports(OUT_ARG_DgDp, j, l).none())
1477  outArgs.set_DgDp_properties(j, l,
1478  convert(epetraOutArgs.get_DgDp_properties(j, l)));
1479  const EME::DerivativeSupport epetra_DgDp_mp_j_l_support =
1480  epetraOutArgs.supports(EME::OUT_ARG_DgDp_mp, j, l);
1481  outArgs.setSupports(OUT_ARG_DgDp_mp, j, l,
1482  convert(epetra_DgDp_mp_j_l_support));
1483  if(!outArgs.supports(OUT_ARG_DgDp_mp, j, l).none())
1484  outArgs.set_DgDp_mp_properties(j, l,
1485  convert(epetraOutArgs.get_DgDp_mp_properties(j, l)));
1486  }
1487  for(int j=0; j<l_Ng; ++j) {
1488  outArgs.setSupports(OUT_ARG_g_mp, j, epetraOutArgs.supports(EME::OUT_ARG_g_mp, j));
1489  }
1490 #ifdef HAVE_THYRA_ME_POLYNOMIAL
1491  outArgs.setSupports(OUT_ARG_f_poly,
1492  epetraOutArgs.supports(EME::OUT_ARG_f_poly));
1493 #endif // HAVE_THYRA_ME_POLYNOMIAL
1494  prototypeOutArgs_ = outArgs;
1495 
1496  // We are current!
1497  currentInArgsOutArgs_ = true;
1498 
1499 }
1500 
1501 
1502 RCP<EpetraLinearOp>
1504 {
1505  return Thyra::partialNonconstEpetraLinearOp(
1506  this->get_f_space(), this->get_x_space(),
1507  create_and_assert_W(*epetraModel_)
1508  );
1509 }
1510 
1511 
1512 } // namespace Thyra
1513 
1514 
1515 //
1516 // Non-member utility functions
1517 //
1518 
1519 
1520 Teuchos::RCP<Thyra::EpetraModelEvaluator>
1521 Thyra::epetraModelEvaluator(
1522  const RCP<const EpetraExt::ModelEvaluator> &epetraModel,
1523  const RCP<LinearOpWithSolveFactoryBase<double> > &W_factory
1524  )
1525 {
1526  return Teuchos::rcp(new EpetraModelEvaluator(epetraModel,W_factory));
1527 }
1528 
1529 
1530 Thyra::ModelEvaluatorBase::EDerivativeMultiVectorOrientation
1532  const EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation &mvOrientation
1533  )
1534 {
1535  switch(mvOrientation) {
1536  case EpetraExt::ModelEvaluator::DERIV_MV_BY_COL :
1537  return ModelEvaluatorBase::DERIV_MV_BY_COL;
1538  case EpetraExt::ModelEvaluator::DERIV_TRANS_MV_BY_ROW :
1539  return ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW;
1540  default:
1541  TEUCHOS_TEST_FOR_EXCEPT(true);
1542  }
1543  return ModelEvaluatorBase::DERIV_MV_BY_COL; // Should never be called!
1544 }
1545 
1546 
1547 EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation
1549  const ModelEvaluatorBase::EDerivativeMultiVectorOrientation &mvOrientation
1550  )
1551 {
1552  switch(mvOrientation) {
1553  case ModelEvaluatorBase::DERIV_MV_BY_COL :
1554  return EpetraExt::ModelEvaluator::DERIV_MV_BY_COL;
1555  case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW :
1556  return EpetraExt::ModelEvaluator::DERIV_TRANS_MV_BY_ROW;
1557  default:
1558  TEUCHOS_TEST_FOR_EXCEPT(true);
1559  }
1560  return EpetraExt::ModelEvaluator::DERIV_MV_BY_COL; // Should never be called!
1561 }
1562 
1563 
1564 Thyra::ModelEvaluatorBase::DerivativeProperties
1566  const EpetraExt::ModelEvaluator::DerivativeProperties &derivativeProperties
1567  )
1568 {
1569  ModelEvaluatorBase::EDerivativeLinearity linearity;
1570  switch(derivativeProperties.linearity) {
1571  case EpetraExt::ModelEvaluator::DERIV_LINEARITY_UNKNOWN:
1572  linearity = ModelEvaluatorBase::DERIV_LINEARITY_UNKNOWN;
1573  break;
1574  case EpetraExt::ModelEvaluator::DERIV_LINEARITY_CONST:
1575  linearity = ModelEvaluatorBase::DERIV_LINEARITY_CONST;
1576  break;
1577  case EpetraExt::ModelEvaluator::DERIV_LINEARITY_NONCONST:
1578  linearity = ModelEvaluatorBase::DERIV_LINEARITY_NONCONST;
1579  break;
1580  default:
1581  TEUCHOS_TEST_FOR_EXCEPT(true);
1582  }
1583  ModelEvaluatorBase::ERankStatus rank;
1584  switch(derivativeProperties.rank) {
1585  case EpetraExt::ModelEvaluator::DERIV_RANK_UNKNOWN:
1586  rank = ModelEvaluatorBase::DERIV_RANK_UNKNOWN;
1587  break;
1588  case EpetraExt::ModelEvaluator::DERIV_RANK_FULL:
1589  rank = ModelEvaluatorBase::DERIV_RANK_FULL;
1590  break;
1591  case EpetraExt::ModelEvaluator::DERIV_RANK_DEFICIENT:
1592  rank = ModelEvaluatorBase::DERIV_RANK_DEFICIENT;
1593  break;
1594  default:
1595  TEUCHOS_TEST_FOR_EXCEPT(true);
1596  }
1597  return ModelEvaluatorBase::DerivativeProperties(
1598  linearity,rank,derivativeProperties.supportsAdjoint);
1599 }
1600 
1601 
1602 Thyra::ModelEvaluatorBase::DerivativeSupport
1604  const EpetraExt::ModelEvaluator::DerivativeSupport &derivativeSupport
1605  )
1606 {
1607  ModelEvaluatorBase::DerivativeSupport ds;
1608  if(derivativeSupport.supports(EpetraExt::ModelEvaluator::DERIV_LINEAR_OP))
1609  ds.plus(ModelEvaluatorBase::DERIV_LINEAR_OP);
1610  if(derivativeSupport.supports(EpetraExt::ModelEvaluator::DERIV_MV_BY_COL))
1611  ds.plus(ModelEvaluatorBase::DERIV_MV_BY_COL);
1612  if(derivativeSupport.supports(EpetraExt::ModelEvaluator::DERIV_TRANS_MV_BY_ROW))
1613  ds.plus(ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW);
1614  return ds;
1615 }
1616 
1617 
1618 EpetraExt::ModelEvaluator::Derivative
1620  const ModelEvaluatorBase::Derivative<double> &derivative,
1621  const RCP<const Epetra_Map> &fnc_map,
1622  const RCP<const Epetra_Map> &var_map
1623  )
1624 {
1625  typedef ModelEvaluatorBase MEB;
1626  if(derivative.getLinearOp().get()) {
1627  return EpetraExt::ModelEvaluator::Derivative(
1628  Teuchos::rcp_const_cast<Epetra_Operator>(
1629  Teuchos::dyn_cast<const EpetraLinearOp>(*derivative.getLinearOp()).epetra_op()
1630  )
1631  );
1632  }
1633  else if(derivative.getDerivativeMultiVector().getMultiVector().get()) {
1634  return EpetraExt::ModelEvaluator::Derivative(
1635  EpetraExt::ModelEvaluator::DerivativeMultiVector(
1637  ( derivative.getDerivativeMultiVector().getOrientation() == MEB::DERIV_MV_BY_COL
1638  ? *fnc_map
1639  : *var_map
1640  )
1641  ,derivative.getDerivativeMultiVector().getMultiVector()
1642  )
1643  ,convert(derivative.getDerivativeMultiVector().getOrientation())
1644  )
1645  );
1646  }
1647  return EpetraExt::ModelEvaluator::Derivative();
1648 }
1649 EpetraExt::ModelEvaluator::MPDerivative
1651  const ModelEvaluatorBase::MPDerivative &derivative,
1652  const RCP<const Epetra_Map> &fnc_map,
1653  const RCP<const Epetra_Map> &var_map
1654  )
1655 {
1656  //typedef ModelEvaluatorBase MEB; // unused
1657  if(derivative.getLinearOp().get()) {
1658  return EpetraExt::ModelEvaluator::MPDerivative(
1659  derivative.getLinearOp()
1660  );
1661  }
1662  else if(derivative.getDerivativeMultiVector().getMultiVector().get()) {
1663  return EpetraExt::ModelEvaluator::MPDerivative(
1664  EpetraExt::ModelEvaluator::MPDerivativeMultiVector(
1665  derivative.getDerivativeMultiVector().getMultiVector()
1666  ,convert(derivative.getDerivativeMultiVector().getOrientation())
1667  )
1668  );
1669  }
1670  return EpetraExt::ModelEvaluator::MPDerivative();
1671 }
RCP< Epetra_MultiVector > get_Epetra_MultiVector(const Epetra_Map &map, const RCP< MultiVectorBase< double > > &mv)
Get a non-const Epetra_MultiVector view from a non-const MultiVectorBase object if possible...
void preEvalScalingSetup(EpetraExt::ModelEvaluator::InArgs *epetraInArgs, EpetraExt::ModelEvaluator::OutArgs *epetraUnscaledOutArgs, const RCP< Teuchos::FancyOStream > &out, const Teuchos::EVerbosityLevel verbLevel) const
void setNominalValues(const ModelEvaluatorBase::InArgs< double > &nominalValues)
Set the nominal values.
RCP< const EpetraExt::ModelEvaluator > getEpetraModel() const
Concrete LinearOpBase adapter subclass for Epetra_Operator object.
RCP< const VectorSpaceBase< double > > get_g_space(int j) const
void reportFinalPoint(const ModelEvaluatorBase::InArgs< double > &finalPoint, const bool wasSolved)
RCP< EpetraLinearOp > create_epetra_W_op() const
RCP< LinearOpBase< double > > create_W_op() const
void evalModelImpl(const ModelEvaluatorBase::InArgs< double > &inArgs, const ModelEvaluatorBase::OutArgs< double > &outArgs) const
RCP< const VectorSpaceBase< double > > get_x_space() const
RCP< Teuchos::ParameterList > getNonconstParameterList()
RCP< LinearOpWithSolveFactoryBase< double > > W_factory_
RCP< const VectorSpaceBase< double > > create_VectorSpace(const RCP< const Epetra_Map > &epetra_map)
Create an VectorSpaceBase object given an Epetra_Map object.
void setStateVariableScalingVec(const RCP< const Epetra_Vector > &stateVariableScalingVec)
Set the state variable scaling vector s_x (see above).
void convertInArgsFromThyraToEpetra(const ModelEvaluatorBase::InArgs< double > &inArgs, EpetraExt::ModelEvaluator::InArgs *epetraInArgs) const
RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
RCP< const Teuchos::ParameterList > getParameterList() const
ModelEvaluatorBase::OutArgs< double > createOutArgsImpl() const
const ModelEvaluatorBase::InArgs< double > & getFinalPoint() const
void convertOutArgsFromThyraToEpetra(const ModelEvaluatorBase::OutArgs< double > &outArgs, EpetraExt::ModelEvaluator::OutArgs *epetraUnscaledOutArgs, RCP< LinearOpBase< double > > *W_op, RCP< EpetraLinearOp > *efwdW, RCP< Epetra_Operator > *eW) const
RCP< VectorBase< double > > create_Vector(const RCP< Epetra_Vector > &epetra_v, const RCP< const VectorSpaceBase< double > > &space)
Create a non-const VectorBase object from a non-const Epetra_Vector object.
EpetraExt::ModelEvaluator::OutArgs epetraOutArgsScaling_
RCP< const VectorSpaceBase< double > > x_space_
ModelEvaluatorBase::OutArgs< double > prototypeOutArgs_
RCP< const Epetra_Vector > getStateVariableInvScalingVec() const
Get the state variable scaling vector s_x (see above).
ModelEvaluatorBase::InArgs< double > getNominalValues() const
RCP< LinearOpBase< double > > create_DgDx_dot_op_impl(int j) const
EpetraExt::ModelEvaluator::MPDerivative convert(const ModelEvaluatorBase::MPDerivative &derivative, const RCP< const Epetra_Map > &fnc_map, const RCP< const Epetra_Map > &var_map)
void finishConvertingOutArgsFromEpetraToThyra(const EpetraExt::ModelEvaluator::OutArgs &epetraOutArgs, RCP< LinearOpBase< double > > &W_op, RCP< EpetraLinearOp > &efwdW, RCP< Epetra_Operator > &eW, const ModelEvaluatorBase::OutArgs< double > &outArgs) const
RCP< const VectorSpaceBase< double > > f_space_
ModelEvaluatorBase::InArgs< double > finalPoint_
void setStateFunctionScalingVec(const RCP< const Epetra_Vector > &stateFunctionScalingVec)
Set the state function scaling vector s_f (see above).
void postEvalScalingSetup(const EpetraExt::ModelEvaluator::OutArgs &epetraUnscaledOutArgs, const RCP< Teuchos::FancyOStream > &out, const Teuchos::EVerbosityLevel verbLevel) const
ModelEvaluatorBase::InArgs< double > lowerBounds_
RCP< Epetra_Vector > get_Epetra_Vector(const Epetra_Map &map, const RCP< VectorBase< double > > &v)
Get a non-const Epetra_Vector view from a non-const VectorBase object if possible.
void initialize(const RCP< const EpetraExt::ModelEvaluator > &epetraModel, const RCP< LinearOpWithSolveFactoryBase< double > > &W_factory)
ModelEvaluatorBase::InArgs< double > getLowerBounds() const
EpetraExt::ModelEvaluator::InArgs epetraInArgsScaling_
void setParameterList(RCP< Teuchos::ParameterList > const &paramList)
RCP< const Epetra_Vector > stateFunctionScalingVec_
ModelEvaluatorBase::EDerivativeMultiVectorOrientation convert(const EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation &mvOrientation)
void uninitialize(RCP< const EpetraExt::ModelEvaluator > *epetraModel=NULL, RCP< LinearOpWithSolveFactoryBase< double > > *W_factory=NULL)
RCP< LinearOpBase< double > > create_DfDp_op_impl(int l) const
void convertInArgsFromEpetraToThyra(const EpetraExt::ModelEvaluator::InArgs &epetraInArgs, ModelEvaluatorBase::InArgs< double > *inArgs) const
ModelEvaluatorBase::InArgs< double > prototypeInArgs_
ModelEvaluatorBase::InArgs< double > getUpperBounds() const
RCP< LinearOpBase< double > > create_DgDp_op_impl(int j, int l) const
RCP< const Epetra_Vector > stateVariableScalingVec_
RCP< const EpetraExt::ModelEvaluator > epetraModel_
RCP< Teuchos::ParameterList > paramList_
ModelEvaluatorBase::InArgs< double > nominalValues_
RCP< PreconditionerBase< double > > create_W_prec() const
Returns null currently.
RCP< const Epetra_Vector > getStateFunctionScalingVec() const
Get the state function scaling vector s_f (see above).
RCP< const LinearOpWithSolveFactoryBase< double > > get_W_factory() const
Teuchos::ArrayView< const std::string > get_g_names(int j) const
RCP< LinearOpBase< double > > create_DgDx_op_impl(int j) const
ModelEvaluatorBase::InArgs< double > createInArgs() const
RCP< const VectorSpaceBase< double > > get_f_space() const
RCP< const VectorSpaceBase< double > > get_p_space(int l) const
RCP< const Epetra_Vector > getStateVariableScalingVec() const
Get the inverse state variable scaling vector inv_s_x (see above).
RCP< Teuchos::ParameterList > unsetParameterList()
RCP< const Teuchos::ParameterList > getValidParameters() const
RCP< const Epetra_Vector > invStateVariableScalingVec_
ModelEvaluatorBase::InArgs< double > upperBounds_