00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef EPETRA_EXT_MODEL_EVALUATOR_HPP
00030 #define EPETRA_EXT_MODEL_EVALUATOR_HPP
00031
00032 #include "EpetraExt_ConfigDefs.h"
00033 #include "EpetraExt_PolynomialVectorTraits.h"
00034 #include "Teuchos_RefCountPtr.hpp"
00035 #include "Teuchos_Describable.hpp"
00036 #include "Teuchos_Polynomial.hpp"
00037 #include "Teuchos_Array.hpp"
00038
00039 #ifdef HAVE_PYTRILINOS
00040 #undef HAVE_INTTYPES_H
00041 #undef HAVE_STDINT_H
00042 #undef HAVE_SYS_TIME_H
00043 #include "Python.h"
00044 #endif
00045
00046 class Epetra_Map;
00047 class Epetra_Vector;
00048 class Epetra_Operator;
00049
00050
00051 namespace Stokhos {
00052 template <typename coeff_type> class VectorOrthogPoly;
00053 }
00054
00055 namespace EpetraExt {
00056
00061 class ModelEvaluator : virtual public Teuchos::Describable {
00062 public:
00063
00066
00068 enum EInArgsMembers {
00069 IN_ARG_x_dot
00070 ,IN_ARG_x
00071 ,IN_ARG_x_dot_poly
00072 ,IN_ARG_x_poly
00073 ,IN_ARG_x_dot_sg
00074 ,IN_ARG_x_sg
00075 ,IN_ARG_t
00076 ,IN_ARG_alpha
00077 ,IN_ARG_beta
00078 };
00079 static const int NUM_E_IN_ARGS_MEMBERS=9;
00080
00082 class InArgs {
00083 public:
00084
00086 typedef Teuchos::RefCountPtr<const Stokhos::VectorOrthogPoly<Epetra_Vector> > sg_const_vector_t;
00087
00089 InArgs();
00091 std::string modelEvalDescription() const;
00093 int Np() const;
00095 int Np_sg() const;
00097 void set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot );
00099 Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot() const;
00101 void set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x );
00103 Teuchos::RefCountPtr<const Epetra_Vector> get_x() const;
00104 void set_x_poly(
00105 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly
00106 );
00108 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_poly() const;
00110 void set_x_dot_poly(
00111 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly
00112 );
00114 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dot_poly() const;
00116 void set_x_sg(const sg_const_vector_t &x_sg);
00118 sg_const_vector_t get_x_sg() const;
00120 void set_x_dot_sg(const sg_const_vector_t &x_dot_sg);
00122 sg_const_vector_t get_x_dot_sg() const;
00124 void set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l );
00126 Teuchos::RefCountPtr<const Epetra_Vector> get_p(int l) const;
00128 void set_p_sg( int l, const sg_const_vector_t &p_sg_l );
00130 sg_const_vector_t get_p_sg(int l) const;
00132 void set_t( double t );
00134 double get_alpha() const;
00136 void set_alpha( double alpha );
00138 double get_beta() const;
00140 void set_beta( double beta );
00142 double get_t() const;
00144 bool supports(EInArgsMembers arg) const;
00145 protected:
00147 void _setModelEvalDescription( const std::string &modelEvalDescription );
00149 void _set_Np(int Np);
00151 void _set_Np_sg(int Np);
00153 void _setSupports( EInArgsMembers arg, bool supports );
00154 private:
00155
00156 typedef Teuchos::Array<Teuchos::RefCountPtr<const Epetra_Vector> > p_t;
00157 typedef Teuchos::Array<sg_const_vector_t > p_sg_t;
00158
00159 std::string modelEvalDescription_;
00160 Teuchos::RefCountPtr<const Epetra_Vector> x_dot_;
00161 Teuchos::RefCountPtr<const Epetra_Vector> x_;
00162 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dot_poly_;
00163 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_poly_;
00164 sg_const_vector_t x_dot_sg_;
00165 sg_const_vector_t x_sg_;
00166 p_t p_;
00167 p_sg_t p_sg_;
00168 double t_;
00169 double alpha_;
00170 double beta_;
00171 bool supports_[NUM_E_IN_ARGS_MEMBERS];
00172
00173 void assert_supports(EInArgsMembers arg) const;
00174 void assert_l(int l) const;
00175 };
00176
00178 enum EEvalType {
00179 EVAL_TYPE_EXACT
00180 ,EVAL_TYPE_APPROX_DERIV
00181 ,EVAL_TYPE_VERY_APPROX_DERIV
00182 };
00183
00185 template<class ObjType>
00186 class Evaluation : public Teuchos::RefCountPtr<ObjType> {
00187 public:
00189 Evaluation() : evalType_(EVAL_TYPE_EXACT) {}
00191 Evaluation( const Teuchos::RefCountPtr<ObjType> &obj )
00192 : Teuchos::RefCountPtr<ObjType>(obj), evalType_(EVAL_TYPE_EXACT) {}
00194 Evaluation( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType )
00195 : Teuchos::RefCountPtr<ObjType>(obj), evalType_(evalType) {}
00197 EEvalType getType() const { return evalType_; }
00199 void reset( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType )
00200 { this->operator=(obj); evalType_ = evalType; }
00201 private:
00202 EEvalType evalType_;
00203 };
00204
00206 enum EDerivativeMultiVectorOrientation {
00207 DERIV_MV_BY_COL
00208 ,DERIV_TRANS_MV_BY_ROW
00209 };
00210
00212 enum EDerivativeLinearOp { DERIV_LINEAR_OP };
00213
00215 class DerivativeSupport {
00216 public:
00218 DerivativeSupport()
00219 :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false)
00220 {}
00222 DerivativeSupport( EDerivativeLinearOp )
00223 :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false)
00224 {}
00226 DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation )
00227 :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00228 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00229 {}
00231 DerivativeSupport(
00232 EDerivativeLinearOp, EDerivativeMultiVectorOrientation mvOrientation )
00233 :supportsLinearOp_(true), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00234 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00235 {}
00237 DerivativeSupport(
00238 EDerivativeMultiVectorOrientation mvOrientation1,
00239 EDerivativeMultiVectorOrientation mvOrientation2
00240 )
00241 :supportsLinearOp_(false)
00242 ,supportsMVByCol_(
00243 mvOrientation1==DERIV_MV_BY_COL||mvOrientation2==DERIV_MV_BY_COL )
00244 ,supportsTransMVByRow_(
00245 mvOrientation1==DERIV_TRANS_MV_BY_ROW||mvOrientation2==DERIV_TRANS_MV_BY_ROW )
00246 {}
00248 DerivativeSupport& plus(EDerivativeLinearOp)
00249 { supportsLinearOp_ = true; return *this; }
00251 DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation)
00252 {
00253 switch(mvOrientation) {
00254 case DERIV_MV_BY_COL: supportsMVByCol_ = true; break;
00255 case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break;
00256 default: TEST_FOR_EXCEPT(true);
00257 }
00258 return *this;
00259 }
00261 bool none() const
00262 { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); }
00264 bool supports(EDerivativeLinearOp) const
00265 { return supportsLinearOp_; }
00267 bool supports(EDerivativeMultiVectorOrientation mvOrientation) const
00268 {
00269 switch(mvOrientation) {
00270 case DERIV_MV_BY_COL: return supportsMVByCol_;
00271 case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_;
00272 default: TEST_FOR_EXCEPT(true);
00273 }
00274 return false;
00275 }
00276 private:
00277 bool supportsLinearOp_;
00278 bool supportsMVByCol_;
00279 bool supportsTransMVByRow_;
00280 public:
00281 };
00282
00284 enum EDerivativeLinearity {
00285 DERIV_LINEARITY_UNKNOWN
00286 ,DERIV_LINEARITY_CONST
00287 ,DERIV_LINEARITY_NONCONST
00288 };
00290 enum ERankStatus {
00291 DERIV_RANK_UNKNOWN
00292 ,DERIV_RANK_FULL
00293 ,DERIV_RANK_DEFICIENT
00294 };
00295
00297 struct DerivativeProperties {
00299 EDerivativeLinearity linearity;
00301 ERankStatus rank;
00303 bool supportsAdjoint;
00305 DerivativeProperties()
00306 :linearity(DERIV_LINEARITY_UNKNOWN),rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) {}
00308 DerivativeProperties(
00309 EDerivativeLinearity in_linearity, ERankStatus in_rank, bool in_supportsAdjoint
00310 ):linearity(in_linearity),rank(in_rank),supportsAdjoint(in_supportsAdjoint) {}
00311 };
00312
00316 class DerivativeMultiVector {
00317 public:
00319 DerivativeMultiVector() {}
00321 DerivativeMultiVector(
00322 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv
00323 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00324 ,const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>()
00325 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {}
00327 void changeOrientation( const EDerivativeMultiVectorOrientation orientation )
00328 { orientation_ = orientation; };
00330 Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const
00331 { return mv_; }
00333 EDerivativeMultiVectorOrientation getOrientation() const
00334 { return orientation_; }
00336 const Teuchos::Array<int>& getParamIndexes() const
00337 { return paramIndexes_; }
00338 private:
00339 Teuchos::RefCountPtr<Epetra_MultiVector> mv_;
00340 EDerivativeMultiVectorOrientation orientation_;
00341 Teuchos::Array<int> paramIndexes_;
00342 };
00343
00347 class Derivative {
00348 public:
00350 Derivative() {}
00352 Derivative( const Teuchos::RefCountPtr<Epetra_Operator> &lo )
00353 : lo_(lo) {}
00355 Derivative(
00356 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv
00357 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00358 ) : dmv_(mv,orientation) {}
00360 Derivative( const DerivativeMultiVector &dmv )
00361 : dmv_(dmv) {}
00363 Teuchos::RefCountPtr<Epetra_Operator> getLinearOp() const
00364 { return lo_; }
00366 Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const
00367 { return dmv_.getMultiVector(); }
00369 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
00370 { return dmv_.getOrientation(); }
00372 DerivativeMultiVector getDerivativeMultiVector() const
00373 { return dmv_; }
00375 bool isEmpty() const
00376 { return !lo_.get() && !dmv_.getMultiVector().get(); }
00377 private:
00378 Teuchos::RefCountPtr<Epetra_Operator> lo_;
00379 DerivativeMultiVector dmv_;
00380 };
00381
00383 enum EOutArgsMembers {
00384 OUT_ARG_f
00385 ,OUT_ARG_W
00386 ,OUT_ARG_f_poly
00387 ,OUT_ARG_f_sg
00388 ,OUT_ARG_W_sg
00389 };
00390 static const int NUM_E_OUT_ARGS_MEMBERS=5;
00391
00393 enum EOutArgsDfDp {
00394 OUT_ARG_DfDp
00395 };
00396
00398 enum EOutArgsDgDx_dot {
00399 OUT_ARG_DgDx_dot
00400 };
00401
00403 enum EOutArgsDgDx {
00404 OUT_ARG_DgDx
00405 };
00406
00408 enum EOutArgsDgDp {
00409 OUT_ARG_DgDp
00410 };
00411
00413 enum EOutArgsDgDp_sg {
00414 OUT_ARG_DgDp_sg
00415 };
00416
00418 class OutArgs {
00419 public:
00420
00422 typedef Teuchos::RefCountPtr<Stokhos::VectorOrthogPoly<Epetra_Vector> > sg_vector_t;
00423
00425 typedef Teuchos::RefCountPtr<Stokhos::VectorOrthogPoly<Epetra_Operator> > sg_operator_t;
00426
00428 typedef Teuchos::RefCountPtr<Stokhos::VectorOrthogPoly<Derivative> > sg_deriv_t;
00429
00431 OutArgs();
00433 std::string modelEvalDescription() const;
00435 int Np() const;
00437 int Ng() const;
00439 int Np_sg() const;
00441 int Ng_sg() const;
00443 bool supports(EOutArgsMembers arg) const;
00445 const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const;
00447 const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const;
00449 const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const;
00451 const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const;
00453 const DerivativeSupport& supports(EOutArgsDgDp_sg arg, int j, int l) const;
00455 void set_f( const Evaluation<Epetra_Vector> &f );
00457 Evaluation<Epetra_Vector> get_f() const;
00459 void set_f_sg( const sg_vector_t& f_sg );
00461 sg_vector_t get_f_sg() const;
00463 void set_g( int j, const Evaluation<Epetra_Vector> &g_j );
00465 Evaluation<Epetra_Vector> get_g(int j) const;
00468 void set_g_sg( int j, const sg_vector_t &g_sg_j );
00471 sg_vector_t get_g_sg(int j) const;
00473 void set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W );
00475 Teuchos::RefCountPtr<Epetra_Operator> get_W() const;
00477 DerivativeProperties get_W_properties() const;
00479 void set_W_sg( const sg_operator_t& W_sg );
00481 sg_operator_t get_W_sg() const;
00483 void set_DfDp(int l, const Derivative &DfDp_l);
00485 Derivative get_DfDp(int l) const;
00487 DerivativeProperties get_DfDp_properties(int l) const;
00489 void set_DgDx_dot(int j, const Derivative &DgDx_dot_j);
00491 Derivative get_DgDx_dot(int j) const;
00493 DerivativeProperties get_DgDx_dot_properties(int j) const;
00495 void set_DgDx(int j, const Derivative &DgDx_j);
00497 Derivative get_DgDx(int j) const;
00499 DerivativeProperties get_DgDx_properties(int j) const;
00501 void set_DgDp( int j, int l, const Derivative &DgDp_j_l );
00503 Derivative get_DgDp(int j, int l) const;
00505 DerivativeProperties get_DgDp_properties(int j, int l) const;
00507 void set_DgDp_sg( int j, int l, const sg_deriv_t &DgDp_sg_j_l );
00509 sg_deriv_t get_DgDp_sg(int j, int l) const;
00511 DerivativeProperties get_DgDp_sg_properties(int j, int l) const;
00512
00514 void set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly );
00516 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > get_f_poly() const;
00517
00518
00520 bool funcOrDerivesAreSet(EOutArgsMembers arg) const;
00521 protected:
00523 void _setModelEvalDescription( const std::string &modelEvalDescription );
00525 void _set_Np_Ng(int Np, int Ng);
00527 void _set_Np_Ng_sg(int Np_sg, int Ng_sg);
00529 void _setSupports( EOutArgsMembers arg, bool supports );
00531 void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& );
00533 void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00535 void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& );
00537 void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00539 void _setSupports( EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& );
00541 void _set_W_properties( const DerivativeProperties &W_properties );
00543 void _set_DfDp_properties( int l, const DerivativeProperties &properties );
00545 void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00547 void _set_DgDx_properties( int j, const DerivativeProperties &properties );
00549 void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00551 void _set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties );
00552 private:
00553
00554 typedef Teuchos::Array<Evaluation<Epetra_Vector> > g_t;
00555 typedef Teuchos::Array<sg_vector_t > g_sg_t;
00556 typedef Teuchos::Array<Derivative> deriv_t;
00557 typedef Teuchos::Array<DerivativeProperties> deriv_properties_t;
00558 typedef Teuchos::Array<DerivativeSupport> supports_t;
00559
00560 std::string modelEvalDescription_;
00561 bool supports_[NUM_E_OUT_ARGS_MEMBERS];
00562 supports_t supports_DfDp_;
00563 supports_t supports_DgDx_dot_;
00564 supports_t supports_DgDx_;
00565 supports_t supports_DgDp_;
00566 supports_t supports_DgDp_sg_;
00567 Evaluation<Epetra_Vector> f_;
00568 g_t g_;
00569 g_sg_t g_sg_;
00570 Teuchos::RefCountPtr<Epetra_Operator> W_;
00571 DerivativeProperties W_properties_;
00572 deriv_t DfDp_;
00573 deriv_properties_t DfDp_properties_;
00574 deriv_t DgDx_dot_;
00575 deriv_t DgDx_;
00576 deriv_properties_t DgDx_dot_properties_;
00577 deriv_properties_t DgDx_properties_;
00578 deriv_t DgDp_;
00579 deriv_properties_t DgDp_properties_;
00580 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > f_poly_;
00581 sg_vector_t f_sg_;
00582 sg_operator_t W_sg_;
00583 Teuchos::Array<sg_deriv_t> DgDp_sg_;
00584 deriv_properties_t DgDp_sg_properties_;
00585 int Np_sg_;
00586
00587 void assert_supports(EOutArgsMembers arg) const;
00588 void assert_supports(EOutArgsDfDp arg, int l) const;
00589 void assert_supports(EOutArgsDgDx_dot arg, int j) const;
00590 void assert_supports(EOutArgsDgDx arg, int j) const;
00591 void assert_supports(EOutArgsDgDp arg, int j, int l) const;
00592 void assert_supports(EOutArgsDgDp_sg arg, int j, int l) const;
00593 void assert_l(int l) const;
00594 void assert_j(int j) const;
00595 void assert_l_sg(int l) const;
00596 void assert_j_sg(int j) const;
00597 };
00598
00600
00603
00605 virtual ~ModelEvaluator();
00606
00608
00611
00613 virtual Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const = 0;
00614
00616 virtual Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const = 0;
00617
00619 virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const;
00620
00635 virtual Teuchos::RefCountPtr<const Teuchos::Array<std::string> > get_p_names(int l) const;
00636
00638 virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const;
00639
00641
00644
00646 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const;
00647
00649 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot_init() const;
00650
00652 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const;
00653
00655 virtual double get_t_init() const;
00656
00658
00661
00666 virtual double getInfBound() const;
00667
00669 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds() const;
00670
00672 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds() const;
00673
00675 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(int l) const;
00676
00678 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(int l) const;
00679
00681 virtual double get_t_lower_bound() const;
00682
00684 virtual double get_t_upper_bound() const;
00685
00687
00690
00697 virtual Teuchos::RefCountPtr<Epetra_Operator> create_W() const;
00698
00700 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(int l) const;
00701
00703 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dot_op(int j) const;
00704
00706 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_op(int j) const;
00707
00709 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_op( int j, int l ) const;
00710
00712
00715
00717 virtual InArgs createInArgs() const = 0;
00718
00720 virtual OutArgs createOutArgs() const = 0;
00721
00723 virtual void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const = 0;
00724
00725 #ifdef HAVE_PYTRILINOS
00726
00727 friend InArgs convertInArgsFromPython(PyObject * source);
00728
00730 friend OutArgs convertOutArgsFromPython(PyObject * source);
00731 #endif
00732
00733
00734 protected:
00735
00738
00740 class InArgsSetup : public InArgs {
00741 public:
00743 void setModelEvalDescription( const std::string &modelEvalDescription );
00745 void set_Np(int Np);
00747 void set_Np_sg(int Np);
00749 void setSupports( EInArgsMembers arg, bool supports = true );
00750 };
00751
00753 class OutArgsSetup : public OutArgs {
00754 public:
00756 void setModelEvalDescription( const std::string &modelEvalDescription );
00758 void set_Np_Ng(int Np, int Ng);
00760 void set_Np_Ng_sg(int Np_sg, int Ng_sg);
00762 void setSupports( EOutArgsMembers arg, bool supports = true );
00764 void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& );
00766 void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00768 void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& );
00770 void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00772 void setSupports(EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& );
00774 void set_W_properties( const DerivativeProperties &properties );
00776 void set_DfDp_properties( int l, const DerivativeProperties &properties );
00778 void set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00780 void set_DgDx_properties( int j, const DerivativeProperties &properties );
00782 void set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00784 void set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties );
00785 };
00786
00788
00789 };
00790
00791
00792
00793
00795 std::string toString( ModelEvaluator::EDerivativeMultiVectorOrientation orientation );
00796
00798 std::string toString( ModelEvaluator::EInArgsMembers inArg );
00799
00801 std::string toString( ModelEvaluator::EOutArgsMembers outArg );
00802
00804 Teuchos::RefCountPtr<Epetra_Operator>
00805 getLinearOp(
00806 const std::string &modelEvalDescription,
00807 const ModelEvaluator::Derivative &deriv,
00808 const std::string &derivName
00809 );
00810
00812 Teuchos::RefCountPtr<Epetra_MultiVector>
00813 getMultiVector(
00814 const std::string &modelEvalDescription,
00815 const ModelEvaluator::Derivative &deriv,
00816 const std::string &derivName,
00817 const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00818 );
00819
00821 Teuchos::RefCountPtr<Epetra_Operator>
00822 get_DfDp_op(
00823 const int l
00824 ,const ModelEvaluator::OutArgs &outArgs
00825 );
00826
00828 Teuchos::RefCountPtr<Epetra_MultiVector>
00829 get_DfDp_mv(
00830 const int l
00831 ,const ModelEvaluator::OutArgs &outArgs
00832 );
00833
00835 Teuchos::RefCountPtr<Epetra_MultiVector>
00836 get_DgDx_dot_mv(
00837 const int j
00838 ,const ModelEvaluator::OutArgs &outArgs
00839 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00840 );
00841
00843 Teuchos::RefCountPtr<Epetra_MultiVector>
00844 get_DgDx_mv(
00845 const int j
00846 ,const ModelEvaluator::OutArgs &outArgs
00847 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00848 );
00849
00851 Teuchos::RefCountPtr<Epetra_MultiVector>
00852 get_DgDp_mv(
00853 const int j
00854 ,const int l
00855 ,const ModelEvaluator::OutArgs &outArgs
00856 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00857 );
00858
00859
00860
00861
00862
00863
00864
00865
00866 inline
00867 std::string ModelEvaluator::InArgs::modelEvalDescription() const
00868 { return modelEvalDescription_; }
00869
00870 inline
00871 int ModelEvaluator::InArgs::Np() const
00872 { return p_.size(); }
00873
00874 inline
00875 int ModelEvaluator::InArgs::Np_sg() const
00876 { return p_sg_.size(); }
00877
00878 inline
00879 void ModelEvaluator::InArgs::set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot )
00880 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
00881
00882 inline
00883 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dot() const
00884 { assert_supports(IN_ARG_x_dot); return x_dot_; }
00885
00886 inline
00887 void ModelEvaluator::InArgs::set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x )
00888 { assert_supports(IN_ARG_x); x_ = x; }
00889
00890 inline
00891 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x() const
00892 { assert_supports(IN_ARG_x); return x_; }
00893
00894 inline
00895 void ModelEvaluator::InArgs::set_x_dot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly )
00896 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
00897
00898 inline
00899 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
00900 ModelEvaluator::InArgs::get_x_dot_poly() const
00901 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; }
00902
00903 inline
00904 void ModelEvaluator::InArgs::set_x_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly )
00905 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
00906
00907 inline
00908 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
00909 ModelEvaluator::InArgs::get_x_poly() const
00910 { assert_supports(IN_ARG_x_poly); return x_poly_; }
00911
00912 inline
00913 void ModelEvaluator::InArgs::set_x_dot_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_dot_sg )
00914 { assert_supports(IN_ARG_x_dot_sg); x_dot_sg_ = x_dot_sg; }
00915
00916 inline
00917 ModelEvaluator::InArgs::sg_const_vector_t
00918 ModelEvaluator::InArgs::get_x_dot_sg() const
00919 { assert_supports(IN_ARG_x_dot_sg); return x_dot_sg_; }
00920
00921 inline
00922 void ModelEvaluator::InArgs::set_x_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_sg )
00923 { assert_supports(IN_ARG_x_sg); x_sg_ = x_sg; }
00924
00925 inline
00926 ModelEvaluator::InArgs::sg_const_vector_t
00927 ModelEvaluator::InArgs::get_x_sg() const
00928 { assert_supports(IN_ARG_x_sg); return x_sg_; }
00929
00930 inline
00931 void ModelEvaluator::InArgs::set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l )
00932 { assert_l(l); p_[l] = p_l; }
00933
00934 inline
00935 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_p(int l) const
00936 { assert_l(l); return p_[l]; }
00937
00938 inline
00939 void ModelEvaluator::InArgs::set_p_sg( int l,
00940 const ModelEvaluator::InArgs::sg_const_vector_t &p_sg_l )
00941 { assert_l(l); p_sg_[l] = p_sg_l; }
00942
00943 inline
00944 ModelEvaluator::InArgs::sg_const_vector_t
00945 ModelEvaluator::InArgs::get_p_sg(int l) const
00946 { assert_l(l); return p_sg_[l]; }
00947
00948 inline
00949 void ModelEvaluator::InArgs::set_t( double t )
00950 { assert_supports(IN_ARG_t); t_ = t; }
00951
00952 inline
00953 double ModelEvaluator::InArgs::get_t() const
00954 { assert_supports(IN_ARG_t); return t_; }
00955
00956 inline
00957 void ModelEvaluator::InArgs::set_alpha( double alpha )
00958 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
00959
00960 inline
00961 double ModelEvaluator::InArgs::get_alpha() const
00962 { assert_supports(IN_ARG_alpha); return alpha_; }
00963
00964 inline
00965 void ModelEvaluator::InArgs::set_beta( double beta )
00966 { assert_supports(IN_ARG_beta); beta_ = beta; }
00967
00968 inline
00969 double ModelEvaluator::InArgs::get_beta() const
00970 { assert_supports(IN_ARG_beta); return beta_; }
00971
00972 inline
00973 void ModelEvaluator::InArgs::_setModelEvalDescription( const std::string &modelEvalDescription )
00974 {
00975 modelEvalDescription_ = modelEvalDescription;
00976 }
00977
00978 inline
00979 void ModelEvaluator::InArgs::_set_Np(int Np)
00980 {
00981 p_.resize(Np);
00982 }
00983
00984 inline
00985 void ModelEvaluator::InArgs::_set_Np_sg(int Np)
00986 {
00987 p_sg_.resize(Np);
00988 }
00989
00990
00991
00992
00993
00994 inline
00995 std::string ModelEvaluator::OutArgs::modelEvalDescription() const
00996 { return modelEvalDescription_; }
00997
00998 inline
00999 int ModelEvaluator::OutArgs::Np() const
01000 {
01001 return DfDp_.size();
01002 }
01003
01004 inline
01005 int ModelEvaluator::OutArgs::Ng() const
01006 {
01007 return g_.size();
01008 }
01009
01010 inline
01011 int ModelEvaluator::OutArgs::Np_sg() const
01012 {
01013 return Np_sg_;
01014 }
01015
01016 inline
01017 int ModelEvaluator::OutArgs::Ng_sg() const
01018 {
01019 return g_sg_.size();
01020 }
01021
01022 inline
01023 void ModelEvaluator::OutArgs::set_f( const Evaluation<Epetra_Vector> &f ) { f_ = f; }
01024
01025 inline
01026 ModelEvaluator::Evaluation<Epetra_Vector>
01027 ModelEvaluator::OutArgs::get_f() const { return f_; }
01028
01029 inline
01030 void ModelEvaluator::OutArgs::set_g( int j, const Evaluation<Epetra_Vector> &g_j )
01031 {
01032 assert_j(j);
01033 g_[j] = g_j;
01034 }
01035
01036 inline
01037 ModelEvaluator::Evaluation<Epetra_Vector>
01038 ModelEvaluator::OutArgs::get_g(int j) const
01039 {
01040 assert_j(j);
01041 return g_[j];
01042 }
01043
01044 inline
01045 void ModelEvaluator::OutArgs::set_g_sg( int j, const sg_vector_t &g_sg_j )
01046 {
01047 assert_j_sg(j);
01048 g_sg_[j] = g_sg_j;
01049 }
01050
01051 inline
01052 ModelEvaluator::OutArgs::sg_vector_t
01053 ModelEvaluator::OutArgs::get_g_sg(int j) const
01054 {
01055 assert_j_sg(j);
01056 return g_sg_[j];
01057 }
01058
01059 inline
01060 void ModelEvaluator::OutArgs::set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ) { W_ = W; }
01061
01062 inline
01063 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_W() const { return W_; }
01064
01065 inline
01066 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_W_properties() const
01067 {
01068 return W_properties_;
01069 }
01070
01071 inline
01072 void ModelEvaluator::OutArgs::set_DfDp( int l, const Derivative &DfDp_l )
01073 {
01074 assert_supports(OUT_ARG_DfDp,l);
01075 DfDp_[l] = DfDp_l;
01076 }
01077
01078 inline
01079 ModelEvaluator::Derivative
01080 ModelEvaluator::OutArgs::get_DfDp(int l) const
01081 {
01082 assert_supports(OUT_ARG_DfDp,l);
01083 return DfDp_[l];
01084 }
01085
01086 inline
01087 ModelEvaluator::DerivativeProperties
01088 ModelEvaluator::OutArgs::get_DfDp_properties(int l) const
01089 {
01090 assert_supports(OUT_ARG_DfDp,l);
01091 return DfDp_properties_[l];
01092 }
01093
01094 inline
01095 void ModelEvaluator::OutArgs::set_DgDx_dot( int j, const Derivative &DgDx_dot_j )
01096 {
01097 assert_supports(OUT_ARG_DgDx_dot,j);
01098 DgDx_dot_[j] = DgDx_dot_j;
01099 }
01100
01101 inline
01102 ModelEvaluator::Derivative
01103 ModelEvaluator::OutArgs::get_DgDx_dot(int j) const
01104 {
01105 assert_supports(OUT_ARG_DgDx_dot,j);
01106 return DgDx_dot_[j];
01107 }
01108
01109 inline
01110 ModelEvaluator::DerivativeProperties
01111 ModelEvaluator::OutArgs::get_DgDx_dot_properties(int j) const
01112 {
01113 assert_supports(OUT_ARG_DgDx_dot,j);
01114 return DgDx_dot_properties_[j];
01115 }
01116
01117 inline
01118 void ModelEvaluator::OutArgs::set_DgDx( int j, const Derivative &DgDx_j )
01119 {
01120 assert_supports(OUT_ARG_DgDx,j);
01121 DgDx_[j] = DgDx_j;
01122 }
01123
01124 inline
01125 ModelEvaluator::Derivative
01126 ModelEvaluator::OutArgs::get_DgDx(int j) const
01127 {
01128 assert_supports(OUT_ARG_DgDx,j);
01129 return DgDx_[j];
01130 }
01131
01132 inline
01133 ModelEvaluator::DerivativeProperties
01134 ModelEvaluator::OutArgs::get_DgDx_properties(int j) const
01135 {
01136 assert_supports(OUT_ARG_DgDx,j);
01137 return DgDx_properties_[j];
01138 }
01139
01140 inline
01141 void ModelEvaluator::OutArgs::set_DgDp( int j, int l, const Derivative &DgDp_j_l )
01142 {
01143 assert_supports(OUT_ARG_DgDp,j,l);
01144 DgDp_[ j*Np() + l ] = DgDp_j_l;
01145 }
01146
01147 inline
01148 ModelEvaluator::Derivative
01149 ModelEvaluator::OutArgs::get_DgDp(int j, int l) const
01150 {
01151 assert_supports(OUT_ARG_DgDp,j,l);
01152 return DgDp_[ j*Np() + l ];
01153 }
01154
01155 inline
01156 ModelEvaluator::DerivativeProperties
01157 ModelEvaluator::OutArgs::get_DgDp_properties(int j, int l) const
01158 {
01159 assert_supports(OUT_ARG_DgDp,j,l);
01160 return DgDp_properties_[ j*Np() + l ];
01161 }
01162
01163 inline
01164 void ModelEvaluator::OutArgs::set_DgDp_sg( int j, int l, const ModelEvaluator::OutArgs::sg_deriv_t &DgDp_sg_j_l )
01165 {
01166 assert_supports(OUT_ARG_DgDp_sg,j,l);
01167 DgDp_sg_[ j*Np_sg() + l ] = DgDp_sg_j_l;
01168 }
01169
01170 inline
01171 ModelEvaluator::OutArgs::sg_deriv_t
01172 ModelEvaluator::OutArgs::get_DgDp_sg(int j, int l) const
01173 {
01174 assert_supports(OUT_ARG_DgDp_sg,j,l);
01175 return DgDp_sg_[ j*Np_sg() + l ];
01176 }
01177
01178 inline
01179 ModelEvaluator::DerivativeProperties
01180 ModelEvaluator::OutArgs::get_DgDp_sg_properties(int j, int l) const
01181 {
01182 assert_supports(OUT_ARG_DgDp_sg,j,l);
01183 return DgDp_sg_properties_[ j*Np_sg() + l ];
01184 }
01185
01186 inline
01187 void ModelEvaluator::OutArgs::set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly )
01188 { f_poly_ = f_poly; }
01189
01190 inline
01191 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> >
01192 ModelEvaluator::OutArgs::get_f_poly() const
01193 { return f_poly_; }
01194
01195 inline
01196 void ModelEvaluator::OutArgs::set_f_sg( const ModelEvaluator::OutArgs::sg_vector_t& f_sg )
01197 { f_sg_ = f_sg; }
01198
01199 inline
01200 ModelEvaluator::OutArgs::sg_vector_t
01201 ModelEvaluator::OutArgs::get_f_sg() const
01202 { return f_sg_; }
01203
01204 inline
01205 void ModelEvaluator::OutArgs::set_W_sg( const ModelEvaluator::OutArgs::sg_operator_t& W_sg ) { W_sg_ = W_sg; }
01206
01207 inline
01208 ModelEvaluator::OutArgs::sg_operator_t ModelEvaluator::OutArgs::get_W_sg() const { return W_sg_; }
01209
01210
01211
01212
01213
01214 inline
01215 void ModelEvaluator::InArgsSetup::setModelEvalDescription( const std::string &modelEvalDescription )
01216 {
01217 this->_setModelEvalDescription(modelEvalDescription);
01218 }
01219
01220 inline
01221 void ModelEvaluator::InArgsSetup::set_Np(int Np)
01222 { this->_set_Np(Np); }
01223
01224 inline
01225 void ModelEvaluator::InArgsSetup::set_Np_sg(int Np)
01226 { this->_set_Np_sg(Np); }
01227
01228 inline
01229 void ModelEvaluator::InArgsSetup::setSupports( EInArgsMembers arg, bool supports )
01230 { this->_setSupports(arg,supports); }
01231
01232
01233
01234
01235
01236 inline
01237 void ModelEvaluator::OutArgsSetup::setModelEvalDescription( const std::string &modelEvalDescription )
01238 {
01239 this->_setModelEvalDescription(modelEvalDescription);
01240 }
01241
01242 inline
01243 void ModelEvaluator::OutArgsSetup::set_Np_Ng(int Np, int Ng)
01244 { this->_set_Np_Ng(Np,Ng); }
01245
01246 inline
01247 void ModelEvaluator::OutArgsSetup::set_Np_Ng_sg(int Np_sg, int Ng_sg)
01248 { this->_set_Np_Ng_sg(Np_sg, Ng_sg); }
01249
01250 inline
01251 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsMembers arg, bool supports )
01252 { this->_setSupports(arg,supports); }
01253
01254 inline
01255 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& supports )
01256 { this->_setSupports(arg,l,supports); }
01257
01258 inline
01259 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& supports )
01260 { this->_setSupports(arg,j,supports); }
01261
01262 inline
01263 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& supports )
01264 { this->_setSupports(arg,j,supports); }
01265
01266 inline
01267 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports )
01268 { this->_setSupports(arg,j,l,supports); }
01269
01270 inline
01271 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& supports )
01272 { this->_setSupports(arg,j,l,supports); }
01273
01274 inline
01275 void ModelEvaluator::OutArgsSetup::set_W_properties( const DerivativeProperties &properties )
01276 { this->_set_W_properties(properties); }
01277
01278 inline
01279 void ModelEvaluator::OutArgsSetup::set_DfDp_properties( int l, const DerivativeProperties &properties )
01280 {
01281 this->_set_DfDp_properties(l,properties);
01282 }
01283
01284 inline
01285 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_properties( int j, const DerivativeProperties &properties )
01286 {
01287 this->_set_DgDx_dot_properties(j,properties);
01288 }
01289
01290 inline
01291 void ModelEvaluator::OutArgsSetup::set_DgDx_properties( int j, const DerivativeProperties &properties )
01292 {
01293 this->_set_DgDx_properties(j,properties);
01294 }
01295
01296 inline
01297 void ModelEvaluator::OutArgsSetup::set_DgDp_properties( int j, int l, const DerivativeProperties &properties )
01298 {
01299 this->_set_DgDp_properties(j,l,properties);
01300 }
01301
01302 inline
01303 void ModelEvaluator::OutArgsSetup::set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties )
01304 {
01305 this->_set_DgDp_sg_properties(j,l,properties);
01306 }
01307
01308 }
01309
01310 #endif // EPETRA_EXT_MODEL_EVALUATOR_HPP