42 #ifndef THYRA_DEFAULT_FINITE_DIFFERENCE_MODEL_EVALUATOR_DEF_HPP
43 #define THYRA_DEFAULT_FINITE_DIFFERENCE_MODEL_EVALUATOR_DEF_HPP
45 #include "Thyra_DefaultFiniteDifferenceModelEvaluator_decl.hpp"
46 #include "Thyra_ScaledLinearOpBase.hpp"
47 #include "Thyra_VectorStdOps.hpp"
56 template<
class Scalar>
64 template<
class Scalar>
68 thyraModel = this->getUnderlyingModel();
69 std::ostringstream oss;
70 oss <<
"Thyra::ScaledModelEvaluator{";
73 oss <<
"\'"<<thyraModel->description()<<
"\'";
81 template<
class Scalar>
85 f_scaling_ = f_scaling;
92 template<
class Scalar>
99 using Teuchos::rcp_const_cast;
100 using Teuchos::rcp_dynamic_cast;
103 THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_BEGIN(
104 "Thyra::ScaledModelEvaluator",inArgs,outArgs
107 thyraModel->evalModel(inArgs, outArgs);
113 ele_wise_scale(*f_scaling_, f.
ptr());
116 const RCP<LinearOpBase<Scalar> > W_op = outArgs.
get_W_op();
118 const RCP<ScaledLinearOpBase<Scalar> > W_scaled =
119 rcp_dynamic_cast<ScaledLinearOpBase<Scalar> >(W_op,
true);
120 W_scaled->scaleLeft(*f_scaling_);
125 THYRA_MODEL_EVALUATOR_DECORATOR_EVAL_MODEL_END();
133 #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...