10 #ifndef Thyra_ImplicitAdjointModelEvaluator_hpp
11 #define Thyra_ImplicitAdjointModelEvaluator_hpp
13 #include "Thyra_ModelEvaluatorDelegatorBase.hpp"
14 #include "Thyra_DefaultScaledAdjointLinearOp.hpp"
15 #include "Thyra_DefaultAdjointLinearOpWithSolve.hpp"
25 template <
typename Scalar>
45 RCP<LinearOpWithSolveBase<Scalar> >
create_W()
const
47 return nonconstAdjointLows(this->getUnderlyingModel()->
create_W());
53 return nonconstAdjoint(this->getUnderlyingModel()->
create_W_op());
59 return nonconstAdjointPreconditioner(
66 return adjointLinearOpWithSolveFactory(
75 MEB::OutArgs<Scalar> model_outArgs =
76 this->getUnderlyingModel()->createOutArgs();
78 if (model_outArgs.supports(MEB::OUT_ARG_W) &&
79 outArgs.
get_W() != Teuchos::null) {
80 RCP<DefaultAdjointLinearOpWithSolve<Scalar> > adjoint_op =
82 outArgs.
get_W(),
true);
83 model_outArgs.set_W(adjoint_op->getNonconstOp());
86 if (model_outArgs.supports(MEB::OUT_ARG_W_op) &&
87 outArgs.
get_W_op() != Teuchos::null) {
88 RCP<DefaultScaledAdjointLinearOp<Scalar> > adjoint_op =
91 model_outArgs.set_W_op(adjoint_op->getNonconstOp());
94 if (model_outArgs.supports(MEB::OUT_ARG_W_prec) &&
96 RCP<AdjointPreconditioner<Scalar> > adjoint_op =
99 model_outArgs.set_W_prec(adjoint_op->getNonconstPreconditioner());
102 this->getUnderlyingModel()->evalModel(inArgs, model_outArgs);
106 template <
typename Scalar>
113 template <
typename Scalar>
Concrete PreconditionerBase subclass that wraps a preconditioner operator in MultiVectorLinearOp.
RCP< PreconditionerBase< Scalar > > create_W_prec() const
Create adjoint preconditioner.
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
RCP< const LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Get adjoint solver factory.
RCP< ImplicitAdjointModelEvaluator< Scalar > > implicitAdjointModelEvaluator(const RCP< const ModelEvaluator< Scalar > > &model)
RCP< LinearOpBase< Scalar > > create_W_op() const
Create adjoint op.
RCP< LinearOpWithSolveBase< Scalar > > get_W() const
virtual ~ImplicitAdjointModelEvaluator()=default
Destructor.
An implementation of AdjointModelEvaluatorBase that creates an implicit adjoint from the supplied mod...
RCP< PreconditionerBase< Scalar > > get_W_prec() const
RCP< LinearOpWithSolveBase< Scalar > > create_W() const
Create adjoint solver.
ImplicitAdjointModelEvaluator(const RCP< const ModelEvaluator< Scalar > > &model)
Constructor.
void evalModelImpl(const ModelEvaluatorBase::InArgs< Scalar > &inArgs, const ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
RCP< LinearOpBase< Scalar > > get_W_op() const
ImplicitAdjointModelEvaluator(const RCP< ModelEvaluator< Scalar > > &model)
Constructor.