14 #include "EpetraExt_BlockUtility.h"
15 #include "EpetraExt_BlockMultiVector.h"
27 num_mp_blocks(mp_block_map_->NumMyElements()),
29 mp_block_map(mp_block_map_),
32 x_map(me->get_x_map()),
33 f_map(me->get_f_map()),
89 InArgs me_inargs =
me->createInArgs();
90 num_p = me_inargs.Np();
93 for (
int i=0; i<
num_p; i++) {
94 if (me_inargs.supports(IN_ARG_p_mp, i))
115 for (
int j=0;
j<p_names->size();
j++) {
116 std::stringstream ss;
117 ss << (*p_names)[
j] <<
" -- MP Coefficient " << i;
136 OutArgs me_outargs =
me->createOutArgs();
137 num_g = me_outargs.Ng();
140 for (
int i=0; i<
num_g; i++) {
141 if (me_outargs.supports(OUT_ARG_g_mp, i))
175 "Error! Invalid p map index " << l);
177 return me->get_p_map(l);
179 return mp_p_map[l-num_p];
188 "Error! Invalid g map index " << j);
196 "Error! Invalid p map index " << l);
198 return me->get_p_names(l);
200 return mp_p_names[l-num_p];
208 return mp_x_init->getBlockVector();
214 return mp_x_dot_init->getBlockVector();
221 "Error! Invalid p map index " << l);
223 return me->get_p_init(l);
224 else if (l < num_p + num_p_mp)
225 return mp_p_init[l-num_p]->getBlockVector();
237 mp_x_map, mp_f_map));
238 my_W->setupOperator(W_mp_blocks);
251 Teuchos::rcp(&(params->sublist(
"MP Preconditioner")),
false);
254 mp_prec_factory.
build(mp_comm, num_mp_blocks, x_map, mp_x_map);
255 return Teuchos::rcp(
new EpetraExt::ModelEvaluator::Preconditioner(precOp,
267 "Error: dg/dx index " << j <<
" is not supported!");
269 int jj = mp_g_index_map[
j];
272 OutArgs me_outargs = me->createOutArgs();
273 DerivativeSupport ds = me_outargs.supports(OUT_ARG_DgDx_mp, jj);
274 if (ds.supports(DERIV_LINEAR_OP)) {
277 mp_block_map, x_map, g_map, mp_g_map[j], mp_comm));
278 for (
unsigned int i=0; i<num_mp_blocks; i++)
281 else if (ds.supports(DERIV_MV_BY_COL)) {
284 mp_block_map, g_map, mp_g_map[j],
288 mp_mv_blocks,
false));
290 else if (ds.supports(DERIV_TRANS_MV_BY_ROW)) {
293 mp_block_map, x_map, mp_x_map,
297 mp_mv_blocks,
true));
301 "Error! me_outargs.supports(OUT_ARG_DgDx_mp, " << j
302 <<
").none() is true!");
306 mp_comm, num_mp_blocks, x_map, g_map,
307 mp_x_map, mp_g_map[j]));
317 "Error: dg/dx_dot index " << j <<
" is not supported!");
319 int jj = mp_g_index_map[
j];
322 OutArgs me_outargs = me->createOutArgs();
323 DerivativeSupport ds = me_outargs.supports(OUT_ARG_DgDx_dot_mp, jj);
324 if (ds.supports(DERIV_LINEAR_OP)) {
327 mp_block_map, x_map, g_map, mp_g_map[j],
329 for (
unsigned int i=0; i<num_mp_blocks; i++)
330 mp_blocks->
setCoeffPtr(i, me->create_DgDx_dot_op(jj));
332 else if (ds.supports(DERIV_MV_BY_COL)) {
335 mp_block_map, g_map, mp_g_map[j],
339 mp_mv_blocks,
false));
341 else if (ds.supports(DERIV_TRANS_MV_BY_ROW)) {
344 mp_block_map, x_map, mp_x_map,
348 mp_mv_blocks,
true));
352 "Error! me_outargs.supports(OUT_ARG_DgDx_dot_mp, "
353 << j <<
").none() is true!");
357 mp_comm, num_mp_blocks, x_map, g_map,
358 mp_x_map, mp_g_map[j]));
367 j < 0 || j >= num_g_mp || i < 0 || i >= num_p+num_p_mp,
369 "Error: dg/dp index " << j <<
"," << i <<
" is not supported!");
371 OutArgs me_outargs = me->createOutArgs();
372 int jj = mp_g_index_map[
j];
375 if (me_outargs.supports(OUT_ARG_DgDp_mp,jj,i).supports(DERIV_LINEAR_OP)) {
378 mp_block_map, me->get_p_map(i), g_map,
379 mp_g_map[
j], mp_comm));
380 for (
unsigned int l=0; l<num_mp_blocks; l++)
381 mp_blocks->
setCoeffPtr(l, me->create_DgDp_op(i,j));
386 true, std::logic_error,
387 "Error: Underlying model evaluator must support DERIV_LINER_OP " <<
388 "to create operator for dg/dp index " << j <<
"," << i <<
"!");
391 int ii = mp_p_index_map[i-num_p];
394 DerivativeSupport ds = me_outargs.supports(OUT_ARG_DgDp_mp,jj,ii);
395 if (ds.supports(DERIV_LINEAR_OP)) {
398 mp_block_map, p_map, g_map,
399 mp_g_map[j], mp_comm));
400 for (
unsigned int l=0; l<num_mp_blocks; l++)
401 mp_blocks->
setCoeffPtr(l, me->create_DgDp_op(jj,ii));
403 else if (ds.supports(DERIV_MV_BY_COL)) {
406 mp_block_map, g_map, mp_g_map[j],
410 mp_mv_blocks,
false));
412 else if (ds.supports(DERIV_TRANS_MV_BY_ROW)) {
415 mp_block_map, p_map, mp_p_map[i-num_p],
419 mp_mv_blocks,
true));
423 "Error! me_outargs.supports(OUT_ARG_DgDp_mp, " << jj
424 <<
"," << ii <<
").none() is true!");
428 mp_comm, num_mp_blocks, p_map, g_map,
429 mp_p_map[i-num_p], mp_g_map[j]));
442 "Error: df/dp index " << i <<
" is not supported!");
444 OutArgs me_outargs = me->createOutArgs();
446 if (me_outargs.supports(OUT_ARG_DfDp_mp,i).supports(DERIV_LINEAR_OP)) {
449 mp_block_map, me->get_p_map(i), me->get_f_map(),
451 for (
unsigned int l=0; l<num_mp_blocks; l++)
457 true, std::logic_error,
458 "Error: Underlying model evaluator must support DERIV_LINER_OP " <<
459 "to create operator for df/dp index " << i <<
"!");
462 int ii = mp_p_index_map[i-num_p];
465 DerivativeSupport ds = me_outargs.supports(OUT_ARG_DfDp_mp,ii);
466 if (ds.supports(DERIV_LINEAR_OP)) {
469 mp_block_map, me->get_p_map(ii), me->get_f_map(),
471 for (
unsigned int l=0; l<num_mp_blocks; l++)
474 else if (ds.supports(DERIV_MV_BY_COL)) {
477 mp_block_map, f_map, mp_f_map,
481 mp_mv_blocks,
false));
483 else if (ds.supports(DERIV_TRANS_MV_BY_ROW)) {
486 mp_block_map, p_map, mp_p_map[i-num_p],
490 mp_mv_blocks,
true));
494 "Error! me_outargs.supports(OUT_ARG_DfDp_mp, " << ii
495 <<
").none() is true!");
500 mp_comm, num_mp_blocks,
501 p_map, f_map, mp_p_map[i-num_p], mp_f_map));
509 EpetraExt::ModelEvaluator::InArgs
513 InArgs me_inargs = me->createInArgs();
515 inArgs.setModelEvalDescription(this->description());
516 inArgs.set_Np(num_p + num_p_mp);
517 inArgs.setSupports(IN_ARG_x_dot, me_inargs.supports(IN_ARG_x_dot));
518 inArgs.setSupports(IN_ARG_x, me_inargs.supports(IN_ARG_x));
519 inArgs.setSupports(IN_ARG_t, me_inargs.supports(IN_ARG_t));
520 inArgs.setSupports(IN_ARG_alpha, me_inargs.supports(IN_ARG_alpha));
521 inArgs.setSupports(IN_ARG_beta, me_inargs.supports(IN_ARG_beta));
526 EpetraExt::ModelEvaluator::OutArgs
529 OutArgsSetup outArgs;
530 OutArgs me_outargs = me->createOutArgs();
532 outArgs.setModelEvalDescription(this->description());
533 outArgs.set_Np_Ng(num_p + num_p_mp, num_g_mp);
534 outArgs.setSupports(OUT_ARG_f, me_outargs.supports(OUT_ARG_f));
535 outArgs.setSupports(OUT_ARG_W, me_outargs.supports(OUT_ARG_W));
536 outArgs.setSupports(OUT_ARG_WPrec, me_outargs.supports(OUT_ARG_W));
537 for (
int j=0;
j<num_p;
j++)
538 outArgs.setSupports(OUT_ARG_DfDp,
j,
539 me_outargs.supports(OUT_ARG_DfDp,
j));
540 for (
int j=0;
j<num_p_mp;
j++)
541 if (!me_outargs.supports(OUT_ARG_DfDp_mp, mp_p_index_map[
j]).none())
542 outArgs.setSupports(OUT_ARG_DfDp, j+num_p, DERIV_LINEAR_OP);
543 for (
int i=0; i<num_g_mp; i++) {
544 int ii = mp_g_index_map[i];
545 if (!me_outargs.supports(OUT_ARG_DgDx_dot_mp, ii).none())
546 outArgs.setSupports(OUT_ARG_DgDx_dot, i, DERIV_LINEAR_OP);
547 if (!me_outargs.supports(OUT_ARG_DgDx_mp, ii).none())
548 outArgs.setSupports(OUT_ARG_DgDx, i, DERIV_LINEAR_OP);
549 for (
int j=0; j<num_p; j++)
550 outArgs.setSupports(OUT_ARG_DgDp, i, j,
551 me_outargs.supports(OUT_ARG_DgDp_mp, ii, j));
552 for (
int j=0; j<num_p_mp; j++)
553 if (!me_outargs.supports(OUT_ARG_DgDp_mp, ii, mp_p_index_map[j]).none())
554 outArgs.setSupports(OUT_ARG_DgDp, i, j+num_p, DERIV_LINEAR_OP);
562 const OutArgs& outArgs)
const
566 if (inArgs.supports(IN_ARG_x)) {
572 if (inArgs.supports(IN_ARG_x_dot))
573 x_dot = inArgs.get_x_dot();
576 EpetraExt::ModelEvaluator::Evaluation<Epetra_Vector> f_out;
577 if (outArgs.supports(OUT_ARG_f))
578 f_out = outArgs.get_f();
580 if (outArgs.supports(OUT_ARG_W))
581 W_out = outArgs.get_W();
583 if (outArgs.supports(OUT_ARG_WPrec))
584 WPrec_out = outArgs.get_WPrec();
600 for (
int i=0; i<outArgs.Ng(); i++) {
602 for (
int j=0;
j<outArgs.Np();
j++)
603 if (!outArgs.supports(OUT_ARG_DgDp, i,
j).none())
604 done = done && (outArgs.get_DgDp(i,
j).isEmpty());
611 InArgs me_inargs = me->createInArgs();
615 me_inargs.set_x_mp(x_mp);
619 create_x_mp(
View, x_dot.
get());
620 me_inargs.set_x_dot_mp(x_dot_mp);
622 if (me_inargs.supports(IN_ARG_alpha))
623 me_inargs.set_alpha(inArgs.get_alpha());
624 if (me_inargs.supports(IN_ARG_beta))
625 me_inargs.set_beta(inArgs.get_beta());
626 if (me_inargs.supports(IN_ARG_t))
627 me_inargs.set_t(inArgs.get_t());
630 for (
int i=0; i<num_p; i++)
631 me_inargs.set_p(i, inArgs.get_p(i));
632 for (
int i=0; i<num_p_mp; i++) {
638 p = mp_p_init[i]->getBlockVector();
642 create_p_mp(mp_p_index_map[i],
View, p.
get());
643 me_inargs.set_p_mp(mp_p_index_map[i], p_mp);
647 OutArgs me_outargs = me->createOutArgs();
652 create_f_mp(
View, f_out.get());
653 me_outargs.set_f_mp(f_mp);
658 me_outargs.set_W_mp(W_mp_blocks);
661 for (
int i=0; i<num_p; i++) {
662 if (!outArgs.supports(OUT_ARG_DfDp, i).none()) {
663 Derivative dfdp = outArgs.get_DfDp(i);
666 if (dfdp.getMultiVectorOrientation() == DERIV_MV_BY_COL)
669 mp_block_map, me->get_f_map(), mp_f_map, mp_comm,
670 View, *(dfdp.getMultiVector())));
671 else if (dfdp.getMultiVectorOrientation() == DERIV_TRANS_MV_BY_ROW)
674 mp_block_map, me->get_p_map(i), mp_p_map[i], mp_comm,
675 View, *(dfdp.getMultiVector())));
676 me_outargs.set_DfDp_mp(i,
677 MPDerivative(dfdp_mp,
678 dfdp.getMultiVectorOrientation()));
683 me_outargs.set_DfDp_mp(i, MPDerivative(dfdp_mp));
689 for (
int i=0; i<num_p_mp; i++) {
690 if (!outArgs.supports(OUT_ARG_DfDp, i+num_p).none()) {
691 Derivative dfdp = outArgs.get_DfDp(i+num_p);
697 int ii = mp_p_index_map[i];
698 if (me_outargs.supports(OUT_ARG_DfDp_mp,ii).supports(DERIV_LINEAR_OP))
699 me_outargs.set_DfDp_mp(ii, MPDerivative(dfdp_op_mp));
705 if (me_outargs.supports(OUT_ARG_DfDp_mp,ii).supports(DERIV_MV_BY_COL))
706 me_outargs.set_DfDp_mp(
707 ii, MPDerivative(dfdp_mp, DERIV_MV_BY_COL));
709 me_outargs.set_DfDp_mp(
710 ii, MPDerivative(dfdp_mp, DERIV_TRANS_MV_BY_ROW));
714 dfdp.getLinearOp() ==
Teuchos::null && dfdp.isEmpty() ==
false,
716 "Error! Stokhos::MPModelEvaluator::evalModel: " <<
717 "Operator form of df/dp(" << i+num_p <<
") is required!");
722 for (
int i=0; i<num_g_mp; i++) {
723 int ii = mp_g_index_map[i];
729 create_g_mp(ii,
View, g.
get());
730 me_outargs.set_g_mp(ii, g_mp);
734 if (outArgs.supports(OUT_ARG_DgDx_dot, i).supports(DERIV_LINEAR_OP)) {
735 Derivative dgdx_dot = outArgs.get_DgDx_dot(i);
739 dgdx_dot.getLinearOp(),
true);
742 if (me_outargs.supports(OUT_ARG_DgDx, ii).supports(DERIV_LINEAR_OP))
743 me_outargs.set_DgDx_dot_mp(ii, mp_blocks);
749 if (me_outargs.supports(OUT_ARG_DgDx_dot_mp, ii).supports(DERIV_MV_BY_COL))
750 me_outargs.set_DgDx_dot_mp(ii, MPDerivative(dgdx_dot_mp,
753 me_outargs.set_DgDx_dot_mp(ii, MPDerivative(dgdx_dot_mp,
754 DERIV_TRANS_MV_BY_ROW));
758 dgdx_dot.isEmpty() ==
false,
760 "Error! Stokhos::MPModelEvaluator::evalModel: " <<
761 "Operator form of dg/dxdot is required!");
765 if (outArgs.supports(OUT_ARG_DgDx, i).supports(DERIV_LINEAR_OP)) {
766 Derivative dgdx = outArgs.get_DgDx(i);
770 dgdx.getLinearOp(),
true);
773 if (me_outargs.supports(OUT_ARG_DgDx, ii).supports(DERIV_LINEAR_OP))
774 me_outargs.set_DgDx_mp(ii, mp_blocks);
780 if (me_outargs.supports(OUT_ARG_DgDx_mp, ii).supports(DERIV_MV_BY_COL))
781 me_outargs.set_DgDx_mp(ii, MPDerivative(dgdx_mp,
784 me_outargs.set_DgDx_mp(ii, MPDerivative(dgdx_mp,
785 DERIV_TRANS_MV_BY_ROW));
789 dgdx.isEmpty() ==
false,
791 "Error! Stokhos::MPModelEvaluator::evalModel: " <<
792 "Operator form of dg/dxdot is required!");
796 for (
int j=0;
j<num_p;
j++) {
797 if (!outArgs.supports(OUT_ARG_DgDp, i,
j).none()) {
798 Derivative dgdp = outArgs.get_DgDp(i,
j);
801 if (dgdp.getMultiVectorOrientation() == DERIV_MV_BY_COL)
804 mp_block_map, me->get_g_map(ii), mp_g_map[i],
805 mp_comm,
View, *(dgdp.getMultiVector())));
806 else if (dgdp.getMultiVectorOrientation() == DERIV_TRANS_MV_BY_ROW)
809 mp_block_map, me->get_p_map(
j), mp_p_map[
j],
810 mp_comm, View, *(dgdp.getMultiVector())));
811 me_outargs.set_DgDp_mp(
812 ii,
j, MPDerivative(dgdp_mp, dgdp.getMultiVectorOrientation()));
817 me_outargs.set_DgDp_mp(ii,
j, MPDerivative(dgdp_mp));
823 for (
int j=0;
j<num_p_mp;
j++) {
824 if (!outArgs.supports(OUT_ARG_DgDp, i,
j+num_p).none()) {
825 Derivative dgdp = outArgs.get_DgDp(i,
j+num_p);
831 int jj = mp_p_index_map[
j];
832 if (me_outargs.supports(OUT_ARG_DgDp_mp,ii,jj).supports(DERIV_LINEAR_OP))
833 me_outargs.set_DgDp_mp(ii, jj, MPDerivative(dgdp_op_mp));
839 if (me_outargs.supports(OUT_ARG_DgDp_mp,ii,jj).supports(DERIV_MV_BY_COL))
840 me_outargs.set_DgDp_mp(
841 ii, jj, MPDerivative(dgdp_mp, DERIV_MV_BY_COL));
843 me_outargs.set_DgDp_mp(
844 ii, jj, MPDerivative(dgdp_mp, DERIV_TRANS_MV_BY_ROW));
848 dgdp.getLinearOp() ==
Teuchos::null && dgdp.isEmpty() ==
false,
850 "Error! Stokhos::MPModelEvaluator::evalModel: " <<
851 "Operator form of dg/dp(" << i <<
"," <<
j+num_p <<
") is required!");
858 me->evalModel(me_inargs, me_outargs);
883 *mp_x_init = x_mp_in;
890 *mp_x_dot_init = x_dot_mp_in;
902 return mp_x_dot_init;
910 mp_p_index_map.end(),
913 "Error! Invalid p map index " << i);
914 int ii = it - mp_p_index_map.
begin();
915 *mp_p_init[ii] = p_mp_in;
922 mp_p_index_map.end(),
925 "Error! Invalid p map index " << l);
926 int ll = it - mp_p_index_map.
begin();
927 return mp_p_init[ll];
933 return mp_p_index_map;
939 return mp_g_index_map;
946 for (
int i=0; i<num_g; i++)
947 base_maps[i] = me->get_g_map(i);
958 mp_block_map, x_map, mp_x_map, mp_comm));
961 mp_block_map, x_map, mp_x_map, mp_comm,
973 mp_block_map, x_map, mp_x_map, mp_comm,
977 mp_block_map, x_map, mp_x_map, mp_comm,
988 mp_p_index_map.end(),
991 "Error! Invalid p map index " << l);
992 int ll = it - mp_p_index_map.
begin();
995 mp_block_map, me->get_p_map(l),
996 mp_p_map[ll], mp_comm));
999 mp_block_map, me->get_p_map(l),
1000 mp_p_map[ll], mp_comm, CV, *v));
1011 mp_p_index_map.end(),
1014 "Error! Invalid p map index " << l);
1015 int ll = it - mp_p_index_map.
begin();
1018 mp_block_map, me->get_p_map(l),
1019 mp_p_map[ll], mp_comm, num_vecs));
1022 mp_block_map, me->get_p_map(l),
1023 mp_p_map[ll], mp_comm, CV, *v));
1034 mp_block_map, f_map, mp_f_map, mp_comm));
1037 mp_block_map, f_map, mp_f_map, mp_comm,
1051 mp_block_map, f_map, mp_f_map, mp_comm,
1055 mp_block_map, f_map, mp_f_map, mp_comm,
1066 mp_g_index_map.end(),
1069 "Error! Invalid g map index " << l);
1070 int ll = it - mp_g_index_map.
begin();
1075 mp_g_map[ll], mp_comm));
1080 mp_g_map[ll], mp_comm, CV, *v));
1091 mp_g_index_map.end(),
1094 "Error! Invalid g map index " << l);
1095 int ll = it - mp_g_index_map.
begin();
1100 mp_g_map[ll], mp_comm, num_vecs));
1105 mp_g_map[ll], mp_comm, CV, *v));
Teuchos::RCP< const Stokhos::ProductEpetraVector > get_x_dot_mp_init() const
Factory for generating stochastic Galerkin preconditioners.
Teuchos::RCP< const Epetra_Map > mp_x_map
Block MP unknown map.
void setCoeffPtr(ordinal_type i, const Teuchos::RCP< coeff_type > &c)
Set coefficient i to c.
Teuchos::RCP< Stokhos::ProductEpetraMultiVector > create_g_mv_mp(int l, int num_vecs, Epetra_DataAccess CV=Copy, const Epetra_MultiVector *v=NULL) const
Create multi-point multi-vector using g map.
void evalModel(const InArgs &inArgs, const OutArgs &outArgs) const
Evaluate model on InArgs.
Teuchos::RCP< const Epetra_Vector > get_x_dot_init() const
Teuchos::RCP< Stokhos::ProductEpetraMultiVector > create_f_mv_mp(int num_vecs, Epetra_DataAccess CV=Copy, const Epetra_MultiVector *v=NULL) const
Create multi-point multi-vector using f map.
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.
Teuchos::RCP< Epetra_Operator > create_DgDp_op(int j, int i) const
Create MP operator representing dg/dp.
Teuchos::RCP< Epetra_Operator > create_W() const
Create W = alpha*M + beta*J matrix.
A container class for products of Epetra_Vector's.
bool supports_x
Whether we support x (and thus f and W)
virtual Teuchos::RCP< Stokhos::MPPreconditioner > build(const Teuchos::RCP< const EpetraExt::MultiComm > &mp_comm, int num_mp_blocks, const Teuchos::RCP< const Epetra_Map > &base_map, const Teuchos::RCP< const Epetra_Map > &mp_map)
Build preconditioner operator.
Teuchos::RCP< const Stokhos::ProductEpetraVector > get_p_mp_init(int l) const
Return initial SG parameters.
void set_x_mp_init(const Stokhos::ProductEpetraVector &x_mp_in)
Set initial multi-point solution.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Teuchos::RCP< Stokhos::ProductEpetraVector > create_x_mp(Epetra_DataAccess CV=Copy, const Epetra_Vector *v=NULL) const
Create multi-point vector using x map and owned mp map.
int num_p_mp
Number of multi-point parameter vectors.
int num_p
Number of parameter vectors of underlying model evaluator.
Teuchos::RCP< const Epetra_Vector > get_x_init() const
Return initial solution.
Teuchos::RCP< Stokhos::ProductEpetraMultiVector > create_x_mv_mp(int num_vecs, Epetra_DataAccess CV=Copy, const Epetra_MultiVector *v=NULL) const
Create multi-point vector using x map.
Teuchos::RCP< Stokhos::ProductEpetraVector > create_g_mp(int l, Epetra_DataAccess CV=Copy, const Epetra_Vector *v=NULL) const
Create multi-point vector using g map.
Teuchos::Array< Teuchos::RCP< const Epetra_Map > > mp_g_map
Block MP response map.
void set_x_dot_mp_init(const Stokhos::ProductEpetraVector &x_dot_mp_in)
Teuchos::Array< int > mp_p_index_map
Index map between block-p and p_mp maps.
Teuchos::Array< Teuchos::RCP< const Epetra_Map > > get_g_mp_base_maps() const
Get base maps of MP responses.
Teuchos::RCP< EpetraExt::ModelEvaluator::Preconditioner > create_WPrec() const
Create preconditioner operator.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int l) const
Return array of parameter names.
virtual void setupOperator(const Teuchos::RCP< Stokhos::ProductEpetraOperator > &ops)
Setup operator.
int NumMyElements() const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::RCP< Stokhos::ProductEpetraVector > create_f_mp(Epetra_DataAccess CV=Copy, const Epetra_Vector *v=NULL) const
Create multi-point vector using f map.
Teuchos::Array< int > get_g_mp_map_indices() const
Get indices of MP responses.
A container class for products of Epetra_Vector's.
Teuchos::RCP< EpetraExt::ModelEvaluator > me
Underlying model evaluator.
Teuchos::RCP< Stokhos::ProductEpetraOperator > W_mp_blocks
W multi-point components.
An Epetra operator representing the block stochastic Galerkin operator.
Teuchos::RCP< Stokhos::ProductEpetraVector > mp_x_dot_init
Teuchos::RCP< const Epetra_Map > f_map
Underlying residual map.
A container class for products of Epetra_Vector's.
Teuchos::RCP< Stokhos::ProductEpetraMultiVector > create_p_mv_mp(int l, int num_vecs, Epetra_DataAccess CV=Copy, const Epetra_MultiVector *v=NULL) const
Create multi-point vector using p map.
Teuchos::RCP< Epetra_Operator > create_DgDx_op(int j) const
Create MP operator representing dg/dx.
OutArgs createOutArgs() const
Create OutArgs.
Teuchos::RCP< Epetra_Operator > create_DgDx_dot_op(int j) const
Create MP operator representing dg/dxdot.
A container class storing products of Epetra_MultiVector's.
Teuchos::RCP< const Epetra_Map > get_p_map(int l) const
Return parameter vector map.
std::vector< T >::const_iterator const_iterator
Teuchos::RCP< const Epetra_Map > mp_block_map
Map for layout of parallel MP blocks.
MPModelEvaluator(const Teuchos::RCP< EpetraExt::ModelEvaluator > &me, const Teuchos::RCP< const EpetraExt::MultiComm > &mp_comm, const Teuchos::RCP< const Epetra_Map > &mp_block_map, const Teuchos::RCP< Teuchos::ParameterList > ¶ms)
Teuchos::Array< Teuchos::RCP< ProductEpetraVector > > mp_p_init
MP initial p.
Teuchos::RCP< Epetra_Vector > my_x
x pointer for evaluating preconditioner
Teuchos::Array< int > mp_g_index_map
Index map between block-g and g_mp maps.
Teuchos::RCP< const Epetra_Map > mp_f_map
Block MP residual map.
Teuchos::RCP< const Stokhos::ProductEpetraVector > get_x_mp_init() const
Return initial SG x.
void push_back(const value_type &x)
Teuchos::RCP< const Epetra_Map > x_map
Underlying unknown map.
virtual Teuchos::RCP< Stokhos::ProductEpetraOperator > getMPOps()
Get multi-point ops.
Teuchos::Array< int > get_p_mp_map_indices() const
Get indices of MP parameters.
int num_g
Number of response vectors of underlying model evaluator.
int num_g_mp
Number of multi-point response vectors.
virtual void setupPreconditioner(const Teuchos::RCP< Stokhos::BlockDiagonalOperator > &mp_op, const Epetra_Vector &x)=0
Setup preconditioner.
An abstract class to represent a generic stochastic Galerkin preconditioner as an Epetra_Operator...
InArgs createInArgs() const
Create InArgs.
Teuchos::RCP< const Epetra_Map > get_x_map() const
Return solution vector map.
Teuchos::RCP< ProductEpetraMultiVector > productMultiVector() const
Get product multi vector.
Teuchos::RCP< const EpetraExt::MultiComm > mp_comm
Parallel MP communicator.
std::vector< T >::iterator iterator
Teuchos::Array< Teuchos::RCP< const Epetra_Map > > mp_p_map
Block MP parameter map.
unsigned int num_mp_blocks
Number of blocks.
void set_p_mp_init(int i, const Stokhos::ProductEpetraVector &p_mp_in)
Set initial multi-point parameter.
Teuchos::RCP< const Epetra_Vector > get_p_init(int l) const
Return initial parameters.
Teuchos::RCP< Stokhos::ProductEpetraVector > mp_x_init
MP initial x.
ScalarType g(const Teuchos::Array< ScalarType > &x, const ScalarType &y)
Teuchos::RCP< Epetra_Operator > create_DfDp_op(int i) const
Create MP operator representing df/dp.
Teuchos::Array< Teuchos::RCP< Teuchos::Array< std::string > > > mp_p_names
MP coefficient parameter names.
Teuchos::RCP< Stokhos::ProductEpetraVector > create_p_mp(int l, Epetra_DataAccess CV=Copy, const Epetra_Vector *v=NULL) const
Create multi-point vector using p map.