24 mp_p_index_map(mp_p_index_map_),
25 mp_g_index_map(mp_g_index_map_),
26 base_g_maps(base_g_maps_),
29 num_p_mp(mp_p_index_map.size()),
30 num_g_mp(mp_g_index_map.size())
32 InArgs me_inargs =
me->createInArgs();
33 OutArgs me_outargs =
me->createOutArgs();
35 num_g = me_outargs.Ng();
40 <<
"Error! Stokhos::MPInverseModelEvaluator::MPInverseModelEvaluator():"
41 <<
" Base response map array size does not match size of index array!");
65 l >= num_p || l < 0, std::logic_error,
66 std::endl <<
"Error! Stokhos::MPInverseModelEvaluator::get_p_map():"
67 <<
" Invalid parameter index l = " << l << std::endl);
68 return me->get_p_map(l);
76 l >= num_g || l < 0, std::logic_error,
77 std::endl <<
"Error! Stokhos::MPInverseModelEvaluator::get_g_map():"
78 <<
" Invalid response index l = " << l << std::endl);
79 return base_g_maps[l];
87 l >= num_p || l < 0, std::logic_error,
88 std::endl <<
"Error! Stokhos::MPInverseModelEvaluator::get_p_names():"
89 <<
" Invalid parameter index l = " << l << std::endl);
90 return me->get_p_names(l);
98 l >= num_p || l < 0, std::logic_error,
99 std::endl <<
"Error! Stokhos::MPInverseModelEvaluator::get_p_init():"
100 <<
" Invalid parameter index l = " << l << std::endl);
101 return me->get_p_init(l);
104 EpetraExt::ModelEvaluator::InArgs
108 InArgs me_inargs = me->createInArgs();
110 inArgs.setModelEvalDescription(this->description());
111 inArgs.set_Np(num_p);
112 for (
int i=0; i<num_p_mp; i++)
113 inArgs.setSupports(IN_ARG_p_mp, mp_p_index_map[i],
true);
118 EpetraExt::ModelEvaluator::OutArgs
121 OutArgsSetup outArgs;
122 OutArgs me_outargs = me->createOutArgs();
124 outArgs.setModelEvalDescription(this->description());
126 outArgs.set_Np_Ng(num_p, num_g);
127 for (
int i=0; i<num_g_mp; i++) {
128 outArgs.setSupports(OUT_ARG_g_mp, mp_g_index_map[i],
true);
129 for (
int j=0;
j<num_p;
j++)
130 outArgs.setSupports(OUT_ARG_DgDp_mp, mp_g_index_map[i],
j,
131 me_outargs.supports(OUT_ARG_DgDp,i,
j));
139 const OutArgs& outArgs)
const
142 InArgs me_inargs = me->createInArgs();
145 for (
int i=0; i<num_p; i++)
146 me_inargs.set_p(i, inArgs.get_p(i));
149 for (
int i=0; i<num_p_mp; i++) {
150 mp_const_vector_t p_mp = inArgs.get_p_mp(mp_p_index_map[i]);
152 me_inargs.set_p(i+num_p, p_mp->getBlockVector());
157 OutArgs me_outargs = me->createOutArgs();
161 for (
int i=0; i<num_g_mp; i++) {
162 int ii = mp_g_index_map[i];
165 mp_vector_t g_mp = outArgs.get_g_mp(ii);
167 me_outargs.set_g(i, Teuchos::rcp_dynamic_cast<Epetra_Vector>(g_mp->getBlockVector()));
171 for (
int j=0;
j<num_p;
j++) {
172 if (!outArgs.supports(OUT_ARG_DgDp_mp, ii,
j).none()) {
173 MPDerivative dgdp_mp = outArgs.get_DgDp_mp(ii,
j);
175 dgdp_mp.getMultiVector();
177 dgdp_mp.getLinearOp();
181 dgdp_mp.getMultiVectorOrientation()));
184 me_outargs.set_DgDp(i,
j, Derivative(dgdp_mp_op));
192 me->evalModel(me_inargs, me_outargs);
OutArgs createOutArgs() const
Create OutArgs.
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Evaluate model on InArgs.
int num_g_mp
Number of multi-point response vectors.
MPInverseModelEvaluator(const Teuchos::RCP< EpetraExt::ModelEvaluator > &me, const Teuchos::Array< int > &mp_p_index_map, const Teuchos::Array< int > &mp_g_index_map, const Teuchos::Array< Teuchos::RCP< const Epetra_Map > > &base_g_maps)
int num_p_mp
Number of multi-point parameter vectors.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< const Epetra_Map > get_f_map() const
Return residual vector map.
InArgs createInArgs() const
Create InArgs.
Teuchos::Array< Teuchos::RCP< const Epetra_Map > > base_g_maps
Base maps of block g vectors.
int num_p
Number of parameters.
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
Teuchos::RCP< EpetraExt::BlockMultiVector > getBlockMultiVector()
Get block vector.
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.
Teuchos::RCP< EpetraExt::ModelEvaluator > me
Underlying model evaluator.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.
Teuchos::RCP< const Epetra_Map > get_g_map(int l) const
Return response map.
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
int num_g
Number of responses.