10 #ifndef THYRA_DEFAULT_FINITE_DIFFERENCE_MODEL_EVALUATOR_DEF_HPP
11 #define THYRA_DEFAULT_FINITE_DIFFERENCE_MODEL_EVALUATOR_DEF_HPP
13 #include "Thyra_DefaultFiniteDifferenceModelEvaluator_decl.hpp"
14 #include "Thyra_ScaledLinearOpBase.hpp"
15 #include "Thyra_VectorStdOps.hpp"
24 template<
class Scalar>
32 template<
class Scalar>
36 thyraModel = this->getUnderlyingModel();
37 std::ostringstream oss;
38 oss <<
"Thyra::ScaledModelEvaluator{";
41 oss <<
"\'"<<thyraModel->description()<<
"\'";
49 template<
class Scalar>
53 f_scaling_ = f_scaling;
60 template<
class Scalar>
67 using Teuchos::rcp_const_cast;
68 using Teuchos::rcp_dynamic_cast;
71 THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_BEGIN(
72 "Thyra::ScaledModelEvaluator",inArgs,outArgs
75 thyraModel->evalModel(inArgs, outArgs);
81 ele_wise_scale(*f_scaling_, f.
ptr());
84 const RCP<LinearOpBase<Scalar> > W_op = outArgs.
get_W_op();
86 const RCP<ScaledLinearOpBase<Scalar> > W_scaled =
87 rcp_dynamic_cast<ScaledLinearOpBase<Scalar> >(W_op,
true);
88 W_scaled->scaleLeft(*f_scaling_);
93 THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_END();
101 #endif // THYRA_DEFAULT_FINITE_DIFFERENCE_MODEL_EVALUATOR_DEF_HPP
basic_OSTab< char > OSTab
Concrete aggregate class for all output arguments computable by a ModelEvaluator subclass object...
Evaluation< VectorBase< Scalar > > get_f() const
Precondition: supports(OUT_ARG_f)==true.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void set_f_scaling(const RCP< const Thyra::VectorBase< Scalar > > &f_scaling)
Abstract interface for finite-dimensional dense vectors.
ScaledModelEvaluator()
Constructs to uninitialized.
This class decorates a ModelEvaluator and returns scaled residual and Jacobian values.
bool nonnull(const boost::shared_ptr< T > &p)
std::string description() const
RCP< LinearOpBase< Scalar > > get_W_op() const
Precondition: supports(OUT_ARG_W_op)==true.
Concrete aggregate class for all input arguments computable by a ModelEvaluator subclass object...