56 sg_p_index_map(sg_p_index_map_),
57 sg_g_index_map(sg_g_index_map_),
58 base_g_maps(base_g_maps_),
61 num_p_sg(sg_p_index_map.size()),
62 num_g_sg(sg_g_index_map.size())
64 InArgs me_inargs =
me->createInArgs();
65 OutArgs me_outargs =
me->createOutArgs();
67 num_g = me_outargs.Ng();
72 <<
"Error! Stokhos::SGInverseModelEvaluator::SGInverseModelEvaluator():"
73 <<
" Base response map array size does not match size of index array!");
97 l >= num_p || l < 0, std::logic_error,
98 std::endl <<
"Error! Stokhos::SGInverseModelEvaluator::get_p_map():"
99 <<
" Invalid parameter index l = " << l << std::endl);
100 return me->get_p_map(l);
108 l >= num_g || l < 0, std::logic_error,
109 std::endl <<
"Error! Stokhos::SGInverseModelEvaluator::get_g_map():"
110 <<
" Invalid response index l = " << l << std::endl);
111 return base_g_maps[l];
119 l >= num_p || l < 0, std::logic_error,
120 std::endl <<
"Error! Stokhos::SGInverseModelEvaluator::get_p_names():"
121 <<
" Invalid parameter index l = " << l << std::endl);
122 return me->get_p_names(l);
130 l >= num_p || l < 0, std::logic_error,
131 std::endl <<
"Error! Stokhos::SGInverseModelEvaluator::get_p_init():"
132 <<
" Invalid parameter index l = " << l << std::endl);
133 return me->get_p_init(l);
136 EpetraExt::ModelEvaluator::InArgs
140 InArgs me_inargs = me->createInArgs();
142 inArgs.setModelEvalDescription(this->description());
143 inArgs.set_Np(num_p);
144 for (
int i=0; i<num_p_sg; i++)
145 inArgs.setSupports(IN_ARG_p_sg, sg_p_index_map[i],
true);
146 inArgs.setSupports(IN_ARG_sg_basis, me_inargs.supports(IN_ARG_sg_basis));
147 inArgs.setSupports(IN_ARG_sg_quadrature,
148 me_inargs.supports(IN_ARG_sg_quadrature));
149 inArgs.setSupports(IN_ARG_sg_expansion,
150 me_inargs.supports(IN_ARG_sg_expansion));
155 EpetraExt::ModelEvaluator::OutArgs
158 OutArgsSetup outArgs;
159 OutArgs me_outargs = me->createOutArgs();
161 outArgs.setModelEvalDescription(this->description());
163 outArgs.set_Np_Ng(num_p, num_g);
164 for (
int i=0; i<num_g_sg; i++) {
165 outArgs.setSupports(OUT_ARG_g_sg, sg_g_index_map[i],
true);
166 for (
int j=0;
j<num_p;
j++)
167 outArgs.setSupports(OUT_ARG_DgDp_sg, sg_g_index_map[i],
j,
168 me_outargs.supports(OUT_ARG_DgDp, i,
j));
176 const OutArgs& outArgs)
const
179 InArgs me_inargs = me->createInArgs();
182 for (
int i=0; i<num_p; i++)
183 me_inargs.set_p(i, inArgs.get_p(i));
186 for (
int i=0; i<num_p_sg; i++) {
187 InArgs::sg_const_vector_t p_sg = inArgs.get_p_sg(sg_p_index_map[i]);
189 me_inargs.set_p(i+num_p, p_sg->getBlockVector());
194 if (me_inargs.supports(IN_ARG_sg_basis))
195 me_inargs.set_sg_basis(inArgs.get_sg_basis());
196 if (me_inargs.supports(IN_ARG_sg_quadrature))
197 me_inargs.set_sg_quadrature(inArgs.get_sg_quadrature());
198 if (me_inargs.supports(IN_ARG_sg_expansion))
199 me_inargs.set_sg_expansion(inArgs.get_sg_expansion());
202 OutArgs me_outargs = me->createOutArgs();
205 for (
int i=0; i<num_g_sg; i++) {
206 int ii = sg_g_index_map[i];
209 OutArgs::sg_vector_t g_sg = outArgs.get_g_sg(ii);
211 me_outargs.set_g(i, Teuchos::rcp_dynamic_cast<Epetra_Vector>(g_sg->getBlockVector()));
215 for (
int j=0;
j<num_p;
j++) {
216 if (!outArgs.supports(OUT_ARG_DgDp_sg, ii,
j).none()) {
217 SGDerivative dgdp_sg = outArgs.get_DgDp_sg(ii,
j);
219 dgdp_sg.getMultiVector();
221 dgdp_sg.getLinearOp();
225 dgdp_sg.getMultiVectorOrientation()));
228 me_outargs.set_DgDp(i,
j, Derivative(dgdp_sg_op));
236 me->evalModel(me_inargs, me_outargs);
Teuchos::Array< Teuchos::RCP< const Epetra_Map > > base_g_maps
Base maps of block g vectors.
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
SGInverseModelEvaluator(const Teuchos::RCP< EpetraExt::ModelEvaluator > &me, const Teuchos::Array< int > &sg_p_index_map, const Teuchos::Array< int > &sg_g_index_map, const Teuchos::Array< Teuchos::RCP< const Epetra_Map > > &base_g_maps)
InArgs createInArgs() const
Create InArgs.
Teuchos::RCP< EpetraExt::ModelEvaluator > me
Underlying model evaluator.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
OutArgs createOutArgs() const
Create OutArgs.
int num_g_sg
Number of stochastic response vectors.
int num_p_sg
Number of stochastic parameter vectors.
int num_p
Number of parameters.
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Evaluate model on InArgs.
Teuchos::RCP< EpetraExt::BlockMultiVector > getBlockMultiVector()
Get block vector.
Teuchos::RCP< const Epetra_Map > get_f_map() const
Return residual vector map.
Teuchos::RCP< const Epetra_Map > get_g_map(int l) const
Return response map.
int num_g
Number of responses.
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.