57 #include "Thyra_ModelEvaluatorHelpers.hpp"
58 #include "Thyra_DetachedVectorView.hpp"
63 namespace NLPInterfacePack {
69 const Teuchos::RCP<Thyra::ModelEvaluator<value_type> > &model
78 const Teuchos::RCP<Thyra::ModelEvaluator<value_type> > &model
127 evalModel(x,newx,NULL,NULL,&first_order_info);
144 using Teuchos::rcp_const_cast;
145 using Teuchos::rcp_dynamic_cast;
149 typedef Thyra::ModelEvaluatorBase MEB;
151 typedef MEB::DerivativeMultiVector<value_type> DerivMV;
152 typedef MEB::Derivative<value_type> Deriv;
157 out = this->getOStream();
161 VOTSME modelOutputTempState(
model_,out,verbLevel);
163 *out <<
"\nEntering MoochoPack::NLPFirstOrderThyraModelEvaluator::calc_point(...) ...\n";
167 MEB::InArgs<value_type> model_inArgs =
model_->createInArgs();
168 MEB::OutArgs<value_type> model_outArgs =
model_->createOutArgs();
174 x,newx,zero_order_info,obj_grad_info,first_order_info
175 ,&model_inArgs,&model_outArgs,&Gc,&Gf,&f,&c
178 MatrixOpNonsing *C_aggr;
181 BasisSystemComposite::get_C_N( Gc, &C_aggr, &N_aggr );
184 rcp_const_cast<Thyra::LinearOpWithSolveBase<value_type> >(
185 dyn_cast<MatrixOpNonsingThyra>(*C_aggr).set_uninitialized()
190 model_outArgs.set_DfDp(
193 rcp_const_cast<Thyra::MultiVectorBase<value_type> >(
194 rcp_dynamic_cast<
const Thyra::MultiVectorBase<value_type> >(
195 dyn_cast<MatrixOpThyra>(*N_aggr).set_uninitialized()
198 ,MEB::DERIV_MV_BY_COL
206 model_outArgs.set_DfDp(
p_idx_,Thyra::create_DfDp_mv(*
model_,
p_idx_,MEB::DERIV_MV_BY_COL));
208 if (model_inArgs.supports(MEB::IN_ARG_alpha))
209 model_inArgs.set_alpha(0.0);
210 if (model_inArgs.supports(MEB::IN_ARG_beta))
211 model_inArgs.set_beta(1.0);
216 model_->evalModel(model_inArgs,model_outArgs);
223 RCP<MatrixOpNonsing> C_ptr;
233 RCP<Thyra::LinearOpWithSolveBase<value_type> >
234 model_W = model_outArgs.get_W();
235 model_W->setOStream(out);
236 if(showModelEvaluatorTrace())
237 model_W->setVerbLevel(verbLevel);
243 BasisSystemComposite::initialize_Gc(
253 *out <<
"\nLeaving MoochoPack::NLPFirstOrderThyraModelEvaluator::calc_point(...) ...\n";
virtual value_type & f()
Returns non-const *this->get_f().
vec_space_ptr_t space_c() const
Struct for gradient (objective), objective and constriants (pointers)
void initialize(bool test_setup)
Initialize the NLP for its first use.
Abstract interface for immutable, finite dimensional, coordinate vectors {abstract}.
void postprocessBaseOutArgs(Thyra::ModelEvaluatorBase::OutArgs< value_type > *model_outArgs_inout, VectorMutable *Gf, value_type *f, VectorMutable *c) const
void evalModel(const Vector &x, bool newx, const ZeroOrderInfo *zero_order_info, const ObjGradInfo *obj_grad_info, const FirstOrderInfo *first_order_info) const
void initializeBase(const Teuchos::RCP< Thyra::ModelEvaluator< value_type > > &model, const int p_idx, const int g_idx)
Initialize given a Thyra::ModelEvaluator and a description of how to interpret it.
void initialize(const Teuchos::RCP< Thyra::ModelEvaluator< value_type > > &model, const int p_idx, const int g_idx)
.Initialize given a Thyra::ModelEvaluator and a description of how to interpret it.
void initialize(bool test_setup)
basic_OSTab< char > OSTab
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
void unset_quantities()
Call to unset all storage quantities (both in this class and all subclasses).
T_To & dyn_cast(T_From &from)
const basis_sys_ptr_t basis_sys() const
Returns an ExampleBasisSystem.
VectorMutable adapter subclass for Thyra::VectorBase.
Struct for zero and first order quantities (pointers)
void preprocessBaseInOutArgs(const Vector &x, bool newx, const ZeroOrderInfo *zero_order_info, const ObjGradInfo *obj_grad_info, const NLPFirstOrder::FirstOrderInfo *first_order_info, Thyra::ModelEvaluatorBase::InArgs< value_type > *model_inArgs_inout, Thyra::ModelEvaluatorBase::OutArgs< value_type > *model_outArgs_inout, MatrixOp **Gc_out, VectorMutable **Gf_out, value_type **f_out, VectorMutable **c_out) const
NLPFirstOrder::mat_fcty_ptr_t factory_Gc_
Struct for objective and constriants (pointer).
const RCP< T > & assert_not_null() const
NLPFirstOrderThyraModelEvaluator()
Initialize to uninitialized.
MatrixOp adapter subclass for Thyra::LinearOpBase.
MatrixOpNonsing adapter subclass for Thyra::Nonlin::LinearOpWithSolve.
void set_Gc(MatrixOp *Gc)
Overridden to check the concrete type of Gc.
basic_FancyOStream< char > FancyOStream
vec_space_ptr_t space_x() const
virtual MatrixOp & Gc()
Returns non-const *this->get_Gc().
Teuchos::RCP< Thyra::ModelEvaluator< value_type > > model_
AbstractLinAlgPack::value_type value_type
Abstract interface for mutable coordinate vectors {abstract}.
NLPFirstOrder::basis_sys_ptr_t basis_sys_
void imp_calc_Gc(const Vector &x, bool newx, const FirstOrderInfo &first_order_info) const
virtual VectorMutable & Gf()
Returns non-const *this->get_Gf().
virtual EVerbosityLevel getVerbLevel() const
const NLPFirstOrder::mat_fcty_ptr_t factory_Gc() const
virtual void set_Gc(MatrixOp *Gc)
Set a pointer to a matrix object to be updated when this->calc_Gc() is called.
virtual VectorMutable & c()
Returns non-const *this->get_c().