42 #ifndef EPETRA_EXT_MODEL_EVALUATOR_HPP 43 #define EPETRA_EXT_MODEL_EVALUATOR_HPP 47 #include "Teuchos_RefCountPtr.hpp" 48 #include "Teuchos_Describable.hpp" 49 #include "Teuchos_Polynomial.hpp" 50 #include "Teuchos_Array.hpp" 52 #ifdef HAVE_PYTRILINOS 55 typedef _object PyObject;
61 class Epetra_Operator;
65 class EpetraVectorOrthogPoly;
66 class EpetraMultiVectorOrthogPoly;
67 class EpetraOperatorOrthogPoly;
69 template <
typename ordinal_type,
typename scalar_type>
class Quadrature;
73 class ProductEpetraVector;
74 class ProductEpetraMultiVector;
75 class ProductEpetraOperator;
93 typedef Teuchos::RCP<Stokhos::ProductEpetraVector>
mp_vector_t;
111 ,IN_ARG_sg_quadrature
114 static const int NUM_E_IN_ARGS_MEMBERS=14;
136 std::string modelEvalDescription()
const;
140 void set_x_dot(
const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot );
142 Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot()
const;
144 void set_x(
const Teuchos::RefCountPtr<const Epetra_Vector> &x );
146 Teuchos::RefCountPtr<const Epetra_Vector> get_x()
const;
148 const Teuchos::RefCountPtr<
const Teuchos::Polynomial<Epetra_Vector> > &x_poly
151 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_poly()
const;
154 const Teuchos::RefCountPtr<
const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly
157 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dot_poly()
const;
159 void set_x_sg(
const sg_const_vector_t &x_sg);
161 sg_const_vector_t get_x_sg()
const;
163 void set_x_dot_sg(
const sg_const_vector_t &x_dot_sg);
165 sg_const_vector_t get_x_dot_sg()
const;
167 void set_x_mp(
const mp_const_vector_t &x_mp);
169 mp_const_vector_t get_x_mp()
const;
171 void set_x_dot_mp(
const mp_const_vector_t &x_dot_mp);
173 mp_const_vector_t get_x_dot_mp()
const;
175 void set_p(
int l,
const Teuchos::RefCountPtr<const Epetra_Vector> &p_l );
177 Teuchos::RefCountPtr<const Epetra_Vector> get_p(
int l)
const;
179 void set_p_sg(
int l,
const sg_const_vector_t &p_sg_l );
181 sg_const_vector_t get_p_sg(
int l)
const;
183 void set_p_mp(
int l,
const mp_const_vector_t &p_mp_l );
185 mp_const_vector_t get_p_mp(
int l)
const;
187 void set_t(
double t );
189 double get_alpha()
const;
191 void set_alpha(
double alpha );
193 double get_beta()
const;
195 void set_beta(
double beta );
197 double get_t()
const;
199 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > get_sg_basis()
const;
203 Teuchos::RCP<const Stokhos::Quadrature<int,double> > get_sg_quadrature()
const;
207 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > > get_sg_expansion()
const;
218 void _setModelEvalDescription(
const std::string &modelEvalDescription );
220 void _set_Np(
int Np);
224 void _setSupports(
EInArgs_p_sg arg,
int l,
bool supports );
226 void _setSupports(
EInArgs_p_mp arg,
int l,
bool supports );
229 typedef Teuchos::Array<Teuchos::RefCountPtr<const Epetra_Vector> > p_t;
230 typedef Teuchos::Array<sg_const_vector_t > p_sg_t;
231 typedef Teuchos::Array<mp_const_vector_t > p_mp_t;
232 typedef Teuchos::Array<bool> supports_p_sg_t;
234 std::string modelEvalDescription_;
235 Teuchos::RefCountPtr<const Epetra_Vector> x_dot_;
236 Teuchos::RefCountPtr<const Epetra_Vector> x_;
237 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dot_poly_;
238 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_poly_;
239 sg_const_vector_t x_dot_sg_;
240 sg_const_vector_t x_sg_;
241 mp_const_vector_t x_dot_mp_;
242 mp_const_vector_t x_mp_;
249 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > sg_basis_;
250 Teuchos::RCP<const Stokhos::Quadrature<int,double> > sg_quad_;
251 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > > sg_exp_;
252 bool supports_[NUM_E_IN_ARGS_MEMBERS];
253 supports_p_sg_t supports_p_sg_;
254 supports_p_sg_t supports_p_mp_;
259 void assert_l(
int l)
const;
265 ,EVAL_TYPE_APPROX_DERIV
266 ,EVAL_TYPE_VERY_APPROX_DERIV
270 template<
class ObjType>
277 :
Teuchos::RefCountPtr<ObjType>(obj), evalType_(EVAL_TYPE_EXACT) {}
280 :
Teuchos::RefCountPtr<ObjType>(obj), evalType_(evalType) {}
285 { this->operator=(obj); evalType_ = evalType; }
293 ,DERIV_TRANS_MV_BY_ROW
304 :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false)
308 :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false)
312 :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
313 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
318 :supportsLinearOp_(true), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
319 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
326 :supportsLinearOp_(false)
328 mvOrientation1==DERIV_MV_BY_COL||mvOrientation2==DERIV_MV_BY_COL )
329 ,supportsTransMVByRow_(
330 mvOrientation1==DERIV_TRANS_MV_BY_ROW||mvOrientation2==DERIV_TRANS_MV_BY_ROW )
334 { supportsLinearOp_ =
true;
return *
this; }
338 switch(mvOrientation) {
339 case DERIV_MV_BY_COL: supportsMVByCol_ =
true;
break;
340 case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ =
true;
break;
341 default: TEUCHOS_TEST_FOR_EXCEPT(
true);
347 {
return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); }
350 {
return supportsLinearOp_; }
354 switch(mvOrientation) {
355 case DERIV_MV_BY_COL:
return supportsMVByCol_;
356 case DERIV_TRANS_MV_BY_ROW:
return supportsTransMVByRow_;
357 default: TEUCHOS_TEST_FOR_EXCEPT(
true);
362 bool supportsLinearOp_;
363 bool supportsMVByCol_;
364 bool supportsTransMVByRow_;
370 DERIV_LINEARITY_UNKNOWN
371 ,DERIV_LINEARITY_CONST
372 ,DERIV_LINEARITY_NONCONST
378 ,DERIV_RANK_DEFICIENT
391 :linearity(DERIV_LINEARITY_UNKNOWN),rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) {}
395 ):linearity(in_linearity),rank(in_rank),supportsAdjoint(in_supportsAdjoint) {}
407 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv
409 ,
const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>()
410 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {}
413 { orientation_ = orientation; };
419 {
return orientation_; }
422 {
return paramIndexes_; }
424 Teuchos::RefCountPtr<Epetra_MultiVector> mv_;
426 Teuchos::Array<int> paramIndexes_;
437 Derivative(
const Teuchos::RefCountPtr<Epetra_Operator> &lo )
441 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv
443 ) : dmv_(mv,orientation) {}
452 {
return dmv_.getMultiVector(); }
455 {
return dmv_.getOrientation(); }
461 {
return !lo_.get() && !dmv_.getMultiVector().get(); }
463 Teuchos::RefCountPtr<Epetra_Operator> lo_;
475 bool isAlreadyInverted_ )
476 : PrecOp(PrecOp_), isAlreadyInverted(isAlreadyInverted_) {}
495 const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv
497 ,
const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>()
498 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {}
501 { orientation_ = orientation; };
503 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly >
getMultiVector()
const 507 {
return orientation_; }
510 {
return paramIndexes_; }
512 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > mv_;
514 Teuchos::Array<int> paramIndexes_;
525 SGDerivative(
const Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > &lo )
529 const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv
531 ) : dmv_(mv,orientation) {}
536 Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly >
getLinearOp()
const 539 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly >
getMultiVector()
const 540 {
return dmv_.getMultiVector(); }
543 {
return dmv_.getOrientation(); }
549 {
return !lo_.get() && !dmv_.getMultiVector().get(); }
551 Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > lo_;
565 const mp_multivector_t &mv
567 ,
const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>()
568 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {}
571 { orientation_ = orientation; };
577 {
return orientation_; }
580 {
return paramIndexes_; }
582 mp_multivector_t mv_;
584 Teuchos::Array<int> paramIndexes_;
600 const mp_multivector_t &mv
602 ) : dmv_(mv,orientation) {}
611 {
return dmv_.getMultiVector(); }
614 {
return dmv_.getOrientation(); }
620 {
return !lo_.get() && !dmv_.getMultiVector().get(); }
637 static const int NUM_E_OUT_ARGS_MEMBERS=9;
714 typedef Teuchos::RefCountPtr<Stokhos::EpetraVectorOrthogPoly>
sg_vector_t;
717 typedef Teuchos::RefCountPtr<Stokhos::EpetraOperatorOrthogPoly >
sg_operator_t;
722 std::string modelEvalDescription()
const;
762 void set_f_sg(
const sg_vector_t& f_sg );
764 sg_vector_t get_f_sg()
const;
766 void set_f_mp(
const mp_vector_t& f_sg );
768 mp_vector_t get_f_mp()
const;
775 void set_g_sg(
int j,
const sg_vector_t &g_sg_j );
778 sg_vector_t get_g_sg(
int j)
const;
781 void set_g_mp(
int j,
const mp_vector_t &g_mp_j );
784 mp_vector_t get_g_mp(
int j)
const;
786 void set_W(
const Teuchos::RefCountPtr<Epetra_Operator> &W );
787 void set_WPrec(
const Teuchos::RefCountPtr<Epetra_Operator> &WPrec );
789 Teuchos::RefCountPtr<Epetra_Operator> get_W()
const;
790 Teuchos::RefCountPtr<Epetra_Operator> get_WPrec()
const;
795 void set_W_sg(
const sg_operator_t& W_sg );
797 sg_operator_t get_W_sg()
const;
799 void set_W_mp(
const mp_operator_t& W_sg );
801 mp_operator_t get_W_mp()
const;
803 void set_DfDp(
int l,
const Derivative &DfDp_l);
821 void set_DgDx_dot(
int j,
const Derivative &DgDx_dot_j);
827 void set_DgDx_dot_sg(
int j,
const SGDerivative &DgDx_dot_j);
833 void set_DgDx_dot_mp(
int j,
const MPDerivative &DgDx_dot_j);
839 void set_DgDx(
int j,
const Derivative &DgDx_j);
857 void set_DgDp(
int j,
int l,
const Derivative &DgDp_j_l );
863 void set_DgDp_sg(
int j,
int l,
const SGDerivative &DgDp_sg_j_l );
869 void set_DgDp_mp(
int j,
int l,
const MPDerivative &DgDp_mp_j_l );
876 void set_f_poly(
const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly );
878 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > get_f_poly()
const;
889 void setFailed()
const;
895 bool isFailed()
const;
899 void _setModelEvalDescription(
const std::string &modelEvalDescription );
901 void _set_Np_Ng(
int Np,
int Ng);
913 void _setSupports(
EOutArgs_g_sg arg,
int j,
bool supports );
924 void _setSupports(
EOutArgs_g_mp arg,
int j,
bool supports );
963 typedef Teuchos::Array<Evaluation<Epetra_Vector> > g_t;
964 typedef Teuchos::Array<sg_vector_t > g_sg_t;
965 typedef Teuchos::Array<mp_vector_t > g_mp_t;
966 typedef Teuchos::Array<Derivative> deriv_t;
967 typedef Teuchos::Array<SGDerivative> sg_deriv_t;
968 typedef Teuchos::Array<MPDerivative> mp_deriv_t;
969 typedef Teuchos::Array<DerivativeProperties> deriv_properties_t;
970 typedef Teuchos::Array<DerivativeSupport> supports_t;
971 typedef Teuchos::Array<bool> supports_g_sg_t;
973 std::string modelEvalDescription_;
974 mutable bool isFailed_;
975 bool supports_[NUM_E_OUT_ARGS_MEMBERS];
976 supports_t supports_DfDp_;
977 supports_t supports_DgDx_dot_;
978 supports_t supports_DgDx_;
979 supports_t supports_DgDp_;
980 supports_g_sg_t supports_g_sg_;
981 supports_t supports_DfDp_sg_;
982 supports_t supports_DgDx_dot_sg_;
983 supports_t supports_DgDx_sg_;
984 supports_t supports_DgDp_sg_;
985 supports_g_sg_t supports_g_mp_;
986 supports_t supports_DfDp_mp_;
987 supports_t supports_DgDx_dot_mp_;
988 supports_t supports_DgDx_mp_;
989 supports_t supports_DgDp_mp_;
994 Teuchos::RefCountPtr<Epetra_Operator> W_;
995 Teuchos::RefCountPtr<Epetra_Operator> WPrec_;
999 deriv_properties_t DfDp_properties_;
1002 deriv_properties_t DgDx_dot_properties_;
1003 deriv_properties_t DgDx_properties_;
1005 deriv_properties_t DgDp_properties_;
1006 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > f_poly_;
1008 sg_operator_t W_sg_;
1009 sg_deriv_t DfDp_sg_;
1010 deriv_properties_t DfDp_sg_properties_;
1011 sg_deriv_t DgDx_dot_sg_;
1012 sg_deriv_t DgDx_sg_;
1013 deriv_properties_t DgDx_dot_sg_properties_;
1014 deriv_properties_t DgDx_sg_properties_;
1015 sg_deriv_t DgDp_sg_;
1016 deriv_properties_t DgDp_sg_properties_;
1018 mp_operator_t W_mp_;
1019 mp_deriv_t DfDp_mp_;
1020 deriv_properties_t DfDp_mp_properties_;
1021 mp_deriv_t DgDx_dot_mp_;
1022 mp_deriv_t DgDx_mp_;
1023 deriv_properties_t DgDx_dot_mp_properties_;
1024 deriv_properties_t DgDx_mp_properties_;
1025 mp_deriv_t DgDp_mp_;
1026 deriv_properties_t DgDp_mp_properties_;
1032 void assert_supports(
EOutArgsDgDp arg,
int j,
int l)
const;
1043 void assert_l(
int l)
const;
1044 void assert_j(
int j)
const;
1061 virtual Teuchos::RefCountPtr<const Epetra_Map> get_x_map()
const = 0;
1064 virtual Teuchos::RefCountPtr<const Epetra_Map> get_f_map()
const = 0;
1067 virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_map(
int l)
const;
1083 virtual Teuchos::RefCountPtr<const Teuchos::Array<std::string> > get_p_names(
int l)
const;
1086 virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_map(
int j)
const;
1094 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_init()
const;
1097 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot_init()
const;
1100 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(
int l)
const;
1103 virtual double get_t_init()
const;
1114 virtual double getInfBound()
const;
1117 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds()
const;
1120 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds()
const;
1123 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(
int l)
const;
1126 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(
int l)
const;
1129 virtual double get_t_lower_bound()
const;
1132 virtual double get_t_upper_bound()
const;
1145 virtual Teuchos::RefCountPtr<Epetra_Operator> create_W()
const;
1146 virtual Teuchos::RefCountPtr<EpetraExt::ModelEvaluator::Preconditioner> create_WPrec()
const;
1149 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(
int l)
const;
1152 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dot_op(
int j)
const;
1155 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_op(
int j)
const;
1158 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_op(
int j,
int l )
const;
1166 virtual InArgs createInArgs()
const = 0;
1169 virtual OutArgs createOutArgs()
const = 0;
1172 virtual void evalModel(
const InArgs& inArgs,
const OutArgs& outArgs )
const = 0;
1174 #ifdef HAVE_PYTRILINOS 1176 friend InArgs convertInArgsFromPython(PyObject * source);
1179 friend OutArgs convertOutArgsFromPython(PyObject * source);
1192 void setModelEvalDescription(
const std::string &modelEvalDescription );
1194 void set_Np(
int Np);
1198 void setSupports(
EInArgs_p_sg arg,
int l,
bool supports );
1200 void setSupports(
EInArgs_p_mp arg,
int l,
bool supports );
1207 void setModelEvalDescription(
const std::string &modelEvalDescription );
1209 void set_Np_Ng(
int Np,
int Ng);
1221 void setSupports(
EOutArgs_g_sg arg,
int j,
bool supports );
1231 void setSupports(
EOutArgs_g_mp arg,
int j,
bool supports );
1286 Teuchos::RefCountPtr<Epetra_Operator>
1288 const std::string &modelEvalDescription,
1290 const std::string &derivName
1294 Teuchos::RefCountPtr<Epetra_MultiVector>
1296 const std::string &modelEvalDescription,
1298 const std::string &derivName,
1303 Teuchos::RefCountPtr<Epetra_Operator>
1310 Teuchos::RefCountPtr<Epetra_MultiVector>
1317 Teuchos::RefCountPtr<Epetra_MultiVector>
1325 Teuchos::RefCountPtr<Epetra_MultiVector>
1333 Teuchos::RefCountPtr<Epetra_MultiVector>
1349 std::string ModelEvaluator::InArgs::modelEvalDescription()
const 1350 {
return modelEvalDescription_; }
1353 int ModelEvaluator::InArgs::Np()
const 1354 {
return p_.size(); }
1357 void ModelEvaluator::InArgs::set_x_dot(
const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot )
1358 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
1361 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dot()
const 1362 { assert_supports(IN_ARG_x_dot);
return x_dot_; }
1365 void ModelEvaluator::InArgs::set_x(
const Teuchos::RefCountPtr<const Epetra_Vector> &x )
1366 { assert_supports(IN_ARG_x); x_ = x; }
1369 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x()
const 1370 { assert_supports(IN_ARG_x);
return x_; }
1373 void ModelEvaluator::InArgs::set_x_dot_poly(
const Teuchos::RefCountPtr<
const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly )
1374 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
1377 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
1378 ModelEvaluator::InArgs::get_x_dot_poly()
const 1379 { assert_supports(IN_ARG_x_dot_poly);
return x_dot_poly_; }
1382 void ModelEvaluator::InArgs::set_x_poly(
const Teuchos::RefCountPtr<
const Teuchos::Polynomial<Epetra_Vector> > &x_poly )
1383 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
1386 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
1387 ModelEvaluator::InArgs::get_x_poly()
const 1388 { assert_supports(IN_ARG_x_poly);
return x_poly_; }
1392 { assert_supports(IN_ARG_x_dot_sg); x_dot_sg_ = x_dot_sg; }
1396 ModelEvaluator::InArgs::get_x_dot_sg()
const 1397 { assert_supports(IN_ARG_x_dot_sg);
return x_dot_sg_; }
1401 { assert_supports(IN_ARG_x_dot_mp); x_dot_mp_ = x_dot_mp; }
1405 ModelEvaluator::InArgs::get_x_dot_mp()
const 1406 { assert_supports(IN_ARG_x_dot_mp);
return x_dot_mp_; }
1410 { assert_supports(IN_ARG_x_sg); x_sg_ = x_sg; }
1414 ModelEvaluator::InArgs::get_x_sg()
const 1415 { assert_supports(IN_ARG_x_sg);
return x_sg_; }
1419 { assert_supports(IN_ARG_x_mp); x_mp_ = x_mp; }
1423 ModelEvaluator::InArgs::get_x_mp()
const 1424 { assert_supports(IN_ARG_x_mp);
return x_mp_; }
1427 void ModelEvaluator::InArgs::set_p(
int l,
const Teuchos::RefCountPtr<const Epetra_Vector> &p_l )
1428 { assert_l(l); p_[l] = p_l; }
1431 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_p(
int l)
const 1432 { assert_l(l);
return p_[l]; }
1435 void ModelEvaluator::InArgs::set_p_sg(
int l,
1437 { assert_supports(IN_ARG_p_sg, l); p_sg_[l] = p_sg_l; }
1441 ModelEvaluator::InArgs::get_p_sg(
int l)
const 1442 { assert_supports(IN_ARG_p_sg, l);
return p_sg_[l]; }
1445 void ModelEvaluator::InArgs::set_p_mp(
int l,
1447 { assert_supports(IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; }
1451 ModelEvaluator::InArgs::get_p_mp(
int l)
const 1452 { assert_supports(IN_ARG_p_mp, l);
return p_mp_[l]; }
1455 void ModelEvaluator::InArgs::set_t(
double t )
1456 { assert_supports(IN_ARG_t); t_ = t; }
1459 double ModelEvaluator::InArgs::get_t()
const 1460 { assert_supports(IN_ARG_t);
return t_; }
1463 void ModelEvaluator::InArgs::set_alpha(
double alpha )
1464 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
1467 double ModelEvaluator::InArgs::get_alpha()
const 1468 { assert_supports(IN_ARG_alpha);
return alpha_; }
1471 void ModelEvaluator::InArgs::set_beta(
double beta )
1472 { assert_supports(IN_ARG_beta); beta_ = beta; }
1475 double ModelEvaluator::InArgs::get_beta()
const 1476 { assert_supports(IN_ARG_beta);
return beta_; }
1480 { assert_supports(IN_ARG_sg_basis); sg_basis_ = basis; }
1483 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >
1484 ModelEvaluator::InArgs::get_sg_basis()
const 1485 { assert_supports(IN_ARG_sg_basis);
return sg_basis_; }
1489 { assert_supports(IN_ARG_sg_quadrature); sg_quad_ = quad; }
1492 Teuchos::RCP<const Stokhos::Quadrature<int,double> >
1493 ModelEvaluator::InArgs::get_sg_quadrature()
const 1494 { assert_supports(IN_ARG_sg_quadrature);
return sg_quad_; }
1498 { assert_supports(IN_ARG_sg_expansion); sg_exp_ = exp; }
1501 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > >
1502 ModelEvaluator::InArgs::get_sg_expansion()
const 1503 { assert_supports(IN_ARG_sg_expansion);
return sg_exp_; }
1506 void ModelEvaluator::InArgs::_setModelEvalDescription(
const std::string &new_modelEvalDescription )
1508 modelEvalDescription_ = new_modelEvalDescription;
1512 void ModelEvaluator::InArgs::_set_Np(
int new_Np)
1515 p_sg_.resize(new_Np);
1516 p_mp_.resize(new_Np);
1517 supports_p_sg_.resize(new_Np);
1518 supports_p_mp_.resize(new_Np);
1526 std::string ModelEvaluator::OutArgs::modelEvalDescription()
const 1527 {
return modelEvalDescription_; }
1530 int ModelEvaluator::OutArgs::Np()
const 1532 return DfDp_.size();
1536 int ModelEvaluator::OutArgs::Ng()
const 1546 ModelEvaluator::OutArgs::get_f()
const {
return f_; }
1557 ModelEvaluator::OutArgs::get_g(
int j)
const 1564 void ModelEvaluator::OutArgs::set_g_sg(
int j,
const sg_vector_t &g_sg_j )
1566 assert_supports(OUT_ARG_g_sg, j);
1572 ModelEvaluator::OutArgs::get_g_sg(
int j)
const 1574 assert_supports(OUT_ARG_g_sg, j);
1579 void ModelEvaluator::OutArgs::set_g_mp(
int j,
const mp_vector_t &g_mp_j )
1581 assert_supports(OUT_ARG_g_mp, j);
1587 ModelEvaluator::OutArgs::get_g_mp(
int j)
const 1589 assert_supports(OUT_ARG_g_mp, j);
1594 void ModelEvaluator::OutArgs::set_W(
const Teuchos::RefCountPtr<Epetra_Operator> &W ) { W_ = W; }
1596 void ModelEvaluator::OutArgs::set_WPrec(
const Teuchos::RefCountPtr<Epetra_Operator> &WPrec ) { WPrec_ = WPrec; }
1599 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_W()
const {
return W_; }
1601 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_WPrec()
const {
return WPrec_; }
1605 {
return W_properties_; }
1608 {
return WPrec_properties_; }
1611 void ModelEvaluator::OutArgs::set_DfDp(
int l,
const Derivative &DfDp_l )
1613 assert_supports(OUT_ARG_DfDp,l);
1619 ModelEvaluator::OutArgs::get_DfDp(
int l)
const 1621 assert_supports(OUT_ARG_DfDp,l);
1627 ModelEvaluator::OutArgs::get_DfDp_properties(
int l)
const 1629 assert_supports(OUT_ARG_DfDp,l);
1630 return DfDp_properties_[l];
1634 void ModelEvaluator::OutArgs::set_DfDp_sg(
int l,
const SGDerivative &DfDp_sg_l )
1636 assert_supports(OUT_ARG_DfDp_sg,l);
1637 DfDp_sg_[l] = DfDp_sg_l;
1642 ModelEvaluator::OutArgs::get_DfDp_sg(
int l)
const 1644 assert_supports(OUT_ARG_DfDp_sg,l);
1650 ModelEvaluator::OutArgs::get_DfDp_sg_properties(
int l)
const 1652 assert_supports(OUT_ARG_DfDp_sg,l);
1653 return DfDp_sg_properties_[l];
1657 void ModelEvaluator::OutArgs::set_DfDp_mp(
int l,
const MPDerivative &DfDp_mp_l )
1659 assert_supports(OUT_ARG_DfDp_mp,l);
1660 DfDp_mp_[l] = DfDp_mp_l;
1665 ModelEvaluator::OutArgs::get_DfDp_mp(
int l)
const 1667 assert_supports(OUT_ARG_DfDp_mp,l);
1673 ModelEvaluator::OutArgs::get_DfDp_mp_properties(
int l)
const 1675 assert_supports(OUT_ARG_DfDp_mp,l);
1676 return DfDp_mp_properties_[l];
1680 void ModelEvaluator::OutArgs::set_DgDx_dot(
int j,
const Derivative &DgDx_dot_j )
1682 assert_supports(OUT_ARG_DgDx_dot,j);
1683 DgDx_dot_[j] = DgDx_dot_j;
1688 ModelEvaluator::OutArgs::get_DgDx_dot(
int j)
const 1690 assert_supports(OUT_ARG_DgDx_dot,j);
1691 return DgDx_dot_[j];
1696 ModelEvaluator::OutArgs::get_DgDx_dot_properties(
int j)
const 1698 assert_supports(OUT_ARG_DgDx_dot,j);
1699 return DgDx_dot_properties_[j];
1703 void ModelEvaluator::OutArgs::set_DgDx_dot_sg(
int j,
const SGDerivative &DgDx_dot_sg_j )
1705 assert_supports(OUT_ARG_DgDx_dot_sg,j);
1706 DgDx_dot_sg_[j] = DgDx_dot_sg_j;
1711 ModelEvaluator::OutArgs::get_DgDx_dot_sg(
int j)
const 1713 assert_supports(OUT_ARG_DgDx_dot_sg,j);
1714 return DgDx_dot_sg_[j];
1719 ModelEvaluator::OutArgs::get_DgDx_dot_sg_properties(
int j)
const 1721 assert_supports(OUT_ARG_DgDx_dot_sg,j);
1722 return DgDx_dot_sg_properties_[j];
1726 void ModelEvaluator::OutArgs::set_DgDx_dot_mp(
int j,
const MPDerivative &DgDx_dot_mp_j )
1728 assert_supports(OUT_ARG_DgDx_dot_mp,j);
1729 DgDx_dot_mp_[j] = DgDx_dot_mp_j;
1734 ModelEvaluator::OutArgs::get_DgDx_dot_mp(
int j)
const 1736 assert_supports(OUT_ARG_DgDx_dot_mp,j);
1737 return DgDx_dot_mp_[j];
1742 ModelEvaluator::OutArgs::get_DgDx_dot_mp_properties(
int j)
const 1744 assert_supports(OUT_ARG_DgDx_dot_mp,j);
1745 return DgDx_dot_mp_properties_[j];
1749 void ModelEvaluator::OutArgs::set_DgDx(
int j,
const Derivative &DgDx_j )
1751 assert_supports(OUT_ARG_DgDx,j);
1757 ModelEvaluator::OutArgs::get_DgDx(
int j)
const 1759 assert_supports(OUT_ARG_DgDx,j);
1765 ModelEvaluator::OutArgs::get_DgDx_properties(
int j)
const 1767 assert_supports(OUT_ARG_DgDx,j);
1768 return DgDx_properties_[j];
1772 void ModelEvaluator::OutArgs::set_DgDx_sg(
int j,
const SGDerivative &DgDx_sg_j )
1774 assert_supports(OUT_ARG_DgDx_sg,j);
1775 DgDx_sg_[j] = DgDx_sg_j;
1780 ModelEvaluator::OutArgs::get_DgDx_sg(
int j)
const 1782 assert_supports(OUT_ARG_DgDx_sg,j);
1788 ModelEvaluator::OutArgs::get_DgDx_sg_properties(
int j)
const 1790 assert_supports(OUT_ARG_DgDx_sg,j);
1791 return DgDx_sg_properties_[j];
1795 void ModelEvaluator::OutArgs::set_DgDx_mp(
int j,
const MPDerivative &DgDx_mp_j )
1797 assert_supports(OUT_ARG_DgDx_mp,j);
1798 DgDx_mp_[j] = DgDx_mp_j;
1803 ModelEvaluator::OutArgs::get_DgDx_mp(
int j)
const 1805 assert_supports(OUT_ARG_DgDx_mp,j);
1811 ModelEvaluator::OutArgs::get_DgDx_mp_properties(
int j)
const 1813 assert_supports(OUT_ARG_DgDx_mp,j);
1814 return DgDx_mp_properties_[j];
1818 void ModelEvaluator::OutArgs::set_DgDp(
int j,
int l,
const Derivative &DgDp_j_l )
1820 assert_supports(OUT_ARG_DgDp,j,l);
1821 DgDp_[ j*Np() + l ] = DgDp_j_l;
1826 ModelEvaluator::OutArgs::get_DgDp(
int j,
int l)
const 1828 assert_supports(OUT_ARG_DgDp,j,l);
1829 return DgDp_[ j*Np() + l ];
1834 ModelEvaluator::OutArgs::get_DgDp_properties(
int j,
int l)
const 1836 assert_supports(OUT_ARG_DgDp,j,l);
1837 return DgDp_properties_[ j*Np() + l ];
1841 void ModelEvaluator::OutArgs::set_DgDp_sg(
int j,
int l,
const SGDerivative &DgDp_sg_j_l )
1843 assert_supports(OUT_ARG_DgDp_sg,j,l);
1844 DgDp_sg_[ j*Np() + l ] = DgDp_sg_j_l;
1849 ModelEvaluator::OutArgs::get_DgDp_sg(
int j,
int l)
const 1851 assert_supports(OUT_ARG_DgDp_sg,j,l);
1852 return DgDp_sg_[ j*Np() + l ];
1857 ModelEvaluator::OutArgs::get_DgDp_sg_properties(
int j,
int l)
const 1859 assert_supports(OUT_ARG_DgDp_sg,j,l);
1860 return DgDp_sg_properties_[ j*Np() + l ];
1864 void ModelEvaluator::OutArgs::set_DgDp_mp(
int j,
int l,
const MPDerivative &DgDp_mp_j_l )
1866 assert_supports(OUT_ARG_DgDp_mp,j,l);
1867 DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l;
1872 ModelEvaluator::OutArgs::get_DgDp_mp(
int j,
int l)
const 1874 assert_supports(OUT_ARG_DgDp_mp,j,l);
1875 return DgDp_mp_[ j*Np() + l ];
1880 ModelEvaluator::OutArgs::get_DgDp_mp_properties(
int j,
int l)
const 1882 assert_supports(OUT_ARG_DgDp_mp,j,l);
1883 return DgDp_mp_properties_[ j*Np() + l ];
1887 void ModelEvaluator::OutArgs::set_f_poly(
const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly )
1888 { f_poly_ = f_poly; }
1891 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> >
1892 ModelEvaluator::OutArgs::get_f_poly()
const 1901 ModelEvaluator::OutArgs::get_f_sg()
const 1916 ModelEvaluator::OutArgs::get_f_mp()
const 1930 void ModelEvaluator::InArgsSetup::setModelEvalDescription(
const std::string &new_modelEvalDescription )
1932 this->_setModelEvalDescription(new_modelEvalDescription);
1936 void ModelEvaluator::InArgsSetup::set_Np(
int new_Np)
1937 { this->_set_Np(new_Np); }
1940 void ModelEvaluator::InArgsSetup::setSupports(
EInArgsMembers arg,
bool new_supports )
1941 { this->_setSupports(arg,new_supports); }
1944 void ModelEvaluator::InArgsSetup::setSupports(
EInArgs_p_sg arg,
int l,
bool new_supports )
1945 { this->_setSupports(arg,l,new_supports); }
1948 void ModelEvaluator::InArgsSetup::setSupports(
EInArgs_p_mp arg,
int l,
bool new_supports )
1949 { this->_setSupports(arg,l,new_supports); }
1956 void ModelEvaluator::OutArgsSetup::setModelEvalDescription(
const std::string &new_modelEvalDescription )
1958 this->_setModelEvalDescription(new_modelEvalDescription);
1962 void ModelEvaluator::OutArgsSetup::set_Np_Ng(
int new_Np,
int new_Ng)
1963 { this->_set_Np_Ng(new_Np,new_Ng); }
1967 { this->_setSupports(arg,new_supports); }
1971 { this->_setSupports(arg,l,new_supports); }
1975 { this->_setSupports(arg,j,new_supports); }
1979 { this->_setSupports(arg,j,new_supports); }
1983 { this->_setSupports(arg,j,l,new_supports); }
1986 void ModelEvaluator::OutArgsSetup::setSupports(
EOutArgs_g_sg arg,
int j,
bool new_supports )
1987 { this->_setSupports(arg,j,new_supports); }
1991 { this->_setSupports(arg,l,new_supports); }
1995 { this->_setSupports(arg,j,new_supports); }
1999 { this->_setSupports(arg,j,new_supports); }
2003 { this->_setSupports(arg,j,l,new_supports); }
2006 void ModelEvaluator::OutArgsSetup::setSupports(
EOutArgs_g_mp arg,
int j,
bool new_supports )
2007 { this->_setSupports(arg,j,new_supports); }
2011 { this->_setSupports(arg,l,new_supports); }
2015 { this->_setSupports(arg,j,new_supports); }
2019 { this->_setSupports(arg,j,new_supports); }
2023 { this->_setSupports(arg,j,l,new_supports); }
2027 { this->_set_W_properties(properties); }
2030 { this->_set_WPrec_properties(properties); }
2035 this->_set_DfDp_properties(l,properties);
2041 this->_set_DgDx_dot_properties(j,properties);
2047 this->_set_DgDx_properties(j,properties);
2053 this->_set_DgDp_properties(j,l,properties);
2059 this->_set_DfDp_sg_properties(l,properties);
2065 this->_set_DgDx_dot_sg_properties(j,properties);
2071 this->_set_DgDx_sg_properties(j,properties);
2077 this->_set_DgDp_sg_properties(j,l,properties);
2083 this->_set_DfDp_mp_properties(l,properties);
2089 this->_set_DgDx_dot_mp_properties(j,properties);
2095 this->_set_DgDx_mp_properties(j,properties);
2101 this->_set_DgDp_mp_properties(j,l,properties);
2106 #endif // EPETRA_EXT_MODEL_EVALUATOR_HPP Simple aggregate class that stores a derivative object as a general linear operator or as a multi-vec...
DerivativeMultiVector getDerivativeMultiVector() const
EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > getMultiVector() const
Teuchos::RefCountPtr< Epetra_MultiVector > get_DgDx_dot_mv(const int j, const ModelEvaluator::OutArgs &outArgs, const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation)
MPDerivative(const mp_operator_t &lo)
MPDerivativeMultiVector(const mp_multivector_t &mv, const EDerivativeMultiVectorOrientation orientation=DERIV_MV_BY_COL, const Teuchos::Array< int > ¶mIndexes=Teuchos::Array< int >())
Derivative(const Teuchos::RefCountPtr< Epetra_MultiVector > &mv, const EDerivativeMultiVectorOrientation orientation=DERIV_MV_BY_COL)
EEvalType getType() const
Evaluation(const Teuchos::RefCountPtr< ObjType > &obj)
Preconditioner()
Default constructor of null Operatir.
bool supports(EDerivativeLinearOp) const
Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > sg_operator_t
Short-hand for stochastic Galerkin operator type.
Teuchos::RefCountPtr< const Stokhos::EpetraVectorOrthogPoly > sg_const_vector_t
Short-hand for stochastic Galerkin vector type.
MPDerivativeMultiVector()
Teuchos::RefCountPtr< Epetra_MultiVector > getMultiVector() const
Teuchos::RefCountPtr< Epetra_MultiVector > getMultiVector() const
bool isAlreadyInverted
Bool flag.
Preconditioner(const Teuchos::RCP< Epetra_Operator > &PrecOp_, bool isAlreadyInverted_)
Usable constructor to set the (Epetra_Operator,bool) pair.
Evaluation(const Teuchos::RefCountPtr< ObjType > &obj, EEvalType evalType)
mp_multivector_t getMultiVector() const
std::string toString(ModelEvaluator::EOutArgsMembers outArg)
Teuchos::RefCountPtr< Stokhos::EpetraVectorOrthogPoly > sg_vector_t
Short-hand for stochastic Galerkin vector type.
Teuchos::RCP< Stokhos::ProductEpetraMultiVector > mp_multivector_t
Teuchos::RCP< Stokhos::ProductEpetraOperator > mp_operator_t
Teuchos::RefCountPtr< Epetra_MultiVector > get_DgDp_mv(const int j, const int l, const ModelEvaluator::OutArgs &outArgs, const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation)
Teuchos::RCP< const Stokhos::ProductEpetraMultiVector > mp_const_multivector_t
SGDerivativeMultiVector getDerivativeMultiVector() const
Teuchos::RCP< Epetra_Operator > PrecOp
Accessor for the Epetra_Operator.
DerivativeSupport(EDerivativeMultiVectorOrientation mvOrientation)
const Teuchos::Array< int > & getParamIndexes() const
bool supports(EDerivativeMultiVectorOrientation mvOrientation) const
Teuchos::RefCountPtr< Epetra_MultiVector > getMultiVector(const std::string &modelEvalDescription, const ModelEvaluator::Derivative &deriv, const std::string &derivName, const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation)
Derivative(const Teuchos::RefCountPtr< Epetra_Operator > &lo)
Simple aggregate class that stores a derivative object as a general linear operator or as a multi-vec...
EDerivativeMultiVectorOrientation getOrientation() const
DerivativeMultiVector(const Teuchos::RefCountPtr< Epetra_MultiVector > &mv, const EDerivativeMultiVectorOrientation orientation=DERIV_MV_BY_COL, const Teuchos::Array< int > ¶mIndexes=Teuchos::Array< int >())
SGDerivative(const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv, const EDerivativeMultiVectorOrientation orientation=DERIV_MV_BY_COL)
void changeOrientation(const EDerivativeMultiVectorOrientation orientation)
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
Simple aggregate class that stores a derivative object as a general linear operator or as a multi-vec...
EDerivativeLinearity linearity
DerivativeSupport(EDerivativeLinearOp)
Simple aggregate class for a derivative object represented as a column-wise multi-vector or its trans...
MPDerivativeMultiVector getDerivativeMultiVector() const
Derivative(const DerivativeMultiVector &dmv)
Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > getMultiVector() const
Simple aggregate class for a derivative object represented as a column-wise multi-vector or its trans...
const Teuchos::Array< int > & getParamIndexes() const
SGDerivativeMultiVector()
MPDerivative(const MPDerivativeMultiVector &dmv)
DerivativeSupport & plus(EDerivativeMultiVectorOrientation mvOrientation)
MPDerivative(const mp_multivector_t &mv, const EDerivativeMultiVectorOrientation orientation=DERIV_MV_BY_COL)
Teuchos::RCP< const Stokhos::ProductEpetraVector > mp_const_vector_t
EDerivativeMultiVectorOrientation getOrientation() const
mp_operator_t getLinearOp() const
EDerivativeMultiVectorOrientation
SGDerivativeMultiVector(const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv, const EDerivativeMultiVectorOrientation orientation=DERIV_MV_BY_COL, const Teuchos::Array< int > ¶mIndexes=Teuchos::Array< int >())
DerivativeProperties(EDerivativeLinearity in_linearity, ERankStatus in_rank, bool in_supportsAdjoint)
EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
void changeOrientation(const EDerivativeMultiVectorOrientation orientation)
Simple aggregate struct that stores a preconditioner as an Epetra_Operator and a bool, about whether it is inverted or not.
EDerivativeMultiVectorOrientation getOrientation() const
Teuchos::RefCountPtr< Epetra_MultiVector > get_DfDp_mv(const int l, const ModelEvaluator::OutArgs &outArgs)
Teuchos::RefCountPtr< Epetra_Operator > get_DfDp_op(const int l, const ModelEvaluator::OutArgs &outArgs)
DerivativeSupport(EDerivativeLinearOp, EDerivativeMultiVectorOrientation mvOrientation)
Teuchos::RefCountPtr< Epetra_Operator > getLinearOp(const std::string &modelEvalDescription, const ModelEvaluator::Derivative &deriv, const std::string &derivName)
EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
mp_multivector_t getMultiVector() const
Teuchos::RefCountPtr< Epetra_Operator > getLinearOp() const
Teuchos::RCP< Stokhos::ProductEpetraVector > mp_vector_t
Simple aggregate class for a derivative object represented as a column-wise multi-vector or its trans...
void reset(const Teuchos::RefCountPtr< ObjType > &obj, EEvalType evalType)
SGDerivative(const SGDerivativeMultiVector &dmv)
const Teuchos::Array< int > & getParamIndexes() const
Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > getLinearOp() const
void changeOrientation(const EDerivativeMultiVectorOrientation orientation)
DerivativeSupport(EDerivativeMultiVectorOrientation mvOrientation1, EDerivativeMultiVectorOrientation mvOrientation2)
DerivativeSupport & plus(EDerivativeLinearOp)
Teuchos::RefCountPtr< Epetra_MultiVector > get_DgDx_mv(const int j, const ModelEvaluator::OutArgs &outArgs, const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation)
Base interface for evaluating a stateless "model".
SGDerivative(const Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > &lo)
Teuchos::RCP< const Stokhos::ProductEpetraOperator > mp_const_operator_t