|
EpetraExt Development
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // EpetraExt: Epetra Extended - Linear Algebra Services Package 00005 // Copyright (2001) Sandia Corporation 00006 // 00007 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00008 // license for use of this work by or on behalf of the U.S. Government. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00025 // 00026 // *********************************************************************** 00027 // @HEADER 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 // Forward declaration of Stochastic Galerkin (SG) argument types 00051 namespace Stokhos { 00052 template <typename coeff_type> class VectorOrthogPoly; 00053 class EpetraVectorOrthogPoly; 00054 class EpetraMultiVectorOrthogPoly; 00055 template <typename ordinal_type, typename scalar_type> class OrthogPolyBasis; 00056 template <typename ordinal_type, typename scalar_type> class Quadrature; 00057 template <typename ordinal_type, typename scalar_type> class OrthogPolyExpansion; 00058 } 00059 00060 namespace EpetraExt { 00061 00066 class ModelEvaluator : virtual public Teuchos::Describable { 00067 public: 00068 00071 00073 enum EInArgsMembers { 00074 IN_ARG_x_dot 00075 ,IN_ARG_x 00076 ,IN_ARG_x_dot_poly 00077 ,IN_ARG_x_poly 00078 ,IN_ARG_x_dot_sg 00079 ,IN_ARG_x_sg 00080 ,IN_ARG_t 00081 ,IN_ARG_alpha 00082 ,IN_ARG_beta 00083 ,IN_ARG_sg_basis 00084 ,IN_ARG_sg_quadrature 00085 ,IN_ARG_sg_expansion 00086 }; 00087 static const int NUM_E_IN_ARGS_MEMBERS=12; 00088 00090 class InArgs { 00091 public: 00092 00094 typedef Teuchos::RefCountPtr<const Stokhos::EpetraVectorOrthogPoly> sg_const_vector_t; 00095 00097 InArgs(); 00099 std::string modelEvalDescription() const; 00101 int Np() const; 00103 int Np_sg() const; 00105 void set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot ); 00107 Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot() const; 00109 void set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x ); 00111 Teuchos::RefCountPtr<const Epetra_Vector> get_x() const; 00112 void set_x_poly( 00113 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly 00114 ); 00116 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_poly() const; 00118 void set_x_dot_poly( 00119 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly 00120 ); 00122 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dot_poly() const; 00124 void set_x_sg(const sg_const_vector_t &x_sg); 00126 sg_const_vector_t get_x_sg() const; 00128 void set_x_dot_sg(const sg_const_vector_t &x_dot_sg); 00130 sg_const_vector_t get_x_dot_sg() const; 00132 void set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l ); 00134 Teuchos::RefCountPtr<const Epetra_Vector> get_p(int l) const; 00136 void set_p_sg( int l, const sg_const_vector_t &p_sg_l ); 00138 sg_const_vector_t get_p_sg(int l) const; 00140 void set_t( double t ); 00142 double get_alpha() const; 00144 void set_alpha( double alpha ); 00146 double get_beta() const; 00148 void set_beta( double beta ); 00150 double get_t() const; 00152 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > get_sg_basis() const; 00154 void set_sg_basis( const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis ); 00156 Teuchos::RCP<const Stokhos::Quadrature<int,double> > get_sg_quadrature() const; 00158 void set_sg_quadrature( const Teuchos::RCP<const Stokhos::Quadrature<int,double> >& quad ); 00160 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> > get_sg_expansion() const; 00162 void set_sg_expansion( const Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> >& exp ); 00164 bool supports(EInArgsMembers arg) const; 00165 protected: 00167 void _setModelEvalDescription( const std::string &modelEvalDescription ); 00169 void _set_Np(int Np); 00171 void _set_Np_sg(int Np); 00173 void _setSupports( EInArgsMembers arg, bool supports ); 00174 private: 00175 // types 00176 typedef Teuchos::Array<Teuchos::RefCountPtr<const Epetra_Vector> > p_t; 00177 typedef Teuchos::Array<sg_const_vector_t > p_sg_t; 00178 // data 00179 std::string modelEvalDescription_; 00180 Teuchos::RefCountPtr<const Epetra_Vector> x_dot_; 00181 Teuchos::RefCountPtr<const Epetra_Vector> x_; 00182 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dot_poly_; 00183 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_poly_; 00184 sg_const_vector_t x_dot_sg_; 00185 sg_const_vector_t x_sg_; 00186 p_t p_; 00187 p_sg_t p_sg_; 00188 double t_; 00189 double alpha_; 00190 double beta_; 00191 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > sg_basis_; 00192 Teuchos::RCP<const Stokhos::Quadrature<int,double> > sg_quad_; 00193 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> > sg_exp_; 00194 bool supports_[NUM_E_IN_ARGS_MEMBERS]; 00195 // functions 00196 void assert_supports(EInArgsMembers arg) const; 00197 void assert_l(int l) const; 00198 }; 00199 00201 enum EEvalType { 00202 EVAL_TYPE_EXACT 00203 ,EVAL_TYPE_APPROX_DERIV 00204 ,EVAL_TYPE_VERY_APPROX_DERIV 00205 }; 00206 00208 template<class ObjType> 00209 class Evaluation : public Teuchos::RefCountPtr<ObjType> { 00210 public: 00212 Evaluation() : evalType_(EVAL_TYPE_EXACT) {} 00214 Evaluation( const Teuchos::RefCountPtr<ObjType> &obj ) 00215 : Teuchos::RefCountPtr<ObjType>(obj), evalType_(EVAL_TYPE_EXACT) {} 00217 Evaluation( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType ) 00218 : Teuchos::RefCountPtr<ObjType>(obj), evalType_(evalType) {} 00220 EEvalType getType() const { return evalType_; } 00222 void reset( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType ) 00223 { this->operator=(obj); evalType_ = evalType; } 00224 private: 00225 EEvalType evalType_; 00226 }; 00227 00229 enum EDerivativeMultiVectorOrientation { 00230 DERIV_MV_BY_COL 00231 ,DERIV_TRANS_MV_BY_ROW 00232 }; 00233 00235 enum EDerivativeLinearOp { DERIV_LINEAR_OP }; 00236 00238 class DerivativeSupport { 00239 public: 00241 DerivativeSupport() 00242 :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false) 00243 {} 00245 DerivativeSupport( EDerivativeLinearOp ) 00246 :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false) 00247 {} 00249 DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation ) 00250 :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL) 00251 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW) 00252 {} 00254 DerivativeSupport( 00255 EDerivativeLinearOp, EDerivativeMultiVectorOrientation mvOrientation ) 00256 :supportsLinearOp_(true), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL) 00257 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW) 00258 {} 00260 DerivativeSupport( 00261 EDerivativeMultiVectorOrientation mvOrientation1, 00262 EDerivativeMultiVectorOrientation mvOrientation2 00263 ) 00264 :supportsLinearOp_(false) 00265 ,supportsMVByCol_( 00266 mvOrientation1==DERIV_MV_BY_COL||mvOrientation2==DERIV_MV_BY_COL ) 00267 ,supportsTransMVByRow_( 00268 mvOrientation1==DERIV_TRANS_MV_BY_ROW||mvOrientation2==DERIV_TRANS_MV_BY_ROW ) 00269 {} 00271 DerivativeSupport& plus(EDerivativeLinearOp) 00272 { supportsLinearOp_ = true; return *this; } 00274 DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation) 00275 { 00276 switch(mvOrientation) { 00277 case DERIV_MV_BY_COL: supportsMVByCol_ = true; break; 00278 case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break; 00279 default: TEST_FOR_EXCEPT(true); 00280 } 00281 return *this; 00282 } 00284 bool none() const 00285 { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); } 00287 bool supports(EDerivativeLinearOp) const 00288 { return supportsLinearOp_; } 00290 bool supports(EDerivativeMultiVectorOrientation mvOrientation) const 00291 { 00292 switch(mvOrientation) { 00293 case DERIV_MV_BY_COL: return supportsMVByCol_; 00294 case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_; 00295 default: TEST_FOR_EXCEPT(true); 00296 } 00297 return false; // Will never be called! 00298 } 00299 private: 00300 bool supportsLinearOp_; 00301 bool supportsMVByCol_; 00302 bool supportsTransMVByRow_; 00303 public: 00304 }; 00305 00307 enum EDerivativeLinearity { 00308 DERIV_LINEARITY_UNKNOWN 00309 ,DERIV_LINEARITY_CONST 00310 ,DERIV_LINEARITY_NONCONST 00311 }; 00313 enum ERankStatus { 00314 DERIV_RANK_UNKNOWN 00315 ,DERIV_RANK_FULL 00316 ,DERIV_RANK_DEFICIENT 00317 }; 00318 00320 struct DerivativeProperties { 00322 EDerivativeLinearity linearity; 00324 ERankStatus rank; 00326 bool supportsAdjoint; 00328 DerivativeProperties() 00329 :linearity(DERIV_LINEARITY_UNKNOWN),rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) {} 00331 DerivativeProperties( 00332 EDerivativeLinearity in_linearity, ERankStatus in_rank, bool in_supportsAdjoint 00333 ):linearity(in_linearity),rank(in_rank),supportsAdjoint(in_supportsAdjoint) {} 00334 }; 00335 00339 class DerivativeMultiVector { 00340 public: 00342 DerivativeMultiVector() {} 00344 DerivativeMultiVector( 00345 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv 00346 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00347 ,const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>() 00348 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {} 00350 void changeOrientation( const EDerivativeMultiVectorOrientation orientation ) 00351 { orientation_ = orientation; }; 00353 Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const 00354 { return mv_; } 00356 EDerivativeMultiVectorOrientation getOrientation() const 00357 { return orientation_; } 00359 const Teuchos::Array<int>& getParamIndexes() const 00360 { return paramIndexes_; } 00361 private: 00362 Teuchos::RefCountPtr<Epetra_MultiVector> mv_; 00363 EDerivativeMultiVectorOrientation orientation_; 00364 Teuchos::Array<int> paramIndexes_; 00365 }; 00366 00370 class Derivative { 00371 public: 00373 Derivative() {} 00375 Derivative( const Teuchos::RefCountPtr<Epetra_Operator> &lo ) 00376 : lo_(lo) {} 00378 Derivative( 00379 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv 00380 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00381 ) : dmv_(mv,orientation) {} 00383 Derivative( const DerivativeMultiVector &dmv ) 00384 : dmv_(dmv) {} 00386 Teuchos::RefCountPtr<Epetra_Operator> getLinearOp() const 00387 { return lo_; } 00389 Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const 00390 { return dmv_.getMultiVector(); } 00392 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const 00393 { return dmv_.getOrientation(); } 00395 DerivativeMultiVector getDerivativeMultiVector() const 00396 { return dmv_; } 00398 bool isEmpty() const 00399 { return !lo_.get() && !dmv_.getMultiVector().get(); } 00400 private: 00401 Teuchos::RefCountPtr<Epetra_Operator> lo_; 00402 DerivativeMultiVector dmv_; 00403 }; 00404 00408 struct Preconditioner { 00410 Preconditioner() : PrecOp(Teuchos::null), isAlreadyInverted(false) {} 00412 Preconditioner(const Teuchos::RCP<Epetra_Operator>& PrecOp_, 00413 bool isAlreadyInverted_ ) 00414 : PrecOp(PrecOp_), isAlreadyInverted(isAlreadyInverted_) {} 00416 Teuchos::RCP<Epetra_Operator> PrecOp; 00421 bool isAlreadyInverted; 00422 }; 00423 00427 class SGDerivativeMultiVector { 00428 public: 00430 SGDerivativeMultiVector() {} 00432 SGDerivativeMultiVector( 00433 const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv 00434 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00435 ,const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>() 00436 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {} 00438 void changeOrientation( const EDerivativeMultiVectorOrientation orientation ) 00439 { orientation_ = orientation; }; 00441 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > getMultiVector() const 00442 { return mv_; } 00444 EDerivativeMultiVectorOrientation getOrientation() const 00445 { return orientation_; } 00447 const Teuchos::Array<int>& getParamIndexes() const 00448 { return paramIndexes_; } 00449 private: 00450 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > mv_; 00451 EDerivativeMultiVectorOrientation orientation_; 00452 Teuchos::Array<int> paramIndexes_; 00453 }; 00454 00458 class SGDerivative { 00459 public: 00461 SGDerivative() {} 00463 SGDerivative( const Teuchos::RefCountPtr< Stokhos::VectorOrthogPoly<Epetra_Operator> > &lo ) 00464 : lo_(lo) {} 00466 SGDerivative( 00467 const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv 00468 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00469 ) : dmv_(mv,orientation) {} 00471 SGDerivative( const SGDerivativeMultiVector &dmv ) 00472 : dmv_(dmv) {} 00474 Teuchos::RefCountPtr< Stokhos::VectorOrthogPoly<Epetra_Operator> > getLinearOp() const 00475 { return lo_; } 00477 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > getMultiVector() const 00478 { return dmv_.getMultiVector(); } 00480 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const 00481 { return dmv_.getOrientation(); } 00483 SGDerivativeMultiVector getDerivativeMultiVector() const 00484 { return dmv_; } 00486 bool isEmpty() const 00487 { return !lo_.get() && !dmv_.getMultiVector().get(); } 00488 private: 00489 Teuchos::RefCountPtr< Stokhos::VectorOrthogPoly<Epetra_Operator> > lo_; 00490 SGDerivativeMultiVector dmv_; 00491 }; 00492 00494 enum EOutArgsMembers { 00495 OUT_ARG_f 00496 ,OUT_ARG_W 00497 ,OUT_ARG_f_poly 00498 ,OUT_ARG_f_sg 00499 ,OUT_ARG_W_sg 00500 ,OUT_ARG_WPrec 00501 }; 00502 static const int NUM_E_OUT_ARGS_MEMBERS=7; 00503 00505 enum EOutArgsDfDp { 00506 OUT_ARG_DfDp 00507 }; 00508 00510 enum EOutArgsDgDx_dot { 00511 OUT_ARG_DgDx_dot 00512 }; 00513 00515 enum EOutArgsDgDx { 00516 OUT_ARG_DgDx 00517 }; 00518 00520 enum EOutArgsDgDp { 00521 OUT_ARG_DgDp 00522 }; 00523 00525 enum EOutArgsDfDp_sg { 00526 OUT_ARG_DfDp_sg 00527 }; 00528 00530 enum EOutArgsDgDx_dot_sg { 00531 OUT_ARG_DgDx_dot_sg 00532 }; 00533 00535 enum EOutArgsDgDx_sg { 00536 OUT_ARG_DgDx_sg 00537 }; 00538 00540 enum EOutArgsDgDp_sg { 00541 OUT_ARG_DgDp_sg 00542 }; 00543 00545 class OutArgs { 00546 public: 00547 00549 typedef Teuchos::RefCountPtr<Stokhos::EpetraVectorOrthogPoly> sg_vector_t; 00550 00552 typedef Teuchos::RefCountPtr<Stokhos::VectorOrthogPoly<Epetra_Operator> > sg_operator_t; 00553 00555 OutArgs(); 00557 std::string modelEvalDescription() const; 00559 int Np() const; 00561 int Ng() const; 00563 int Np_sg() const; 00565 int Ng_sg() const; 00567 bool supports(EOutArgsMembers arg) const; 00569 const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const; 00571 const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const; 00573 const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const; 00575 const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const; 00577 const DerivativeSupport& supports(EOutArgsDfDp_sg arg, int l) const; 00579 const DerivativeSupport& supports(EOutArgsDgDx_dot_sg arg, int j) const; 00581 const DerivativeSupport& supports(EOutArgsDgDx_sg arg, int j) const; 00583 const DerivativeSupport& supports(EOutArgsDgDp_sg arg, int j, int l) const; 00585 void set_f( const Evaluation<Epetra_Vector> &f ); 00587 Evaluation<Epetra_Vector> get_f() const; 00589 void set_f_sg( const sg_vector_t& f_sg ); 00591 sg_vector_t get_f_sg() const; 00593 void set_g( int j, const Evaluation<Epetra_Vector> &g_j ); 00595 Evaluation<Epetra_Vector> get_g(int j) const; 00598 void set_g_sg( int j, const sg_vector_t &g_sg_j ); 00601 sg_vector_t get_g_sg(int j) const; 00603 void set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ); 00604 void set_WPrec( const Teuchos::RefCountPtr<Epetra_Operator> &WPrec ); 00606 Teuchos::RefCountPtr<Epetra_Operator> get_W() const; 00607 Teuchos::RefCountPtr<Epetra_Operator> get_WPrec() const; 00609 DerivativeProperties get_W_properties() const; 00610 DerivativeProperties get_WPrec_properties() const; 00612 void set_W_sg( const sg_operator_t& W_sg ); 00614 sg_operator_t get_W_sg() const; 00616 void set_DfDp(int l, const Derivative &DfDp_l); 00618 Derivative get_DfDp(int l) const; 00620 DerivativeProperties get_DfDp_properties(int l) const; 00622 void set_DfDp_sg(int l, const SGDerivative &DfDp_sg_l); 00624 SGDerivative get_DfDp_sg(int l) const; 00626 DerivativeProperties get_DfDp_sg_properties(int l) const; 00628 void set_DgDx_dot(int j, const Derivative &DgDx_dot_j); 00630 Derivative get_DgDx_dot(int j) const; 00632 DerivativeProperties get_DgDx_dot_properties(int j) const; 00634 void set_DgDx_dot_sg(int j, const SGDerivative &DgDx_dot_j); 00636 SGDerivative get_DgDx_dot_sg(int j) const; 00638 DerivativeProperties get_DgDx_dot_sg_properties(int j) const; 00640 void set_DgDx(int j, const Derivative &DgDx_j); 00642 Derivative get_DgDx(int j) const; 00644 DerivativeProperties get_DgDx_properties(int j) const; 00646 void set_DgDx_sg(int j, const SGDerivative &DgDx_j); 00648 SGDerivative get_DgDx_sg(int j) const; 00650 DerivativeProperties get_DgDx_sg_properties(int j) const; 00652 void set_DgDp( int j, int l, const Derivative &DgDp_j_l ); 00654 Derivative get_DgDp(int j, int l) const; 00656 DerivativeProperties get_DgDp_properties(int j, int l) const; 00658 void set_DgDp_sg( int j, int l, const SGDerivative &DgDp_sg_j_l ); 00660 SGDerivative get_DgDp_sg(int j, int l) const; 00662 DerivativeProperties get_DgDp_sg_properties(int j, int l) const; 00663 00665 void set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly ); 00667 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > get_f_poly() const; 00668 00669 00671 bool funcOrDerivesAreSet(EOutArgsMembers arg) const; 00672 00678 void setFailed() const; 00684 bool isFailed() const; 00685 00686 protected: 00688 void _setModelEvalDescription( const std::string &modelEvalDescription ); 00690 void _set_Np_Ng(int Np, int Ng); 00692 void _set_Np_Ng_sg(int Np_sg, int Ng_sg); 00694 void _setSupports( EOutArgsMembers arg, bool supports ); 00696 void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& ); 00698 void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& ); 00700 void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& ); 00702 void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& ); 00704 void _setSupports( EOutArgsDfDp_sg arg, int l, const DerivativeSupport& ); 00706 void _setSupports( EOutArgsDgDx_dot_sg arg, int j, const DerivativeSupport& ); 00708 void _setSupports( EOutArgsDgDx_sg arg, int j, const DerivativeSupport& ); 00710 void _setSupports( EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& ); 00712 void _set_W_properties( const DerivativeProperties &W_properties ); 00713 void _set_WPrec_properties( const DerivativeProperties &WPrec_properties ); 00715 void _set_DfDp_properties( int l, const DerivativeProperties &properties ); 00717 void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties ); 00719 void _set_DgDx_properties( int j, const DerivativeProperties &properties ); 00721 void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties ); 00723 void _set_DfDp_sg_properties( int l, const DerivativeProperties &properties ); 00725 void _set_DgDx_dot_sg_properties( int j, const DerivativeProperties &properties ); 00727 void _set_DgDx_sg_properties( int j, const DerivativeProperties &properties ); 00729 void _set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties ); 00730 private: 00731 // types 00732 typedef Teuchos::Array<Evaluation<Epetra_Vector> > g_t; 00733 typedef Teuchos::Array<sg_vector_t > g_sg_t; 00734 typedef Teuchos::Array<Derivative> deriv_t; 00735 typedef Teuchos::Array<SGDerivative> sg_deriv_t; 00736 typedef Teuchos::Array<DerivativeProperties> deriv_properties_t; 00737 typedef Teuchos::Array<DerivativeSupport> supports_t; 00738 // data 00739 std::string modelEvalDescription_; 00740 mutable bool isFailed_; 00741 bool supports_[NUM_E_OUT_ARGS_MEMBERS]; 00742 supports_t supports_DfDp_; // Np 00743 supports_t supports_DgDx_dot_; // Ng 00744 supports_t supports_DgDx_; // Ng 00745 supports_t supports_DgDp_; // Ng x Np 00746 supports_t supports_DfDp_sg_; // Np_sg 00747 supports_t supports_DgDx_dot_sg_; // Ng_sg 00748 supports_t supports_DgDx_sg_; // Ng_sg 00749 supports_t supports_DgDp_sg_; // Ng_sg x Np_sg 00750 Evaluation<Epetra_Vector> f_; 00751 g_t g_; 00752 g_sg_t g_sg_; 00753 Teuchos::RefCountPtr<Epetra_Operator> W_; 00754 Teuchos::RefCountPtr<Epetra_Operator> WPrec_; 00755 DerivativeProperties W_properties_; 00756 DerivativeProperties WPrec_properties_; 00757 deriv_t DfDp_; // Np 00758 deriv_properties_t DfDp_properties_; // Np 00759 deriv_t DgDx_dot_; // Ng 00760 deriv_t DgDx_; // Ng 00761 deriv_properties_t DgDx_dot_properties_; // Ng 00762 deriv_properties_t DgDx_properties_; // Ng 00763 deriv_t DgDp_; // Ng x Np 00764 deriv_properties_t DgDp_properties_; // Ng x Np 00765 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > f_poly_; 00766 sg_vector_t f_sg_; 00767 sg_operator_t W_sg_; 00768 sg_deriv_t DfDp_sg_; // Np_sg 00769 deriv_properties_t DfDp_sg_properties_; // Np_sg 00770 sg_deriv_t DgDx_dot_sg_; // Ng_sg 00771 sg_deriv_t DgDx_sg_; // Ng_sg 00772 deriv_properties_t DgDx_dot_sg_properties_; // Ng_sg 00773 deriv_properties_t DgDx_sg_properties_; // Ng_sg 00774 sg_deriv_t DgDp_sg_; // Ng_sg x Np_sg 00775 deriv_properties_t DgDp_sg_properties_; // Ng_sg x Np_sg 00776 // functions 00777 void assert_supports(EOutArgsMembers arg) const; 00778 void assert_supports(EOutArgsDfDp arg, int l) const; 00779 void assert_supports(EOutArgsDgDx_dot arg, int j) const; 00780 void assert_supports(EOutArgsDgDx arg, int j) const; 00781 void assert_supports(EOutArgsDgDp arg, int j, int l) const; 00782 void assert_supports(EOutArgsDfDp_sg arg, int l) const; 00783 void assert_supports(EOutArgsDgDx_dot_sg arg, int j) const; 00784 void assert_supports(EOutArgsDgDx_sg arg, int j) const; 00785 void assert_supports(EOutArgsDgDp_sg arg, int j, int l) const; 00786 void assert_l(int l) const; 00787 void assert_j(int j) const; 00788 void assert_l_sg(int l) const; 00789 void assert_j_sg(int j) const; 00790 }; 00791 00793 00796 00798 virtual ~ModelEvaluator(); 00799 00801 00804 00806 virtual Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const = 0; 00807 00809 virtual Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const = 0; 00810 00812 virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const; 00813 00815 virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_sg_map(int l) const; 00816 00831 virtual Teuchos::RefCountPtr<const Teuchos::Array<std::string> > get_p_names(int l) const; 00832 00834 virtual Teuchos::RefCountPtr<const Teuchos::Array<std::string> > get_p_sg_names(int l) const; 00835 00837 virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const; 00838 00840 virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_sg_map(int j) const; 00841 00843 00846 00848 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const; 00849 00851 virtual Teuchos::RefCountPtr<const Stokhos::EpetraVectorOrthogPoly> get_x_sg_init() const; 00852 00854 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot_init() const; 00855 00857 virtual Teuchos::RefCountPtr<const Stokhos::EpetraVectorOrthogPoly> get_x_dot_sg_init() const; 00858 00860 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const; 00861 00863 virtual Teuchos::RefCountPtr<const Stokhos::EpetraVectorOrthogPoly> get_p_sg_init(int l) const; 00864 00866 virtual double get_t_init() const; 00867 00869 00872 00877 virtual double getInfBound() const; 00878 00880 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds() const; 00881 00883 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds() const; 00884 00886 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(int l) const; 00887 00889 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(int l) const; 00890 00892 virtual double get_t_lower_bound() const; 00893 00895 virtual double get_t_upper_bound() const; 00896 00898 00901 00908 virtual Teuchos::RefCountPtr<Epetra_Operator> create_W() const; 00909 virtual Teuchos::RefCountPtr<EpetraExt::ModelEvaluator::Preconditioner> create_WPrec() const; 00910 00912 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(int l) const; 00913 00915 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_sg_op(int l) const; 00916 00918 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dot_op(int j) const; 00919 00921 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dot_sg_op(int j) const; 00922 00924 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_op(int j) const; 00925 00927 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_sg_op(int j) const; 00928 00930 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_op( int j, int l ) const; 00931 00933 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_sg_op( int j, int l ) const; 00934 00936 00939 00941 virtual InArgs createInArgs() const = 0; 00942 00944 virtual OutArgs createOutArgs() const = 0; 00945 00947 virtual void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const = 0; 00948 00949 #ifdef HAVE_PYTRILINOS 00950 00951 friend InArgs convertInArgsFromPython(PyObject * source); 00952 00954 friend OutArgs convertOutArgsFromPython(PyObject * source); 00955 #endif 00956 00957 00958 protected: 00959 00962 00964 class InArgsSetup : public InArgs { 00965 public: 00967 void setModelEvalDescription( const std::string &modelEvalDescription ); 00969 void set_Np(int Np); 00971 void set_Np_sg(int Np); 00973 void setSupports( EInArgsMembers arg, bool supports = true ); 00974 }; 00975 00977 class OutArgsSetup : public OutArgs { 00978 public: 00980 void setModelEvalDescription( const std::string &modelEvalDescription ); 00982 void set_Np_Ng(int Np, int Ng); 00984 void set_Np_Ng_sg(int Np_sg, int Ng_sg); 00986 void setSupports( EOutArgsMembers arg, bool supports = true ); 00988 void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& ); 00990 void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& ); 00992 void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& ); 00994 void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& ); 00996 void setSupports(EOutArgsDfDp_sg arg, int l, const DerivativeSupport& ); 00998 void setSupports(EOutArgsDgDx_dot_sg arg, int j, const DerivativeSupport& ); 01000 void setSupports(EOutArgsDgDx_sg arg, int j, const DerivativeSupport& ); 01002 void setSupports(EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& ); 01004 void set_W_properties( const DerivativeProperties &properties ); 01005 void set_WPrec_properties( const DerivativeProperties &properties ); 01007 void set_DfDp_properties( int l, const DerivativeProperties &properties ); 01009 void set_DgDx_dot_properties( int j, const DerivativeProperties &properties ); 01011 void set_DgDx_properties( int j, const DerivativeProperties &properties ); 01013 void set_DgDp_properties( int j, int l, const DerivativeProperties &properties ); 01015 void set_DfDp_sg_properties( int l, const DerivativeProperties &properties ); 01017 void set_DgDx_dot_sg_properties( int j, const DerivativeProperties &properties ); 01019 void set_DgDx_sg_properties( int j, const DerivativeProperties &properties ); 01021 void set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties ); 01022 }; 01023 01025 01026 }; 01027 01028 // //////////////////////////// 01029 // Helper functions 01030 01032 std::string toString( ModelEvaluator::EDerivativeMultiVectorOrientation orientation ); 01033 01035 std::string toString( ModelEvaluator::EInArgsMembers inArg ); 01036 01038 std::string toString( ModelEvaluator::EOutArgsMembers outArg ); 01039 01041 Teuchos::RefCountPtr<Epetra_Operator> 01042 getLinearOp( 01043 const std::string &modelEvalDescription, 01044 const ModelEvaluator::Derivative &deriv, 01045 const std::string &derivName 01046 ); 01047 01049 Teuchos::RefCountPtr<Epetra_MultiVector> 01050 getMultiVector( 01051 const std::string &modelEvalDescription, 01052 const ModelEvaluator::Derivative &deriv, 01053 const std::string &derivName, 01054 const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01055 ); 01056 01058 Teuchos::RefCountPtr<Epetra_Operator> 01059 get_DfDp_op( 01060 const int l 01061 ,const ModelEvaluator::OutArgs &outArgs 01062 ); 01063 01065 Teuchos::RefCountPtr<Epetra_MultiVector> 01066 get_DfDp_mv( 01067 const int l 01068 ,const ModelEvaluator::OutArgs &outArgs 01069 ); 01070 01072 Teuchos::RefCountPtr<Epetra_MultiVector> 01073 get_DgDx_dot_mv( 01074 const int j 01075 ,const ModelEvaluator::OutArgs &outArgs 01076 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01077 ); 01078 01080 Teuchos::RefCountPtr<Epetra_MultiVector> 01081 get_DgDx_mv( 01082 const int j 01083 ,const ModelEvaluator::OutArgs &outArgs 01084 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01085 ); 01086 01088 Teuchos::RefCountPtr<Epetra_MultiVector> 01089 get_DgDp_mv( 01090 const int j 01091 ,const int l 01092 ,const ModelEvaluator::OutArgs &outArgs 01093 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01094 ); 01095 01096 // /////////////////////////// 01097 // Inline Functions 01098 01099 // 01100 // ModelEvaluator::InArgs 01101 // 01102 01103 inline 01104 std::string ModelEvaluator::InArgs::modelEvalDescription() const 01105 { return modelEvalDescription_; } 01106 01107 inline 01108 int ModelEvaluator::InArgs::Np() const 01109 { return p_.size(); } 01110 01111 inline 01112 int ModelEvaluator::InArgs::Np_sg() const 01113 { return p_sg_.size(); } 01114 01115 inline 01116 void ModelEvaluator::InArgs::set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot ) 01117 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; } 01118 01119 inline 01120 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dot() const 01121 { assert_supports(IN_ARG_x_dot); return x_dot_; } 01122 01123 inline 01124 void ModelEvaluator::InArgs::set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x ) 01125 { assert_supports(IN_ARG_x); x_ = x; } 01126 01127 inline 01128 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x() const 01129 { assert_supports(IN_ARG_x); return x_; } 01130 01131 inline 01132 void ModelEvaluator::InArgs::set_x_dot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly ) 01133 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; } 01134 01135 inline 01136 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > 01137 ModelEvaluator::InArgs::get_x_dot_poly() const 01138 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; } 01139 01140 inline 01141 void ModelEvaluator::InArgs::set_x_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly ) 01142 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; } 01143 01144 inline 01145 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > 01146 ModelEvaluator::InArgs::get_x_poly() const 01147 { assert_supports(IN_ARG_x_poly); return x_poly_; } 01148 01149 inline 01150 void ModelEvaluator::InArgs::set_x_dot_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_dot_sg ) 01151 { assert_supports(IN_ARG_x_dot_sg); x_dot_sg_ = x_dot_sg; } 01152 01153 inline 01154 ModelEvaluator::InArgs::sg_const_vector_t 01155 ModelEvaluator::InArgs::get_x_dot_sg() const 01156 { assert_supports(IN_ARG_x_dot_sg); return x_dot_sg_; } 01157 01158 inline 01159 void ModelEvaluator::InArgs::set_x_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_sg ) 01160 { assert_supports(IN_ARG_x_sg); x_sg_ = x_sg; } 01161 01162 inline 01163 ModelEvaluator::InArgs::sg_const_vector_t 01164 ModelEvaluator::InArgs::get_x_sg() const 01165 { assert_supports(IN_ARG_x_sg); return x_sg_; } 01166 01167 inline 01168 void ModelEvaluator::InArgs::set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l ) 01169 { assert_l(l); p_[l] = p_l; } 01170 01171 inline 01172 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_p(int l) const 01173 { assert_l(l); return p_[l]; } 01174 01175 inline 01176 void ModelEvaluator::InArgs::set_p_sg( int l, 01177 const ModelEvaluator::InArgs::sg_const_vector_t &p_sg_l ) 01178 { assert_l(l); p_sg_[l] = p_sg_l; } 01179 01180 inline 01181 ModelEvaluator::InArgs::sg_const_vector_t 01182 ModelEvaluator::InArgs::get_p_sg(int l) const 01183 { assert_l(l); return p_sg_[l]; } 01184 01185 inline 01186 void ModelEvaluator::InArgs::set_t( double t ) 01187 { assert_supports(IN_ARG_t); t_ = t; } 01188 01189 inline 01190 double ModelEvaluator::InArgs::get_t() const 01191 { assert_supports(IN_ARG_t); return t_; } 01192 01193 inline 01194 void ModelEvaluator::InArgs::set_alpha( double alpha ) 01195 { assert_supports(IN_ARG_alpha); alpha_ = alpha; } 01196 01197 inline 01198 double ModelEvaluator::InArgs::get_alpha() const 01199 { assert_supports(IN_ARG_alpha); return alpha_; } 01200 01201 inline 01202 void ModelEvaluator::InArgs::set_beta( double beta ) 01203 { assert_supports(IN_ARG_beta); beta_ = beta; } 01204 01205 inline 01206 double ModelEvaluator::InArgs::get_beta() const 01207 { assert_supports(IN_ARG_beta); return beta_; } 01208 01209 inline 01210 void ModelEvaluator::InArgs::set_sg_basis( const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis ) 01211 { assert_supports(IN_ARG_sg_basis); sg_basis_ = basis; } 01212 01213 inline 01214 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > 01215 ModelEvaluator::InArgs::get_sg_basis() const 01216 { assert_supports(IN_ARG_sg_basis); return sg_basis_; } 01217 01218 inline 01219 void ModelEvaluator::InArgs::set_sg_quadrature( const Teuchos::RCP<const Stokhos::Quadrature<int,double> >& quad ) 01220 { assert_supports(IN_ARG_sg_quadrature); sg_quad_ = quad; } 01221 01222 inline 01223 Teuchos::RCP<const Stokhos::Quadrature<int,double> > 01224 ModelEvaluator::InArgs::get_sg_quadrature() const 01225 { assert_supports(IN_ARG_sg_quadrature); return sg_quad_; } 01226 01227 inline 01228 void ModelEvaluator::InArgs::set_sg_expansion( const Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> >& exp ) 01229 { assert_supports(IN_ARG_sg_expansion); sg_exp_ = exp; } 01230 01231 inline 01232 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double> > 01233 ModelEvaluator::InArgs::get_sg_expansion() const 01234 { assert_supports(IN_ARG_sg_expansion); return sg_exp_; } 01235 01236 inline 01237 void ModelEvaluator::InArgs::_setModelEvalDescription( const std::string &new_modelEvalDescription ) 01238 { 01239 modelEvalDescription_ = new_modelEvalDescription; 01240 } 01241 01242 inline 01243 void ModelEvaluator::InArgs::_set_Np(int new_Np) 01244 { 01245 p_.resize(new_Np); 01246 } 01247 01248 inline 01249 void ModelEvaluator::InArgs::_set_Np_sg(int new_Np) 01250 { 01251 p_sg_.resize(new_Np); 01252 } 01253 01254 // 01255 // ModelEvaluator::OutArgs 01256 // 01257 01258 inline 01259 std::string ModelEvaluator::OutArgs::modelEvalDescription() const 01260 { return modelEvalDescription_; } 01261 01262 inline 01263 int ModelEvaluator::OutArgs::Np() const 01264 { 01265 return DfDp_.size(); 01266 } 01267 01268 inline 01269 int ModelEvaluator::OutArgs::Ng() const 01270 { 01271 return g_.size(); 01272 } 01273 01274 inline 01275 int ModelEvaluator::OutArgs::Np_sg() const 01276 { 01277 return DfDp_sg_.size(); 01278 } 01279 01280 inline 01281 int ModelEvaluator::OutArgs::Ng_sg() const 01282 { 01283 return g_sg_.size(); 01284 } 01285 01286 inline 01287 void ModelEvaluator::OutArgs::set_f( const Evaluation<Epetra_Vector> &f ) { f_ = f; } 01288 01289 inline 01290 ModelEvaluator::Evaluation<Epetra_Vector> 01291 ModelEvaluator::OutArgs::get_f() const { return f_; } 01292 01293 inline 01294 void ModelEvaluator::OutArgs::set_g( int j, const Evaluation<Epetra_Vector> &g_j ) 01295 { 01296 assert_j(j); 01297 g_[j] = g_j; 01298 } 01299 01300 inline 01301 ModelEvaluator::Evaluation<Epetra_Vector> 01302 ModelEvaluator::OutArgs::get_g(int j) const 01303 { 01304 assert_j(j); 01305 return g_[j]; 01306 } 01307 01308 inline 01309 void ModelEvaluator::OutArgs::set_g_sg( int j, const sg_vector_t &g_sg_j ) 01310 { 01311 assert_j_sg(j); 01312 g_sg_[j] = g_sg_j; 01313 } 01314 01315 inline 01316 ModelEvaluator::OutArgs::sg_vector_t 01317 ModelEvaluator::OutArgs::get_g_sg(int j) const 01318 { 01319 assert_j_sg(j); 01320 return g_sg_[j]; 01321 } 01322 01323 inline 01324 void ModelEvaluator::OutArgs::set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ) { W_ = W; } 01325 inline 01326 void ModelEvaluator::OutArgs::set_WPrec( const Teuchos::RefCountPtr<Epetra_Operator> &WPrec ) { WPrec_ = WPrec; } 01327 01328 inline 01329 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_W() const { return W_; } 01330 inline 01331 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_WPrec() const { return WPrec_; } 01332 01333 inline 01334 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_W_properties() const 01335 { return W_properties_; } 01336 inline 01337 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_WPrec_properties() const 01338 { return WPrec_properties_; } 01339 01340 inline 01341 void ModelEvaluator::OutArgs::set_DfDp( int l, const Derivative &DfDp_l ) 01342 { 01343 assert_supports(OUT_ARG_DfDp,l); 01344 DfDp_[l] = DfDp_l; 01345 } 01346 01347 inline 01348 ModelEvaluator::Derivative 01349 ModelEvaluator::OutArgs::get_DfDp(int l) const 01350 { 01351 assert_supports(OUT_ARG_DfDp,l); 01352 return DfDp_[l]; 01353 } 01354 01355 inline 01356 ModelEvaluator::DerivativeProperties 01357 ModelEvaluator::OutArgs::get_DfDp_properties(int l) const 01358 { 01359 assert_supports(OUT_ARG_DfDp,l); 01360 return DfDp_properties_[l]; 01361 } 01362 01363 inline 01364 void ModelEvaluator::OutArgs::set_DfDp_sg( int l, const SGDerivative &DfDp_sg_l ) 01365 { 01366 assert_supports(OUT_ARG_DfDp_sg,l); 01367 DfDp_sg_[l] = DfDp_sg_l; 01368 } 01369 01370 inline 01371 ModelEvaluator::SGDerivative 01372 ModelEvaluator::OutArgs::get_DfDp_sg(int l) const 01373 { 01374 assert_supports(OUT_ARG_DfDp_sg,l); 01375 return DfDp_sg_[l]; 01376 } 01377 01378 inline 01379 ModelEvaluator::DerivativeProperties 01380 ModelEvaluator::OutArgs::get_DfDp_sg_properties(int l) const 01381 { 01382 assert_supports(OUT_ARG_DfDp_sg,l); 01383 return DfDp_sg_properties_[l]; 01384 } 01385 01386 inline 01387 void ModelEvaluator::OutArgs::set_DgDx_dot( int j, const Derivative &DgDx_dot_j ) 01388 { 01389 assert_supports(OUT_ARG_DgDx_dot,j); 01390 DgDx_dot_[j] = DgDx_dot_j; 01391 } 01392 01393 inline 01394 ModelEvaluator::Derivative 01395 ModelEvaluator::OutArgs::get_DgDx_dot(int j) const 01396 { 01397 assert_supports(OUT_ARG_DgDx_dot,j); 01398 return DgDx_dot_[j]; 01399 } 01400 01401 inline 01402 ModelEvaluator::DerivativeProperties 01403 ModelEvaluator::OutArgs::get_DgDx_dot_properties(int j) const 01404 { 01405 assert_supports(OUT_ARG_DgDx_dot,j); 01406 return DgDx_dot_properties_[j]; 01407 } 01408 01409 inline 01410 void ModelEvaluator::OutArgs::set_DgDx_dot_sg( int j, const SGDerivative &DgDx_dot_sg_j ) 01411 { 01412 assert_supports(OUT_ARG_DgDx_dot_sg,j); 01413 DgDx_dot_sg_[j] = DgDx_dot_sg_j; 01414 } 01415 01416 inline 01417 ModelEvaluator::SGDerivative 01418 ModelEvaluator::OutArgs::get_DgDx_dot_sg(int j) const 01419 { 01420 assert_supports(OUT_ARG_DgDx_dot_sg,j); 01421 return DgDx_dot_sg_[j]; 01422 } 01423 01424 inline 01425 ModelEvaluator::DerivativeProperties 01426 ModelEvaluator::OutArgs::get_DgDx_dot_sg_properties(int j) const 01427 { 01428 assert_supports(OUT_ARG_DgDx_dot_sg,j); 01429 return DgDx_dot_sg_properties_[j]; 01430 } 01431 01432 inline 01433 void ModelEvaluator::OutArgs::set_DgDx( int j, const Derivative &DgDx_j ) 01434 { 01435 assert_supports(OUT_ARG_DgDx,j); 01436 DgDx_[j] = DgDx_j; 01437 } 01438 01439 inline 01440 ModelEvaluator::Derivative 01441 ModelEvaluator::OutArgs::get_DgDx(int j) const 01442 { 01443 assert_supports(OUT_ARG_DgDx,j); 01444 return DgDx_[j]; 01445 } 01446 01447 inline 01448 ModelEvaluator::DerivativeProperties 01449 ModelEvaluator::OutArgs::get_DgDx_properties(int j) const 01450 { 01451 assert_supports(OUT_ARG_DgDx,j); 01452 return DgDx_properties_[j]; 01453 } 01454 01455 inline 01456 void ModelEvaluator::OutArgs::set_DgDx_sg( int j, const SGDerivative &DgDx_sg_j ) 01457 { 01458 assert_supports(OUT_ARG_DgDx_sg,j); 01459 DgDx_sg_[j] = DgDx_sg_j; 01460 } 01461 01462 inline 01463 ModelEvaluator::SGDerivative 01464 ModelEvaluator::OutArgs::get_DgDx_sg(int j) const 01465 { 01466 assert_supports(OUT_ARG_DgDx_sg,j); 01467 return DgDx_sg_[j]; 01468 } 01469 01470 inline 01471 ModelEvaluator::DerivativeProperties 01472 ModelEvaluator::OutArgs::get_DgDx_sg_properties(int j) const 01473 { 01474 assert_supports(OUT_ARG_DgDx_sg,j); 01475 return DgDx_sg_properties_[j]; 01476 } 01477 01478 inline 01479 void ModelEvaluator::OutArgs::set_DgDp( int j, int l, const Derivative &DgDp_j_l ) 01480 { 01481 assert_supports(OUT_ARG_DgDp,j,l); 01482 DgDp_[ j*Np() + l ] = DgDp_j_l; 01483 } 01484 01485 inline 01486 ModelEvaluator::Derivative 01487 ModelEvaluator::OutArgs::get_DgDp(int j, int l) const 01488 { 01489 assert_supports(OUT_ARG_DgDp,j,l); 01490 return DgDp_[ j*Np() + l ]; 01491 } 01492 01493 inline 01494 ModelEvaluator::DerivativeProperties 01495 ModelEvaluator::OutArgs::get_DgDp_properties(int j, int l) const 01496 { 01497 assert_supports(OUT_ARG_DgDp,j,l); 01498 return DgDp_properties_[ j*Np() + l ]; 01499 } 01500 01501 inline 01502 void ModelEvaluator::OutArgs::set_DgDp_sg( int j, int l, const SGDerivative &DgDp_sg_j_l ) 01503 { 01504 assert_supports(OUT_ARG_DgDp_sg,j,l); 01505 DgDp_sg_[ j*Np_sg() + l ] = DgDp_sg_j_l; 01506 } 01507 01508 inline 01509 ModelEvaluator::SGDerivative 01510 ModelEvaluator::OutArgs::get_DgDp_sg(int j, int l) const 01511 { 01512 assert_supports(OUT_ARG_DgDp_sg,j,l); 01513 return DgDp_sg_[ j*Np_sg() + l ]; 01514 } 01515 01516 inline 01517 ModelEvaluator::DerivativeProperties 01518 ModelEvaluator::OutArgs::get_DgDp_sg_properties(int j, int l) const 01519 { 01520 assert_supports(OUT_ARG_DgDp_sg,j,l); 01521 return DgDp_sg_properties_[ j*Np_sg() + l ]; 01522 } 01523 01524 inline 01525 void ModelEvaluator::OutArgs::set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly ) 01526 { f_poly_ = f_poly; } 01527 01528 inline 01529 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > 01530 ModelEvaluator::OutArgs::get_f_poly() const 01531 { return f_poly_; } 01532 01533 inline 01534 void ModelEvaluator::OutArgs::set_f_sg( const ModelEvaluator::OutArgs::sg_vector_t& f_sg ) 01535 { f_sg_ = f_sg; } 01536 01537 inline 01538 ModelEvaluator::OutArgs::sg_vector_t 01539 ModelEvaluator::OutArgs::get_f_sg() const 01540 { return f_sg_; } 01541 01542 inline 01543 void ModelEvaluator::OutArgs::set_W_sg( const ModelEvaluator::OutArgs::sg_operator_t& W_sg ) { W_sg_ = W_sg; } 01544 01545 inline 01546 ModelEvaluator::OutArgs::sg_operator_t ModelEvaluator::OutArgs::get_W_sg() const { return W_sg_; } 01547 01548 // 01549 // ModelEvaluator::InArgsSetup 01550 // 01551 01552 inline 01553 void ModelEvaluator::InArgsSetup::setModelEvalDescription( const std::string &new_modelEvalDescription ) 01554 { 01555 this->_setModelEvalDescription(new_modelEvalDescription); 01556 } 01557 01558 inline 01559 void ModelEvaluator::InArgsSetup::set_Np(int new_Np) 01560 { this->_set_Np(new_Np); } 01561 01562 inline 01563 void ModelEvaluator::InArgsSetup::set_Np_sg(int new_Np) 01564 { this->_set_Np_sg(new_Np); } 01565 01566 inline 01567 void ModelEvaluator::InArgsSetup::setSupports( EInArgsMembers arg, bool new_supports ) 01568 { this->_setSupports(arg,new_supports); } 01569 01570 // 01571 // ModelEvaluator::OutArgsSetup 01572 // 01573 01574 inline 01575 void ModelEvaluator::OutArgsSetup::setModelEvalDescription( const std::string &new_modelEvalDescription ) 01576 { 01577 this->_setModelEvalDescription(new_modelEvalDescription); 01578 } 01579 01580 inline 01581 void ModelEvaluator::OutArgsSetup::set_Np_Ng(int new_Np, int new_Ng) 01582 { this->_set_Np_Ng(new_Np,new_Ng); } 01583 01584 inline 01585 void ModelEvaluator::OutArgsSetup::set_Np_Ng_sg(int new_Np_sg, int new_Ng_sg) 01586 { this->_set_Np_Ng_sg(new_Np_sg, new_Ng_sg); } 01587 01588 inline 01589 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsMembers arg, bool new_supports ) 01590 { this->_setSupports(arg,new_supports); } 01591 01592 inline 01593 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& new_supports ) 01594 { this->_setSupports(arg,l,new_supports); } 01595 01596 inline 01597 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& new_supports ) 01598 { this->_setSupports(arg,j,new_supports); } 01599 01600 inline 01601 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& new_supports ) 01602 { this->_setSupports(arg,j,new_supports); } 01603 01604 inline 01605 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& new_supports ) 01606 { this->_setSupports(arg,j,l,new_supports); } 01607 01608 inline 01609 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp_sg arg, int l, const DerivativeSupport& new_supports ) 01610 { this->_setSupports(arg,l,new_supports); } 01611 01612 inline 01613 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot_sg arg, int j, const DerivativeSupport& new_supports ) 01614 { this->_setSupports(arg,j,new_supports); } 01615 01616 inline 01617 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_sg arg, int j, const DerivativeSupport& new_supports ) 01618 { this->_setSupports(arg,j,new_supports); } 01619 01620 inline 01621 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& new_supports ) 01622 { this->_setSupports(arg,j,l,new_supports); } 01623 01624 inline 01625 void ModelEvaluator::OutArgsSetup::set_W_properties( const DerivativeProperties &properties ) 01626 { this->_set_W_properties(properties); } 01627 inline 01628 void ModelEvaluator::OutArgsSetup::set_WPrec_properties( const DerivativeProperties &properties ) 01629 { this->_set_WPrec_properties(properties); } 01630 01631 inline 01632 void ModelEvaluator::OutArgsSetup::set_DfDp_properties( int l, const DerivativeProperties &properties ) 01633 { 01634 this->_set_DfDp_properties(l,properties); 01635 } 01636 01637 inline 01638 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_properties( int j, const DerivativeProperties &properties ) 01639 { 01640 this->_set_DgDx_dot_properties(j,properties); 01641 } 01642 01643 inline 01644 void ModelEvaluator::OutArgsSetup::set_DgDx_properties( int j, const DerivativeProperties &properties ) 01645 { 01646 this->_set_DgDx_properties(j,properties); 01647 } 01648 01649 inline 01650 void ModelEvaluator::OutArgsSetup::set_DgDp_properties( int j, int l, const DerivativeProperties &properties ) 01651 { 01652 this->_set_DgDp_properties(j,l,properties); 01653 } 01654 01655 inline 01656 void ModelEvaluator::OutArgsSetup::set_DfDp_sg_properties( int l, const DerivativeProperties &properties ) 01657 { 01658 this->_set_DfDp_sg_properties(l,properties); 01659 } 01660 01661 inline 01662 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_sg_properties( int j, const DerivativeProperties &properties ) 01663 { 01664 this->_set_DgDx_dot_sg_properties(j,properties); 01665 } 01666 01667 inline 01668 void ModelEvaluator::OutArgsSetup::set_DgDx_sg_properties( int j, const DerivativeProperties &properties ) 01669 { 01670 this->_set_DgDx_sg_properties(j,properties); 01671 } 01672 01673 inline 01674 void ModelEvaluator::OutArgsSetup::set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties ) 01675 { 01676 this->_set_DgDp_sg_properties(j,l,properties); 01677 } 01678 01679 } // namespace EpetraExt 01680 01681 #endif // EPETRA_EXT_MODEL_EVALUATOR_HPP
1.7.4