|
EpetraExt
Development
|
00001 //@HEADER 00002 // *********************************************************************** 00003 // 00004 // EpetraExt: Epetra Extended - Linear Algebra Services Package 00005 // Copyright (2011) Sandia Corporation 00006 // 00007 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00008 // the U.S. Government retains certain rights in this software. 00009 // 00010 // Redistribution and use in source and binary forms, with or without 00011 // modification, are permitted provided that the following conditions are 00012 // met: 00013 // 00014 // 1. Redistributions of source code must retain the above copyright 00015 // notice, this list of conditions and the following disclaimer. 00016 // 00017 // 2. Redistributions in binary form must reproduce the above copyright 00018 // notice, this list of conditions and the following disclaimer in the 00019 // documentation and/or other materials provided with the distribution. 00020 // 00021 // 3. Neither the name of the Corporation nor the names of the 00022 // contributors may be used to endorse or promote products derived from 00023 // this software without specific prior written permission. 00024 // 00025 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY 00026 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00027 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00028 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE 00029 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00030 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00031 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 // 00037 // Questions? Contact Michael A. Heroux (maherou@sandia.gov) 00038 // 00039 // *********************************************************************** 00040 //@HEADER 00041 00042 #ifndef EPETRA_EXT_MODEL_EVALUATOR_HPP 00043 #define EPETRA_EXT_MODEL_EVALUATOR_HPP 00044 00045 #include "EpetraExt_ConfigDefs.h" 00046 #include "EpetraExt_PolynomialVectorTraits.h" 00047 #include "Teuchos_RefCountPtr.hpp" 00048 #include "Teuchos_Describable.hpp" 00049 #include "Teuchos_Polynomial.hpp" 00050 #include "Teuchos_Array.hpp" 00051 00052 #ifdef HAVE_PYTRILINOS 00053 #ifndef PyObject_HEAD 00054 struct _object; 00055 typedef _object PyObject; 00056 #endif 00057 #endif 00058 00059 class Epetra_Map; 00060 class Epetra_Vector; 00061 class Epetra_Operator; 00062 00063 // Forward declaration of Stochastic Galerkin (SG) argument types 00064 namespace Stokhos { 00065 class EpetraVectorOrthogPoly; 00066 class EpetraMultiVectorOrthogPoly; 00067 class EpetraOperatorOrthogPoly; 00068 template <typename ordinal_type, typename scalar_type> class OrthogPolyBasis; 00069 template <typename ordinal_type, typename scalar_type> class Quadrature; 00070 template <typename ordinal_type, typename scalar_type> class StandardStorage; 00071 template <typename ordinal_type, typename scalar_type, typename node_type> class OrthogPolyExpansion; 00072 00073 class ProductEpetraVector; 00074 class ProductEpetraMultiVector; 00075 class ProductEpetraOperator; 00076 } 00077 00078 namespace EpetraExt { 00079 00084 class ModelEvaluator : virtual public Teuchos::Describable { 00085 public: 00086 00089 00090 typedef Teuchos::RCP<const Stokhos::ProductEpetraVector> mp_const_vector_t; 00091 typedef Teuchos::RCP<const Stokhos::ProductEpetraMultiVector> mp_const_multivector_t; 00092 typedef Teuchos::RCP<const Stokhos::ProductEpetraOperator > mp_const_operator_t; 00093 typedef Teuchos::RCP<Stokhos::ProductEpetraVector> mp_vector_t; 00094 typedef Teuchos::RCP<Stokhos::ProductEpetraMultiVector> mp_multivector_t; 00095 typedef Teuchos::RCP<Stokhos::ProductEpetraOperator > mp_operator_t; 00096 00098 enum EInArgsMembers { 00099 IN_ARG_x_dot 00100 ,IN_ARG_x 00101 ,IN_ARG_x_dot_poly 00102 ,IN_ARG_x_poly 00103 ,IN_ARG_x_dot_sg 00104 ,IN_ARG_x_sg 00105 ,IN_ARG_x_dot_mp 00106 ,IN_ARG_x_mp 00107 ,IN_ARG_t 00108 ,IN_ARG_alpha 00109 ,IN_ARG_beta 00110 ,IN_ARG_x_dotdot 00111 ,IN_ARG_x_dotdot_poly 00112 ,IN_ARG_x_dotdot_sg 00113 ,IN_ARG_x_dotdot_mp 00114 ,IN_ARG_omega // < Coeff of second derivative term d(x_dotdot)/dx 00115 ,IN_ARG_sg_basis 00116 ,IN_ARG_sg_quadrature 00117 ,IN_ARG_sg_expansion 00118 }; 00119 static const int NUM_E_IN_ARGS_MEMBERS=19; 00120 00122 enum EInArgs_p_sg { 00123 IN_ARG_p_sg 00124 }; 00125 00127 enum EInArgs_p_mp { 00128 IN_ARG_p_mp 00129 }; 00130 00132 class InArgs { 00133 public: 00134 00136 typedef Teuchos::RefCountPtr<const Stokhos::EpetraVectorOrthogPoly> sg_const_vector_t; 00137 00139 InArgs(); 00141 std::string modelEvalDescription() const; 00143 int Np() const; 00145 void set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot ); 00147 void set_x_dotdot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dotdot ); 00149 Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot() const; 00151 Teuchos::RefCountPtr<const Epetra_Vector> get_x_dotdot() const; 00153 void set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x ); 00155 Teuchos::RefCountPtr<const Epetra_Vector> get_x() const; 00156 void set_x_poly( 00157 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly 00158 ); 00160 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_poly() const; 00162 void set_x_dot_poly( 00163 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly 00164 ); 00165 void set_x_dotdot_poly( 00166 const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dotdot_poly 00167 ); 00169 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dot_poly() const; 00170 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dotdot_poly() const; 00172 void set_x_sg(const sg_const_vector_t &x_sg); 00174 sg_const_vector_t get_x_sg() const; 00176 void set_x_dot_sg(const sg_const_vector_t &x_dot_sg); 00177 void set_x_dotdot_sg(const sg_const_vector_t &x_dotdot_sg); 00179 sg_const_vector_t get_x_dot_sg() const; 00180 sg_const_vector_t get_x_dotdot_sg() const; 00182 void set_x_mp(const mp_const_vector_t &x_mp); 00184 mp_const_vector_t get_x_mp() const; 00186 void set_x_dot_mp(const mp_const_vector_t &x_dot_mp); 00187 void set_x_dotdot_mp(const mp_const_vector_t &x_dotdot_mp); 00189 mp_const_vector_t get_x_dot_mp() const; 00190 mp_const_vector_t get_x_dotdot_mp() const; 00192 void set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l ); 00194 Teuchos::RefCountPtr<const Epetra_Vector> get_p(int l) const; 00196 void set_p_sg( int l, const sg_const_vector_t &p_sg_l ); 00198 sg_const_vector_t get_p_sg(int l) const; 00200 void set_p_mp( int l, const mp_const_vector_t &p_mp_l ); 00202 mp_const_vector_t get_p_mp(int l) const; 00204 void set_t( double t ); 00206 double get_alpha() const; 00208 void set_alpha( double alpha ); 00211 double get_omega() const; 00213 void set_omega( double omega ); 00214 double get_beta() const; 00216 void set_beta( double beta ); 00218 double get_t() const; 00220 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > get_sg_basis() const; 00222 void set_sg_basis( const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis ); 00224 Teuchos::RCP<const Stokhos::Quadrature<int,double> > get_sg_quadrature() const; 00226 void set_sg_quadrature( const Teuchos::RCP<const Stokhos::Quadrature<int,double> >& quad ); 00228 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > > get_sg_expansion() const; 00230 void set_sg_expansion( const Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > >& exp ); 00232 bool supports(EInArgsMembers arg) const; 00234 bool supports(EInArgs_p_sg arg, int l) const; 00236 bool supports(EInArgs_p_mp arg, int l) const; 00237 protected: 00239 void _setModelEvalDescription( const std::string &modelEvalDescription ); 00241 void _set_Np(int Np); 00243 void _setSupports( EInArgsMembers arg, bool supports ); 00245 void _setSupports( EInArgs_p_sg arg, int l, bool supports ); 00247 void _setSupports( EInArgs_p_mp arg, int l, bool supports ); 00248 private: 00249 // types 00250 typedef Teuchos::Array<Teuchos::RefCountPtr<const Epetra_Vector> > p_t; 00251 typedef Teuchos::Array<sg_const_vector_t > p_sg_t; 00252 typedef Teuchos::Array<mp_const_vector_t > p_mp_t; 00253 typedef Teuchos::Array<bool> supports_p_sg_t; 00254 // data 00255 std::string modelEvalDescription_; 00256 Teuchos::RefCountPtr<const Epetra_Vector> x_dot_; 00257 Teuchos::RefCountPtr<const Epetra_Vector> x_dotdot_; 00258 Teuchos::RefCountPtr<const Epetra_Vector> x_; 00259 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dot_poly_; 00260 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dotdot_poly_; 00261 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_poly_; 00262 sg_const_vector_t x_dot_sg_; 00263 sg_const_vector_t x_dotdot_sg_; 00264 sg_const_vector_t x_sg_; 00265 mp_const_vector_t x_dot_mp_; 00266 mp_const_vector_t x_dotdot_mp_; 00267 mp_const_vector_t x_mp_; 00268 p_t p_; 00269 p_sg_t p_sg_; 00270 p_mp_t p_mp_; 00271 double t_; 00272 double alpha_; 00273 double omega_; 00274 double beta_; 00275 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > sg_basis_; 00276 Teuchos::RCP<const Stokhos::Quadrature<int,double> > sg_quad_; 00277 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > > sg_exp_; 00278 bool supports_[NUM_E_IN_ARGS_MEMBERS]; 00279 supports_p_sg_t supports_p_sg_; // Np 00280 supports_p_sg_t supports_p_mp_; // Np 00281 // functions 00282 void assert_supports(EInArgsMembers arg) const; 00283 void assert_supports(EInArgs_p_sg arg, int l) const; 00284 void assert_supports(EInArgs_p_mp arg, int l) const; 00285 void assert_l(int l) const; 00286 }; 00287 00289 enum EEvalType { 00290 EVAL_TYPE_EXACT 00291 ,EVAL_TYPE_APPROX_DERIV 00292 ,EVAL_TYPE_VERY_APPROX_DERIV 00293 }; 00294 00296 template<class ObjType> 00297 class Evaluation : public Teuchos::RefCountPtr<ObjType> { 00298 public: 00300 Evaluation() : evalType_(EVAL_TYPE_EXACT) {} 00302 Evaluation( const Teuchos::RefCountPtr<ObjType> &obj ) 00303 : Teuchos::RefCountPtr<ObjType>(obj), evalType_(EVAL_TYPE_EXACT) {} 00305 Evaluation( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType ) 00306 : Teuchos::RefCountPtr<ObjType>(obj), evalType_(evalType) {} 00308 EEvalType getType() const { return evalType_; } 00310 void reset( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType ) 00311 { this->operator=(obj); evalType_ = evalType; } 00312 private: 00313 EEvalType evalType_; 00314 }; 00315 00317 enum EDerivativeMultiVectorOrientation { 00318 DERIV_MV_BY_COL 00319 ,DERIV_TRANS_MV_BY_ROW 00320 }; 00321 00323 enum EDerivativeLinearOp { DERIV_LINEAR_OP }; 00324 00326 class DerivativeSupport { 00327 public: 00329 DerivativeSupport() 00330 :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false) 00331 {} 00333 DerivativeSupport( EDerivativeLinearOp ) 00334 :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false) 00335 {} 00337 DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation ) 00338 :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL) 00339 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW) 00340 {} 00342 DerivativeSupport( 00343 EDerivativeLinearOp, EDerivativeMultiVectorOrientation mvOrientation ) 00344 :supportsLinearOp_(true), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL) 00345 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW) 00346 {} 00348 DerivativeSupport( 00349 EDerivativeMultiVectorOrientation mvOrientation1, 00350 EDerivativeMultiVectorOrientation mvOrientation2 00351 ) 00352 :supportsLinearOp_(false) 00353 ,supportsMVByCol_( 00354 mvOrientation1==DERIV_MV_BY_COL||mvOrientation2==DERIV_MV_BY_COL ) 00355 ,supportsTransMVByRow_( 00356 mvOrientation1==DERIV_TRANS_MV_BY_ROW||mvOrientation2==DERIV_TRANS_MV_BY_ROW ) 00357 {} 00359 DerivativeSupport& plus(EDerivativeLinearOp) 00360 { supportsLinearOp_ = true; return *this; } 00362 DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation) 00363 { 00364 switch(mvOrientation) { 00365 case DERIV_MV_BY_COL: supportsMVByCol_ = true; break; 00366 case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break; 00367 default: TEUCHOS_TEST_FOR_EXCEPT(true); 00368 } 00369 return *this; 00370 } 00372 bool none() const 00373 { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); } 00375 bool supports(EDerivativeLinearOp) const 00376 { return supportsLinearOp_; } 00378 bool supports(EDerivativeMultiVectorOrientation mvOrientation) const 00379 { 00380 switch(mvOrientation) { 00381 case DERIV_MV_BY_COL: return supportsMVByCol_; 00382 case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_; 00383 default: TEUCHOS_TEST_FOR_EXCEPT(true); 00384 } 00385 return false; // Will never be called! 00386 } 00387 private: 00388 bool supportsLinearOp_; 00389 bool supportsMVByCol_; 00390 bool supportsTransMVByRow_; 00391 public: 00392 }; 00393 00395 enum EDerivativeLinearity { 00396 DERIV_LINEARITY_UNKNOWN 00397 ,DERIV_LINEARITY_CONST 00398 ,DERIV_LINEARITY_NONCONST 00399 }; 00401 enum ERankStatus { 00402 DERIV_RANK_UNKNOWN 00403 ,DERIV_RANK_FULL 00404 ,DERIV_RANK_DEFICIENT 00405 }; 00406 00408 struct DerivativeProperties { 00410 EDerivativeLinearity linearity; 00412 ERankStatus rank; 00414 bool supportsAdjoint; 00416 DerivativeProperties() 00417 :linearity(DERIV_LINEARITY_UNKNOWN),rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) {} 00419 DerivativeProperties( 00420 EDerivativeLinearity in_linearity, ERankStatus in_rank, bool in_supportsAdjoint 00421 ):linearity(in_linearity),rank(in_rank),supportsAdjoint(in_supportsAdjoint) {} 00422 }; 00423 00427 class DerivativeMultiVector { 00428 public: 00430 DerivativeMultiVector() {} 00432 DerivativeMultiVector( 00433 const Teuchos::RefCountPtr<Epetra_MultiVector> &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<Epetra_MultiVector> 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<Epetra_MultiVector> mv_; 00451 EDerivativeMultiVectorOrientation orientation_; 00452 Teuchos::Array<int> paramIndexes_; 00453 }; 00454 00458 class Derivative { 00459 public: 00461 Derivative() {} 00463 Derivative( const Teuchos::RefCountPtr<Epetra_Operator> &lo ) 00464 : lo_(lo) {} 00466 Derivative( 00467 const Teuchos::RefCountPtr<Epetra_MultiVector> &mv 00468 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00469 ) : dmv_(mv,orientation) {} 00471 Derivative( const DerivativeMultiVector &dmv ) 00472 : dmv_(dmv) {} 00474 Teuchos::RefCountPtr<Epetra_Operator> getLinearOp() const 00475 { return lo_; } 00477 Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const 00478 { return dmv_.getMultiVector(); } 00480 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const 00481 { return dmv_.getOrientation(); } 00483 DerivativeMultiVector getDerivativeMultiVector() const 00484 { return dmv_; } 00486 bool isEmpty() const 00487 { return !lo_.get() && !dmv_.getMultiVector().get(); } 00488 private: 00489 Teuchos::RefCountPtr<Epetra_Operator> lo_; 00490 DerivativeMultiVector dmv_; 00491 }; 00492 00496 struct Preconditioner { 00498 Preconditioner() : PrecOp(Teuchos::null), isAlreadyInverted(false) {} 00500 Preconditioner(const Teuchos::RCP<Epetra_Operator>& PrecOp_, 00501 bool isAlreadyInverted_ ) 00502 : PrecOp(PrecOp_), isAlreadyInverted(isAlreadyInverted_) {} 00504 Teuchos::RCP<Epetra_Operator> PrecOp; 00509 bool isAlreadyInverted; 00510 }; 00511 00515 class SGDerivativeMultiVector { 00516 public: 00518 SGDerivativeMultiVector() {} 00520 SGDerivativeMultiVector( 00521 const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv 00522 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00523 ,const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>() 00524 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {} 00526 void changeOrientation( const EDerivativeMultiVectorOrientation orientation ) 00527 { orientation_ = orientation; }; 00529 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > getMultiVector() const 00530 { return mv_; } 00532 EDerivativeMultiVectorOrientation getOrientation() const 00533 { return orientation_; } 00535 const Teuchos::Array<int>& getParamIndexes() const 00536 { return paramIndexes_; } 00537 private: 00538 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > mv_; 00539 EDerivativeMultiVectorOrientation orientation_; 00540 Teuchos::Array<int> paramIndexes_; 00541 }; 00542 00546 class SGDerivative { 00547 public: 00549 SGDerivative() {} 00551 SGDerivative( const Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > &lo ) 00552 : lo_(lo) {} 00554 SGDerivative( 00555 const Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > &mv 00556 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00557 ) : dmv_(mv,orientation) {} 00559 SGDerivative( const SGDerivativeMultiVector &dmv ) 00560 : dmv_(dmv) {} 00562 Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > getLinearOp() const 00563 { return lo_; } 00565 Teuchos::RefCountPtr< Stokhos::EpetraMultiVectorOrthogPoly > getMultiVector() const 00566 { return dmv_.getMultiVector(); } 00568 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const 00569 { return dmv_.getOrientation(); } 00571 SGDerivativeMultiVector getDerivativeMultiVector() const 00572 { return dmv_; } 00574 bool isEmpty() const 00575 { return !lo_.get() && !dmv_.getMultiVector().get(); } 00576 private: 00577 Teuchos::RefCountPtr< Stokhos::EpetraOperatorOrthogPoly > lo_; 00578 SGDerivativeMultiVector dmv_; 00579 }; 00580 00584 class MPDerivativeMultiVector { 00585 public: 00586 00588 MPDerivativeMultiVector() {} 00590 MPDerivativeMultiVector( 00591 const mp_multivector_t &mv 00592 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00593 ,const Teuchos::Array<int> ¶mIndexes = Teuchos::Array<int>() 00594 ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {} 00596 void changeOrientation( const EDerivativeMultiVectorOrientation orientation ) 00597 { orientation_ = orientation; }; 00599 mp_multivector_t getMultiVector() const 00600 { return mv_; } 00602 EDerivativeMultiVectorOrientation getOrientation() const 00603 { return orientation_; } 00605 const Teuchos::Array<int>& getParamIndexes() const 00606 { return paramIndexes_; } 00607 private: 00608 mp_multivector_t mv_; 00609 EDerivativeMultiVectorOrientation orientation_; 00610 Teuchos::Array<int> paramIndexes_; 00611 }; 00612 00616 class MPDerivative { 00617 public: 00618 00620 MPDerivative() {} 00622 MPDerivative( const mp_operator_t &lo ) 00623 : lo_(lo) {} 00625 MPDerivative( 00626 const mp_multivector_t &mv 00627 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00628 ) : dmv_(mv,orientation) {} 00630 MPDerivative( const MPDerivativeMultiVector &dmv ) 00631 : dmv_(dmv) {} 00633 mp_operator_t getLinearOp() const 00634 { return lo_; } 00636 mp_multivector_t getMultiVector() const 00637 { return dmv_.getMultiVector(); } 00639 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const 00640 { return dmv_.getOrientation(); } 00642 MPDerivativeMultiVector getDerivativeMultiVector() const 00643 { return dmv_; } 00645 bool isEmpty() const 00646 { return !lo_.get() && !dmv_.getMultiVector().get(); } 00647 private: 00648 mp_operator_t lo_; 00649 MPDerivativeMultiVector dmv_; 00650 }; 00651 00653 enum EOutArgsMembers { 00654 OUT_ARG_f 00655 ,OUT_ARG_W 00656 ,OUT_ARG_f_poly 00657 ,OUT_ARG_f_sg 00658 ,OUT_ARG_W_sg 00659 ,OUT_ARG_f_mp 00660 ,OUT_ARG_W_mp 00661 ,OUT_ARG_WPrec 00662 }; 00663 static const int NUM_E_OUT_ARGS_MEMBERS=9; 00664 00666 enum EOutArgsDfDp { 00667 OUT_ARG_DfDp 00668 }; 00669 00671 enum EOutArgsDgDx_dot { 00672 OUT_ARG_DgDx_dot 00673 }; 00674 00676 enum EOutArgsDgDx_dotdot { 00677 OUT_ARG_DgDx_dotdot 00678 }; 00679 00681 enum EOutArgsDgDx { 00682 OUT_ARG_DgDx 00683 }; 00684 00686 enum EOutArgsDgDp { 00687 OUT_ARG_DgDp 00688 }; 00689 00691 enum EOutArgsDfDp_sg { 00692 OUT_ARG_DfDp_sg 00693 }; 00694 00696 enum EOutArgs_g_sg { 00697 OUT_ARG_g_sg 00698 }; 00699 00701 enum EOutArgsDgDx_dot_sg { 00702 OUT_ARG_DgDx_dot_sg 00703 }; 00704 00706 enum EOutArgsDgDx_dotdot_sg { 00707 OUT_ARG_DgDx_dotdot_sg 00708 }; 00709 00711 enum EOutArgsDgDx_sg { 00712 OUT_ARG_DgDx_sg 00713 }; 00714 00716 enum EOutArgsDgDp_sg { 00717 OUT_ARG_DgDp_sg 00718 }; 00719 00721 enum EOutArgsDfDp_mp { 00722 OUT_ARG_DfDp_mp 00723 }; 00724 00726 enum EOutArgs_g_mp { 00727 OUT_ARG_g_mp 00728 }; 00729 00731 enum EOutArgsDgDx_dot_mp { 00732 OUT_ARG_DgDx_dot_mp 00733 }; 00734 00736 enum EOutArgsDgDx_dotdot_mp { 00737 OUT_ARG_DgDx_dotdot_mp 00738 }; 00739 00741 enum EOutArgsDgDx_mp { 00742 OUT_ARG_DgDx_mp 00743 }; 00744 00746 enum EOutArgsDgDp_mp { 00747 OUT_ARG_DgDp_mp 00748 }; 00749 00751 class OutArgs { 00752 public: 00753 00755 typedef Teuchos::RefCountPtr<Stokhos::EpetraVectorOrthogPoly> sg_vector_t; 00756 00758 typedef Teuchos::RefCountPtr<Stokhos::EpetraOperatorOrthogPoly > sg_operator_t; 00759 00761 OutArgs(); 00763 std::string modelEvalDescription() const; 00765 int Np() const; 00767 int Ng() const; 00769 bool supports(EOutArgsMembers arg) const; 00771 const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const; 00773 const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const; 00774 const DerivativeSupport& supports(EOutArgsDgDx_dotdot arg, int j) const; 00776 const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const; 00778 const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const; 00780 bool supports(EOutArgs_g_sg arg, int j) const; 00782 const DerivativeSupport& supports(EOutArgsDfDp_sg arg, int l) const; 00784 const DerivativeSupport& supports(EOutArgsDgDx_dot_sg arg, int j) const; 00785 const DerivativeSupport& supports(EOutArgsDgDx_dotdot_sg arg, int j) const; 00787 const DerivativeSupport& supports(EOutArgsDgDx_sg arg, int j) const; 00789 const DerivativeSupport& supports(EOutArgsDgDp_sg arg, int j, int l) const; 00791 const DerivativeSupport& supports(EOutArgsDfDp_mp arg, int l) const; 00793 bool supports(EOutArgs_g_mp arg, int j) const; 00795 const DerivativeSupport& supports(EOutArgsDgDx_dot_mp arg, int j) const; 00796 const DerivativeSupport& supports(EOutArgsDgDx_dotdot_mp arg, int j) const; 00798 const DerivativeSupport& supports(EOutArgsDgDx_mp arg, int j) const; 00800 const DerivativeSupport& supports(EOutArgsDgDp_mp arg, int j, int l) const; 00802 void set_f( const Evaluation<Epetra_Vector> &f ); 00804 Evaluation<Epetra_Vector> get_f() const; 00806 void set_f_sg( const sg_vector_t& f_sg ); 00808 sg_vector_t get_f_sg() const; 00810 void set_f_mp( const mp_vector_t& f_sg ); 00812 mp_vector_t get_f_mp() const; 00814 void set_g( int j, const Evaluation<Epetra_Vector> &g_j ); 00816 Evaluation<Epetra_Vector> get_g(int j) const; 00819 void set_g_sg( int j, const sg_vector_t &g_sg_j ); 00822 sg_vector_t get_g_sg(int j) const; 00825 void set_g_mp( int j, const mp_vector_t &g_mp_j ); 00828 mp_vector_t get_g_mp(int j) const; 00830 void set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ); 00831 void set_WPrec( const Teuchos::RefCountPtr<Epetra_Operator> &WPrec ); 00833 Teuchos::RefCountPtr<Epetra_Operator> get_W() const; 00834 Teuchos::RefCountPtr<Epetra_Operator> get_WPrec() const; 00836 DerivativeProperties get_W_properties() const; 00837 DerivativeProperties get_WPrec_properties() const; 00839 void set_W_sg( const sg_operator_t& W_sg ); 00841 sg_operator_t get_W_sg() const; 00843 void set_W_mp( const mp_operator_t& W_sg ); 00845 mp_operator_t get_W_mp() const; 00847 void set_DfDp(int l, const Derivative &DfDp_l); 00849 Derivative get_DfDp(int l) const; 00851 DerivativeProperties get_DfDp_properties(int l) const; 00853 void set_DfDp_sg(int l, const SGDerivative &DfDp_sg_l); 00855 SGDerivative get_DfDp_sg(int l) const; 00857 DerivativeProperties get_DfDp_sg_properties(int l) const; 00859 void set_DfDp_mp(int l, const MPDerivative &DfDp_mp_l); 00861 MPDerivative get_DfDp_mp(int l) const; 00863 DerivativeProperties get_DfDp_mp_properties(int l) const; 00865 void set_DgDx_dot(int j, const Derivative &DgDx_dot_j); 00866 void set_DgDx_dotdot(int j, const Derivative &DgDx_dotdot_j); 00868 Derivative get_DgDx_dot(int j) const; 00869 Derivative get_DgDx_dotdot(int j) const; 00871 DerivativeProperties get_DgDx_dot_properties(int j) const; 00872 DerivativeProperties get_DgDx_dotdot_properties(int j) const; 00874 void set_DgDx_dot_sg(int j, const SGDerivative &DgDx_dot_j); 00875 void set_DgDx_dotdot_sg(int j, const SGDerivative &DgDx_dotdot_j); 00877 SGDerivative get_DgDx_dot_sg(int j) const; 00878 SGDerivative get_DgDx_dotdot_sg(int j) const; 00880 DerivativeProperties get_DgDx_dot_sg_properties(int j) const; 00881 DerivativeProperties get_DgDx_dotdot_sg_properties(int j) const; 00883 void set_DgDx_dot_mp(int j, const MPDerivative &DgDx_dot_j); 00884 void set_DgDx_dotdot_mp(int j, const MPDerivative &DgDx_dotdot_j); 00886 MPDerivative get_DgDx_dot_mp(int j) const; 00887 MPDerivative get_DgDx_dotdot_mp(int j) const; 00889 DerivativeProperties get_DgDx_dot_mp_properties(int j) const; 00890 DerivativeProperties get_DgDx_dotdot_mp_properties(int j) const; 00892 void set_DgDx(int j, const Derivative &DgDx_j); 00894 Derivative get_DgDx(int j) const; 00896 DerivativeProperties get_DgDx_properties(int j) const; 00898 void set_DgDx_sg(int j, const SGDerivative &DgDx_j); 00900 SGDerivative get_DgDx_sg(int j) const; 00902 DerivativeProperties get_DgDx_sg_properties(int j) const; 00904 void set_DgDx_mp(int j, const MPDerivative &DgDx_j); 00906 MPDerivative get_DgDx_mp(int j) const; 00908 DerivativeProperties get_DgDx_mp_properties(int j) const; 00910 void set_DgDp( int j, int l, const Derivative &DgDp_j_l ); 00912 Derivative get_DgDp(int j, int l) const; 00914 DerivativeProperties get_DgDp_properties(int j, int l) const; 00916 void set_DgDp_sg( int j, int l, const SGDerivative &DgDp_sg_j_l ); 00918 SGDerivative get_DgDp_sg(int j, int l) const; 00920 DerivativeProperties get_DgDp_sg_properties(int j, int l) const; 00922 void set_DgDp_mp( int j, int l, const MPDerivative &DgDp_mp_j_l ); 00924 MPDerivative get_DgDp_mp(int j, int l) const; 00926 DerivativeProperties get_DgDp_mp_properties(int j, int l) const; 00927 00929 void set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly ); 00931 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > get_f_poly() const; 00932 00933 00935 bool funcOrDerivesAreSet(EOutArgsMembers arg) const; 00936 00942 void setFailed() const; 00948 bool isFailed() const; 00949 00950 protected: 00952 void _setModelEvalDescription( const std::string &modelEvalDescription ); 00954 void _set_Np_Ng(int Np, int Ng); 00956 void _setSupports( EOutArgsMembers arg, bool supports ); 00958 void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& ); 00960 void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& ); 00961 void _setSupports( EOutArgsDgDx_dotdot arg, int j, const DerivativeSupport& ); 00963 void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& ); 00965 void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& ); 00967 void _setSupports( EOutArgs_g_sg arg, int j, bool supports ); 00969 void _setSupports( EOutArgsDfDp_sg arg, int l, const DerivativeSupport& ); 00971 void _setSupports( EOutArgsDgDx_dot_sg arg, int j, const DerivativeSupport& ); 00972 void _setSupports( EOutArgsDgDx_dotdot_sg arg, int j, const DerivativeSupport& ); 00974 void _setSupports( EOutArgsDgDx_sg arg, int j, const DerivativeSupport& ); 00976 void _setSupports( EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& ); 00977 00979 void _setSupports( EOutArgs_g_mp arg, int j, bool supports ); 00981 void _setSupports( EOutArgsDfDp_mp arg, int l, const DerivativeSupport& ); 00983 void _setSupports( EOutArgsDgDx_dot_mp arg, int j, const DerivativeSupport& ); 00984 void _setSupports( EOutArgsDgDx_dotdot_mp arg, int j, const DerivativeSupport& ); 00986 void _setSupports( EOutArgsDgDx_mp arg, int j, const DerivativeSupport& ); 00988 void _setSupports( EOutArgsDgDp_mp arg, int j, int l, const DerivativeSupport& ); 00990 void _set_W_properties( const DerivativeProperties &W_properties ); 00991 void _set_WPrec_properties( const DerivativeProperties &WPrec_properties ); 00993 void _set_DfDp_properties( int l, const DerivativeProperties &properties ); 00995 void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties ); 00996 void _set_DgDx_dotdot_properties( int j, const DerivativeProperties &properties ); 00998 void _set_DgDx_properties( int j, const DerivativeProperties &properties ); 01000 void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties ); 01002 void _set_DfDp_sg_properties( int l, const DerivativeProperties &properties ); 01004 void _set_DgDx_dot_sg_properties( int j, const DerivativeProperties &properties ); 01005 void _set_DgDx_dotdot_sg_properties( int j, const DerivativeProperties &properties ); 01007 void _set_DgDx_sg_properties( int j, const DerivativeProperties &properties ); 01009 void _set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties ); 01010 01012 void _set_DfDp_mp_properties( int l, const DerivativeProperties &properties ); 01014 void _set_DgDx_dot_mp_properties( int j, const DerivativeProperties &properties ); 01015 void _set_DgDx_dotdot_mp_properties( int j, const DerivativeProperties &properties ); 01017 void _set_DgDx_mp_properties( int j, const DerivativeProperties &properties ); 01019 void _set_DgDp_mp_properties( int j, int l, const DerivativeProperties &properties ); 01020 private: 01021 // types 01022 typedef Teuchos::Array<Evaluation<Epetra_Vector> > g_t; 01023 typedef Teuchos::Array<sg_vector_t > g_sg_t; 01024 typedef Teuchos::Array<mp_vector_t > g_mp_t; 01025 typedef Teuchos::Array<Derivative> deriv_t; 01026 typedef Teuchos::Array<SGDerivative> sg_deriv_t; 01027 typedef Teuchos::Array<MPDerivative> mp_deriv_t; 01028 typedef Teuchos::Array<DerivativeProperties> deriv_properties_t; 01029 typedef Teuchos::Array<DerivativeSupport> supports_t; 01030 typedef Teuchos::Array<bool> supports_g_sg_t; 01031 // data 01032 std::string modelEvalDescription_; 01033 mutable bool isFailed_; 01034 bool supports_[NUM_E_OUT_ARGS_MEMBERS]; 01035 supports_t supports_DfDp_; // Np 01036 supports_t supports_DgDx_dot_; // Ng 01037 supports_t supports_DgDx_dotdot_; // Ng 01038 supports_t supports_DgDx_; // Ng 01039 supports_t supports_DgDp_; // Ng x Np 01040 supports_g_sg_t supports_g_sg_; // Ng 01041 supports_t supports_DfDp_sg_; // Np 01042 supports_t supports_DgDx_dot_sg_; // Ng 01043 supports_t supports_DgDx_dotdot_sg_; // Ng 01044 supports_t supports_DgDx_sg_; // Ng 01045 supports_t supports_DgDp_sg_; // Ng x Np 01046 supports_g_sg_t supports_g_mp_; // Ng 01047 supports_t supports_DfDp_mp_; // Np_mp 01048 supports_t supports_DgDx_dot_mp_; // Ng_mp 01049 supports_t supports_DgDx_dotdot_mp_; // Ng_mp 01050 supports_t supports_DgDx_mp_; // Ng_mp 01051 supports_t supports_DgDp_mp_; // Ng_mp x Np_mp 01052 Evaluation<Epetra_Vector> f_; 01053 g_t g_; 01054 g_sg_t g_sg_; 01055 g_mp_t g_mp_; 01056 Teuchos::RefCountPtr<Epetra_Operator> W_; 01057 Teuchos::RefCountPtr<Epetra_Operator> WPrec_; 01058 DerivativeProperties W_properties_; 01059 DerivativeProperties WPrec_properties_; 01060 deriv_t DfDp_; // Np 01061 deriv_properties_t DfDp_properties_; // Np 01062 deriv_t DgDx_dot_; // Ng 01063 deriv_t DgDx_dotdot_; // Ng 01064 deriv_t DgDx_; // Ng 01065 deriv_properties_t DgDx_dot_properties_; // Ng 01066 deriv_properties_t DgDx_dotdot_properties_; // Ng 01067 deriv_properties_t DgDx_properties_; // Ng 01068 deriv_t DgDp_; // Ng x Np 01069 deriv_properties_t DgDp_properties_; // Ng x Np 01070 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > f_poly_; 01071 sg_vector_t f_sg_; 01072 sg_operator_t W_sg_; 01073 sg_deriv_t DfDp_sg_; // Np 01074 deriv_properties_t DfDp_sg_properties_; // Np 01075 sg_deriv_t DgDx_dot_sg_; // Ng 01076 sg_deriv_t DgDx_dotdot_sg_; // Ng 01077 sg_deriv_t DgDx_sg_; // Ng 01078 deriv_properties_t DgDx_dot_sg_properties_; // Ng 01079 deriv_properties_t DgDx_dotdot_sg_properties_; // Ng 01080 deriv_properties_t DgDx_sg_properties_; // Ng 01081 sg_deriv_t DgDp_sg_; // Ng x Np 01082 deriv_properties_t DgDp_sg_properties_; // Ng x Np 01083 mp_vector_t f_mp_; 01084 mp_operator_t W_mp_; 01085 mp_deriv_t DfDp_mp_; // Np 01086 deriv_properties_t DfDp_mp_properties_; // Np 01087 mp_deriv_t DgDx_dot_mp_; // Ng 01088 mp_deriv_t DgDx_dotdot_mp_; // Ng 01089 mp_deriv_t DgDx_mp_; // Ng 01090 deriv_properties_t DgDx_dot_mp_properties_; // Ng 01091 deriv_properties_t DgDx_dotdot_mp_properties_; // Ng 01092 deriv_properties_t DgDx_mp_properties_; // Ng 01093 mp_deriv_t DgDp_mp_; // Ng x Np 01094 deriv_properties_t DgDp_mp_properties_; // Ng x Np 01095 // functions 01096 void assert_supports(EOutArgsMembers arg) const; 01097 void assert_supports(EOutArgsDfDp arg, int l) const; 01098 void assert_supports(EOutArgsDgDx_dot arg, int j) const; 01099 void assert_supports(EOutArgsDgDx_dotdot arg, int j) const; 01100 void assert_supports(EOutArgsDgDx arg, int j) const; 01101 void assert_supports(EOutArgsDgDp arg, int j, int l) const; 01102 void assert_supports(EOutArgs_g_sg arg, int j) const; 01103 void assert_supports(EOutArgsDfDp_sg arg, int l) const; 01104 void assert_supports(EOutArgsDgDx_dot_sg arg, int j) const; 01105 void assert_supports(EOutArgsDgDx_dotdot_sg arg, int j) const; 01106 void assert_supports(EOutArgsDgDx_sg arg, int j) const; 01107 void assert_supports(EOutArgsDgDp_sg arg, int j, int l) const; 01108 void assert_supports(EOutArgs_g_mp arg, int j) const; 01109 void assert_supports(EOutArgsDfDp_mp arg, int l) const; 01110 void assert_supports(EOutArgsDgDx_dot_mp arg, int j) const; 01111 void assert_supports(EOutArgsDgDx_dotdot_mp arg, int j) const; 01112 void assert_supports(EOutArgsDgDx_mp arg, int j) const; 01113 void assert_supports(EOutArgsDgDp_mp arg, int j, int l) const; 01114 void assert_l(int l) const; 01115 void assert_j(int j) const; 01116 }; 01117 01119 01122 01124 virtual ~ModelEvaluator(); 01125 01127 01130 01132 virtual Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const = 0; 01133 01135 virtual Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const = 0; 01136 01138 virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const; 01139 01154 virtual Teuchos::RefCountPtr<const Teuchos::Array<std::string> > get_p_names(int l) const; 01155 01157 virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const; 01158 01160 01163 01165 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const; 01166 01168 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot_init() const; 01169 01171 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dotdot_init() const; 01172 01174 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const; 01175 01177 virtual double get_t_init() const; 01178 01180 01183 01188 virtual double getInfBound() const; 01189 01191 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds() const; 01192 01194 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds() const; 01195 01197 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(int l) const; 01198 01200 virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(int l) const; 01201 01203 virtual double get_t_lower_bound() const; 01204 01206 virtual double get_t_upper_bound() const; 01207 01209 01212 01219 virtual Teuchos::RefCountPtr<Epetra_Operator> create_W() const; 01220 virtual Teuchos::RefCountPtr<EpetraExt::ModelEvaluator::Preconditioner> create_WPrec() const; 01221 01223 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(int l) const; 01224 01226 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dot_op(int j) const; 01227 01229 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dotdot_op(int j) const; 01230 01232 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_op(int j) const; 01233 01235 virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_op( int j, int l ) const; 01236 01238 01241 01243 virtual InArgs createInArgs() const = 0; 01244 01246 virtual OutArgs createOutArgs() const = 0; 01247 01249 virtual void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const = 0; 01250 01251 #ifdef HAVE_PYTRILINOS 01252 01253 friend InArgs convertInArgsFromPython(PyObject * source); 01254 01256 friend OutArgs convertOutArgsFromPython(PyObject * source); 01257 #endif 01258 01259 01260 protected: 01261 01264 01266 class InArgsSetup : public InArgs { 01267 public: 01269 void setModelEvalDescription( const std::string &modelEvalDescription ); 01271 void set_Np(int Np); 01273 void setSupports( EInArgsMembers arg, bool supports = true ); 01275 void setSupports( EInArgs_p_sg arg, int l, bool supports ); 01277 void setSupports( EInArgs_p_mp arg, int l, bool supports ); 01278 }; 01279 01281 class OutArgsSetup : public OutArgs { 01282 public: 01284 void setModelEvalDescription( const std::string &modelEvalDescription ); 01286 void set_Np_Ng(int Np, int Ng); 01288 void setSupports( EOutArgsMembers arg, bool supports = true ); 01290 void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& ); 01292 void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& ); 01293 void setSupports(EOutArgsDgDx_dotdot arg, int j, const DerivativeSupport& ); 01295 void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& ); 01297 void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& ); 01299 void setSupports( EOutArgs_g_sg arg, int j, bool supports ); 01301 void setSupports(EOutArgsDfDp_sg arg, int l, const DerivativeSupport& ); 01303 void setSupports(EOutArgsDgDx_dot_sg arg, int j, const DerivativeSupport& ); 01304 void setSupports(EOutArgsDgDx_dotdot_sg arg, int j, const DerivativeSupport& ); 01306 void setSupports(EOutArgsDgDx_sg arg, int j, const DerivativeSupport& ); 01308 void setSupports(EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& ); 01310 void setSupports( EOutArgs_g_mp arg, int j, bool supports ); 01312 void setSupports(EOutArgsDfDp_mp arg, int l, const DerivativeSupport& ); 01314 void setSupports(EOutArgsDgDx_dot_mp arg, int j, const DerivativeSupport& ); 01315 void setSupports(EOutArgsDgDx_dotdot_mp arg, int j, const DerivativeSupport& ); 01317 void setSupports(EOutArgsDgDx_mp arg, int j, const DerivativeSupport& ); 01319 void setSupports(EOutArgsDgDp_mp arg, int j, int l, const DerivativeSupport& ); 01321 void set_W_properties( const DerivativeProperties &properties ); 01322 void set_WPrec_properties( const DerivativeProperties &properties ); 01324 void set_DfDp_properties( int l, const DerivativeProperties &properties ); 01326 void set_DgDx_dot_properties( int j, const DerivativeProperties &properties ); 01327 void set_DgDx_dotdot_properties( int j, const DerivativeProperties &properties ); 01329 void set_DgDx_properties( int j, const DerivativeProperties &properties ); 01331 void set_DgDp_properties( int j, int l, const DerivativeProperties &properties ); 01333 void set_DfDp_sg_properties( int l, const DerivativeProperties &properties ); 01335 void set_DgDx_dot_sg_properties( int j, const DerivativeProperties &properties ); 01336 void set_DgDx_dotdot_sg_properties( int j, const DerivativeProperties &properties ); 01338 void set_DgDx_sg_properties( int j, const DerivativeProperties &properties ); 01340 void set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties ); 01342 void set_DfDp_mp_properties( int l, const DerivativeProperties &properties ); 01344 void set_DgDx_dot_mp_properties( int j, const DerivativeProperties &properties ); 01345 void set_DgDx_dotdot_mp_properties( int j, const DerivativeProperties &properties ); 01347 void set_DgDx_mp_properties( int j, const DerivativeProperties &properties ); 01349 void set_DgDp_mp_properties( int j, int l, const DerivativeProperties &properties ); 01350 }; 01351 01353 01354 }; 01355 01356 // //////////////////////////// 01357 // Helper functions 01358 01360 std::string toString( ModelEvaluator::EDerivativeMultiVectorOrientation orientation ); 01361 01363 std::string toString( ModelEvaluator::EInArgsMembers inArg ); 01364 01366 std::string toString( ModelEvaluator::EOutArgsMembers outArg ); 01367 01369 Teuchos::RefCountPtr<Epetra_Operator> 01370 getLinearOp( 01371 const std::string &modelEvalDescription, 01372 const ModelEvaluator::Derivative &deriv, 01373 const std::string &derivName 01374 ); 01375 01377 Teuchos::RefCountPtr<Epetra_MultiVector> 01378 getMultiVector( 01379 const std::string &modelEvalDescription, 01380 const ModelEvaluator::Derivative &deriv, 01381 const std::string &derivName, 01382 const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01383 ); 01384 01386 Teuchos::RefCountPtr<Epetra_Operator> 01387 get_DfDp_op( 01388 const int l 01389 ,const ModelEvaluator::OutArgs &outArgs 01390 ); 01391 01393 Teuchos::RefCountPtr<Epetra_MultiVector> 01394 get_DfDp_mv( 01395 const int l 01396 ,const ModelEvaluator::OutArgs &outArgs 01397 ); 01398 01400 Teuchos::RefCountPtr<Epetra_MultiVector> 01401 get_DgDx_dot_mv( 01402 const int j 01403 ,const ModelEvaluator::OutArgs &outArgs 01404 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01405 ); 01406 01408 Teuchos::RefCountPtr<Epetra_MultiVector> 01409 get_DgDx_dotdot_mv( 01410 const int j 01411 ,const ModelEvaluator::OutArgs &outArgs 01412 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01413 ); 01414 01416 Teuchos::RefCountPtr<Epetra_MultiVector> 01417 get_DgDx_mv( 01418 const int j 01419 ,const ModelEvaluator::OutArgs &outArgs 01420 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01421 ); 01422 01424 Teuchos::RefCountPtr<Epetra_MultiVector> 01425 get_DgDp_mv( 01426 const int j 01427 ,const int l 01428 ,const ModelEvaluator::OutArgs &outArgs 01429 ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation 01430 ); 01431 01432 // /////////////////////////// 01433 // Inline Functions 01434 01435 // 01436 // ModelEvaluator::InArgs 01437 // 01438 01439 inline 01440 std::string ModelEvaluator::InArgs::modelEvalDescription() const 01441 { return modelEvalDescription_; } 01442 01443 inline 01444 int ModelEvaluator::InArgs::Np() const 01445 { return p_.size(); } 01446 01447 inline 01448 void ModelEvaluator::InArgs::set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot ) 01449 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; } 01450 01451 inline 01452 void ModelEvaluator::InArgs::set_x_dotdot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dotdot ) 01453 { assert_supports(IN_ARG_x_dotdot); x_dotdot_ = x_dotdot; } 01454 01455 inline 01456 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dot() const 01457 { assert_supports(IN_ARG_x_dot); return x_dot_; } 01458 01459 inline 01460 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dotdot() const 01461 { assert_supports(IN_ARG_x_dotdot); return x_dotdot_; } 01462 01463 inline 01464 void ModelEvaluator::InArgs::set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x ) 01465 { assert_supports(IN_ARG_x); x_ = x; } 01466 01467 inline 01468 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x() const 01469 { assert_supports(IN_ARG_x); return x_; } 01470 01471 inline 01472 void ModelEvaluator::InArgs::set_x_dot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly ) 01473 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; } 01474 01475 inline 01476 void ModelEvaluator::InArgs::set_x_dotdot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dotdot_poly ) 01477 { assert_supports(IN_ARG_x_dotdot_poly); x_dotdot_poly_ = x_dotdot_poly; } 01478 01479 inline 01480 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > 01481 ModelEvaluator::InArgs::get_x_dot_poly() const 01482 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; } 01483 01484 inline 01485 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > 01486 ModelEvaluator::InArgs::get_x_dotdot_poly() const 01487 { assert_supports(IN_ARG_x_dotdot_poly); return x_dotdot_poly_; } 01488 01489 inline 01490 void ModelEvaluator::InArgs::set_x_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly ) 01491 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; } 01492 01493 inline 01494 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > 01495 ModelEvaluator::InArgs::get_x_poly() const 01496 { assert_supports(IN_ARG_x_poly); return x_poly_; } 01497 01498 inline 01499 void ModelEvaluator::InArgs::set_x_dot_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_dot_sg ) 01500 { assert_supports(IN_ARG_x_dot_sg); x_dot_sg_ = x_dot_sg; } 01501 01502 inline 01503 void ModelEvaluator::InArgs::set_x_dotdot_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_dotdot_sg ) 01504 { assert_supports(IN_ARG_x_dotdot_sg); x_dotdot_sg_ = x_dotdot_sg; } 01505 01506 inline 01507 ModelEvaluator::InArgs::sg_const_vector_t 01508 ModelEvaluator::InArgs::get_x_dot_sg() const 01509 { assert_supports(IN_ARG_x_dot_sg); return x_dot_sg_; } 01510 01511 inline 01512 ModelEvaluator::InArgs::sg_const_vector_t 01513 ModelEvaluator::InArgs::get_x_dotdot_sg() const 01514 { assert_supports(IN_ARG_x_dotdot_sg); return x_dotdot_sg_; } 01515 01516 inline 01517 void ModelEvaluator::InArgs::set_x_dot_mp( const ModelEvaluator::mp_const_vector_t &x_dot_mp ) 01518 { assert_supports(IN_ARG_x_dot_mp); x_dot_mp_ = x_dot_mp; } 01519 01520 inline 01521 void ModelEvaluator::InArgs::set_x_dotdot_mp( const ModelEvaluator::mp_const_vector_t &x_dotdot_mp ) 01522 { assert_supports(IN_ARG_x_dotdot_mp); x_dotdot_mp_ = x_dotdot_mp; } 01523 01524 inline 01525 ModelEvaluator::mp_const_vector_t 01526 ModelEvaluator::InArgs::get_x_dot_mp() const 01527 { assert_supports(IN_ARG_x_dot_mp); return x_dot_mp_; } 01528 01529 inline 01530 ModelEvaluator::mp_const_vector_t 01531 ModelEvaluator::InArgs::get_x_dotdot_mp() const 01532 { assert_supports(IN_ARG_x_dotdot_mp); return x_dotdot_mp_; } 01533 01534 inline 01535 void ModelEvaluator::InArgs::set_x_sg( const ModelEvaluator::InArgs::sg_const_vector_t &x_sg ) 01536 { assert_supports(IN_ARG_x_sg); x_sg_ = x_sg; } 01537 01538 inline 01539 ModelEvaluator::InArgs::sg_const_vector_t 01540 ModelEvaluator::InArgs::get_x_sg() const 01541 { assert_supports(IN_ARG_x_sg); return x_sg_; } 01542 01543 inline 01544 void ModelEvaluator::InArgs::set_x_mp( const ModelEvaluator::mp_const_vector_t &x_mp ) 01545 { assert_supports(IN_ARG_x_mp); x_mp_ = x_mp; } 01546 01547 inline 01548 ModelEvaluator::mp_const_vector_t 01549 ModelEvaluator::InArgs::get_x_mp() const 01550 { assert_supports(IN_ARG_x_mp); return x_mp_; } 01551 01552 inline 01553 void ModelEvaluator::InArgs::set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l ) 01554 { assert_l(l); p_[l] = p_l; } 01555 01556 inline 01557 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_p(int l) const 01558 { assert_l(l); return p_[l]; } 01559 01560 inline 01561 void ModelEvaluator::InArgs::set_p_sg( int l, 01562 const ModelEvaluator::InArgs::sg_const_vector_t &p_sg_l ) 01563 { assert_supports(IN_ARG_p_sg, l); p_sg_[l] = p_sg_l; } 01564 01565 inline 01566 ModelEvaluator::InArgs::sg_const_vector_t 01567 ModelEvaluator::InArgs::get_p_sg(int l) const 01568 { assert_supports(IN_ARG_p_sg, l); return p_sg_[l]; } 01569 01570 inline 01571 void ModelEvaluator::InArgs::set_p_mp( int l, 01572 const ModelEvaluator::mp_const_vector_t &p_mp_l ) 01573 { assert_supports(IN_ARG_p_mp, l); p_mp_[l] = p_mp_l; } 01574 01575 inline 01576 ModelEvaluator::mp_const_vector_t 01577 ModelEvaluator::InArgs::get_p_mp(int l) const 01578 { assert_supports(IN_ARG_p_mp, l); return p_mp_[l]; } 01579 01580 inline 01581 void ModelEvaluator::InArgs::set_t( double t ) 01582 { assert_supports(IN_ARG_t); t_ = t; } 01583 01584 inline 01585 double ModelEvaluator::InArgs::get_t() const 01586 { assert_supports(IN_ARG_t); return t_; } 01587 01588 inline 01589 void ModelEvaluator::InArgs::set_alpha( double alpha ) 01590 { assert_supports(IN_ARG_alpha); alpha_ = alpha; } 01591 01592 inline 01593 double ModelEvaluator::InArgs::get_alpha() const 01594 { assert_supports(IN_ARG_alpha); return alpha_; } 01595 01596 inline 01597 void ModelEvaluator::InArgs::set_omega( double omega ) 01598 { assert_supports(IN_ARG_omega); omega_ = omega; } 01599 01600 inline 01601 double ModelEvaluator::InArgs::get_omega() const 01602 { assert_supports(IN_ARG_omega); return omega_; } 01603 01604 inline 01605 void ModelEvaluator::InArgs::set_beta( double beta ) 01606 { assert_supports(IN_ARG_beta); beta_ = beta; } 01607 01608 inline 01609 double ModelEvaluator::InArgs::get_beta() const 01610 { assert_supports(IN_ARG_beta); return beta_; } 01611 01612 inline 01613 void ModelEvaluator::InArgs::set_sg_basis( const Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> >& basis ) 01614 { assert_supports(IN_ARG_sg_basis); sg_basis_ = basis; } 01615 01616 inline 01617 Teuchos::RCP<const Stokhos::OrthogPolyBasis<int,double> > 01618 ModelEvaluator::InArgs::get_sg_basis() const 01619 { assert_supports(IN_ARG_sg_basis); return sg_basis_; } 01620 01621 inline 01622 void ModelEvaluator::InArgs::set_sg_quadrature( const Teuchos::RCP<const Stokhos::Quadrature<int,double> >& quad ) 01623 { assert_supports(IN_ARG_sg_quadrature); sg_quad_ = quad; } 01624 01625 inline 01626 Teuchos::RCP<const Stokhos::Quadrature<int,double> > 01627 ModelEvaluator::InArgs::get_sg_quadrature() const 01628 { assert_supports(IN_ARG_sg_quadrature); return sg_quad_; } 01629 01630 inline 01631 void ModelEvaluator::InArgs::set_sg_expansion( const Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > >& exp ) 01632 { assert_supports(IN_ARG_sg_expansion); sg_exp_ = exp; } 01633 01634 inline 01635 Teuchos::RCP<Stokhos::OrthogPolyExpansion<int,double,Stokhos::StandardStorage<int,double> > > 01636 ModelEvaluator::InArgs::get_sg_expansion() const 01637 { assert_supports(IN_ARG_sg_expansion); return sg_exp_; } 01638 01639 inline 01640 void ModelEvaluator::InArgs::_setModelEvalDescription( const std::string &new_modelEvalDescription ) 01641 { 01642 modelEvalDescription_ = new_modelEvalDescription; 01643 } 01644 01645 inline 01646 void ModelEvaluator::InArgs::_set_Np(int new_Np) 01647 { 01648 p_.resize(new_Np); 01649 p_sg_.resize(new_Np); 01650 p_mp_.resize(new_Np); 01651 supports_p_sg_.resize(new_Np); 01652 supports_p_mp_.resize(new_Np); 01653 } 01654 01655 // 01656 // ModelEvaluator::OutArgs 01657 // 01658 01659 inline 01660 std::string ModelEvaluator::OutArgs::modelEvalDescription() const 01661 { return modelEvalDescription_; } 01662 01663 inline 01664 int ModelEvaluator::OutArgs::Np() const 01665 { 01666 return DfDp_.size(); 01667 } 01668 01669 inline 01670 int ModelEvaluator::OutArgs::Ng() const 01671 { 01672 return g_.size(); 01673 } 01674 01675 inline 01676 void ModelEvaluator::OutArgs::set_f( const Evaluation<Epetra_Vector> &f ) { f_ = f; } 01677 01678 inline 01679 ModelEvaluator::Evaluation<Epetra_Vector> 01680 ModelEvaluator::OutArgs::get_f() const { return f_; } 01681 01682 inline 01683 void ModelEvaluator::OutArgs::set_g( int j, const Evaluation<Epetra_Vector> &g_j ) 01684 { 01685 assert_j(j); 01686 g_[j] = g_j; 01687 } 01688 01689 inline 01690 ModelEvaluator::Evaluation<Epetra_Vector> 01691 ModelEvaluator::OutArgs::get_g(int j) const 01692 { 01693 assert_j(j); 01694 return g_[j]; 01695 } 01696 01697 inline 01698 void ModelEvaluator::OutArgs::set_g_sg( int j, const sg_vector_t &g_sg_j ) 01699 { 01700 assert_supports(OUT_ARG_g_sg, j); 01701 g_sg_[j] = g_sg_j; 01702 } 01703 01704 inline 01705 ModelEvaluator::OutArgs::sg_vector_t 01706 ModelEvaluator::OutArgs::get_g_sg(int j) const 01707 { 01708 assert_supports(OUT_ARG_g_sg, j); 01709 return g_sg_[j]; 01710 } 01711 01712 inline 01713 void ModelEvaluator::OutArgs::set_g_mp( int j, const mp_vector_t &g_mp_j ) 01714 { 01715 assert_supports(OUT_ARG_g_mp, j); 01716 g_mp_[j] = g_mp_j; 01717 } 01718 01719 inline 01720 ModelEvaluator::mp_vector_t 01721 ModelEvaluator::OutArgs::get_g_mp(int j) const 01722 { 01723 assert_supports(OUT_ARG_g_mp, j); 01724 return g_mp_[j]; 01725 } 01726 01727 inline 01728 void ModelEvaluator::OutArgs::set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ) { W_ = W; } 01729 inline 01730 void ModelEvaluator::OutArgs::set_WPrec( const Teuchos::RefCountPtr<Epetra_Operator> &WPrec ) { WPrec_ = WPrec; } 01731 01732 inline 01733 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_W() const { return W_; } 01734 inline 01735 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_WPrec() const { return WPrec_; } 01736 01737 inline 01738 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_W_properties() const 01739 { return W_properties_; } 01740 inline 01741 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_WPrec_properties() const 01742 { return WPrec_properties_; } 01743 01744 inline 01745 void ModelEvaluator::OutArgs::set_DfDp( int l, const Derivative &DfDp_l ) 01746 { 01747 assert_supports(OUT_ARG_DfDp,l); 01748 DfDp_[l] = DfDp_l; 01749 } 01750 01751 inline 01752 ModelEvaluator::Derivative 01753 ModelEvaluator::OutArgs::get_DfDp(int l) const 01754 { 01755 assert_supports(OUT_ARG_DfDp,l); 01756 return DfDp_[l]; 01757 } 01758 01759 inline 01760 ModelEvaluator::DerivativeProperties 01761 ModelEvaluator::OutArgs::get_DfDp_properties(int l) const 01762 { 01763 assert_supports(OUT_ARG_DfDp,l); 01764 return DfDp_properties_[l]; 01765 } 01766 01767 inline 01768 void ModelEvaluator::OutArgs::set_DfDp_sg( int l, const SGDerivative &DfDp_sg_l ) 01769 { 01770 assert_supports(OUT_ARG_DfDp_sg,l); 01771 DfDp_sg_[l] = DfDp_sg_l; 01772 } 01773 01774 inline 01775 ModelEvaluator::SGDerivative 01776 ModelEvaluator::OutArgs::get_DfDp_sg(int l) const 01777 { 01778 assert_supports(OUT_ARG_DfDp_sg,l); 01779 return DfDp_sg_[l]; 01780 } 01781 01782 inline 01783 ModelEvaluator::DerivativeProperties 01784 ModelEvaluator::OutArgs::get_DfDp_sg_properties(int l) const 01785 { 01786 assert_supports(OUT_ARG_DfDp_sg,l); 01787 return DfDp_sg_properties_[l]; 01788 } 01789 01790 inline 01791 void ModelEvaluator::OutArgs::set_DfDp_mp( int l, const MPDerivative &DfDp_mp_l ) 01792 { 01793 assert_supports(OUT_ARG_DfDp_mp,l); 01794 DfDp_mp_[l] = DfDp_mp_l; 01795 } 01796 01797 inline 01798 ModelEvaluator::MPDerivative 01799 ModelEvaluator::OutArgs::get_DfDp_mp(int l) const 01800 { 01801 assert_supports(OUT_ARG_DfDp_mp,l); 01802 return DfDp_mp_[l]; 01803 } 01804 01805 inline 01806 ModelEvaluator::DerivativeProperties 01807 ModelEvaluator::OutArgs::get_DfDp_mp_properties(int l) const 01808 { 01809 assert_supports(OUT_ARG_DfDp_mp,l); 01810 return DfDp_mp_properties_[l]; 01811 } 01812 01813 inline 01814 void ModelEvaluator::OutArgs::set_DgDx_dot( int j, const Derivative &DgDx_dot_j ) 01815 { 01816 assert_supports(OUT_ARG_DgDx_dot,j); 01817 DgDx_dot_[j] = DgDx_dot_j; 01818 } 01819 01820 inline 01821 ModelEvaluator::Derivative 01822 ModelEvaluator::OutArgs::get_DgDx_dot(int j) const 01823 { 01824 assert_supports(OUT_ARG_DgDx_dot,j); 01825 return DgDx_dot_[j]; 01826 } 01827 01828 inline 01829 ModelEvaluator::DerivativeProperties 01830 ModelEvaluator::OutArgs::get_DgDx_dot_properties(int j) const 01831 { 01832 assert_supports(OUT_ARG_DgDx_dot,j); 01833 return DgDx_dot_properties_[j]; 01834 } 01835 01836 inline 01837 void ModelEvaluator::OutArgs::set_DgDx_dot_sg( int j, const SGDerivative &DgDx_dot_sg_j ) 01838 { 01839 assert_supports(OUT_ARG_DgDx_dot_sg,j); 01840 DgDx_dot_sg_[j] = DgDx_dot_sg_j; 01841 } 01842 01843 inline 01844 ModelEvaluator::SGDerivative 01845 ModelEvaluator::OutArgs::get_DgDx_dot_sg(int j) const 01846 { 01847 assert_supports(OUT_ARG_DgDx_dot_sg,j); 01848 return DgDx_dot_sg_[j]; 01849 } 01850 01851 inline 01852 ModelEvaluator::DerivativeProperties 01853 ModelEvaluator::OutArgs::get_DgDx_dot_sg_properties(int j) const 01854 { 01855 assert_supports(OUT_ARG_DgDx_dot_sg,j); 01856 return DgDx_dot_sg_properties_[j]; 01857 } 01858 01859 inline 01860 void ModelEvaluator::OutArgs::set_DgDx_dot_mp( int j, const MPDerivative &DgDx_dot_mp_j ) 01861 { 01862 assert_supports(OUT_ARG_DgDx_dot_mp,j); 01863 DgDx_dot_mp_[j] = DgDx_dot_mp_j; 01864 } 01865 01866 inline 01867 ModelEvaluator::MPDerivative 01868 ModelEvaluator::OutArgs::get_DgDx_dot_mp(int j) const 01869 { 01870 assert_supports(OUT_ARG_DgDx_dot_mp,j); 01871 return DgDx_dot_mp_[j]; 01872 } 01873 01874 inline 01875 ModelEvaluator::DerivativeProperties 01876 ModelEvaluator::OutArgs::get_DgDx_dot_mp_properties(int j) const 01877 { 01878 assert_supports(OUT_ARG_DgDx_dot_mp,j); 01879 return DgDx_dot_mp_properties_[j]; 01880 } 01881 01882 inline 01883 void ModelEvaluator::OutArgs::set_DgDx_dotdot( int j, const Derivative &DgDx_dotdot_j ) 01884 { 01885 assert_supports(OUT_ARG_DgDx_dotdot,j); 01886 DgDx_dotdot_[j] = DgDx_dotdot_j; 01887 } 01888 01889 inline 01890 ModelEvaluator::Derivative 01891 ModelEvaluator::OutArgs::get_DgDx_dotdot(int j) const 01892 { 01893 assert_supports(OUT_ARG_DgDx_dotdot,j); 01894 return DgDx_dotdot_[j]; 01895 } 01896 01897 inline 01898 ModelEvaluator::DerivativeProperties 01899 ModelEvaluator::OutArgs::get_DgDx_dotdot_properties(int j) const 01900 { 01901 assert_supports(OUT_ARG_DgDx_dotdot,j); 01902 return DgDx_dotdot_properties_[j]; 01903 } 01904 01905 inline 01906 void ModelEvaluator::OutArgs::set_DgDx_dotdot_sg( int j, const SGDerivative &DgDx_dotdot_sg_j ) 01907 { 01908 assert_supports(OUT_ARG_DgDx_dotdot_sg,j); 01909 DgDx_dotdot_sg_[j] = DgDx_dotdot_sg_j; 01910 } 01911 01912 inline 01913 ModelEvaluator::SGDerivative 01914 ModelEvaluator::OutArgs::get_DgDx_dotdot_sg(int j) const 01915 { 01916 assert_supports(OUT_ARG_DgDx_dotdot_sg,j); 01917 return DgDx_dotdot_sg_[j]; 01918 } 01919 01920 inline 01921 ModelEvaluator::DerivativeProperties 01922 ModelEvaluator::OutArgs::get_DgDx_dotdot_sg_properties(int j) const 01923 { 01924 assert_supports(OUT_ARG_DgDx_dotdot_sg,j); 01925 return DgDx_dotdot_sg_properties_[j]; 01926 } 01927 01928 inline 01929 void ModelEvaluator::OutArgs::set_DgDx_dotdot_mp( int j, const MPDerivative &DgDx_dotdot_mp_j ) 01930 { 01931 assert_supports(OUT_ARG_DgDx_dotdot_mp,j); 01932 DgDx_dotdot_mp_[j] = DgDx_dotdot_mp_j; 01933 } 01934 01935 inline 01936 ModelEvaluator::MPDerivative 01937 ModelEvaluator::OutArgs::get_DgDx_dotdot_mp(int j) const 01938 { 01939 assert_supports(OUT_ARG_DgDx_dotdot_mp,j); 01940 return DgDx_dotdot_mp_[j]; 01941 } 01942 01943 inline 01944 ModelEvaluator::DerivativeProperties 01945 ModelEvaluator::OutArgs::get_DgDx_dotdot_mp_properties(int j) const 01946 { 01947 assert_supports(OUT_ARG_DgDx_dotdot_mp,j); 01948 return DgDx_dotdot_mp_properties_[j]; 01949 } 01950 01951 inline 01952 void ModelEvaluator::OutArgs::set_DgDx( int j, const Derivative &DgDx_j ) 01953 { 01954 assert_supports(OUT_ARG_DgDx,j); 01955 DgDx_[j] = DgDx_j; 01956 } 01957 01958 inline 01959 ModelEvaluator::Derivative 01960 ModelEvaluator::OutArgs::get_DgDx(int j) const 01961 { 01962 assert_supports(OUT_ARG_DgDx,j); 01963 return DgDx_[j]; 01964 } 01965 01966 inline 01967 ModelEvaluator::DerivativeProperties 01968 ModelEvaluator::OutArgs::get_DgDx_properties(int j) const 01969 { 01970 assert_supports(OUT_ARG_DgDx,j); 01971 return DgDx_properties_[j]; 01972 } 01973 01974 inline 01975 void ModelEvaluator::OutArgs::set_DgDx_sg( int j, const SGDerivative &DgDx_sg_j ) 01976 { 01977 assert_supports(OUT_ARG_DgDx_sg,j); 01978 DgDx_sg_[j] = DgDx_sg_j; 01979 } 01980 01981 inline 01982 ModelEvaluator::SGDerivative 01983 ModelEvaluator::OutArgs::get_DgDx_sg(int j) const 01984 { 01985 assert_supports(OUT_ARG_DgDx_sg,j); 01986 return DgDx_sg_[j]; 01987 } 01988 01989 inline 01990 ModelEvaluator::DerivativeProperties 01991 ModelEvaluator::OutArgs::get_DgDx_sg_properties(int j) const 01992 { 01993 assert_supports(OUT_ARG_DgDx_sg,j); 01994 return DgDx_sg_properties_[j]; 01995 } 01996 01997 inline 01998 void ModelEvaluator::OutArgs::set_DgDx_mp( int j, const MPDerivative &DgDx_mp_j ) 01999 { 02000 assert_supports(OUT_ARG_DgDx_mp,j); 02001 DgDx_mp_[j] = DgDx_mp_j; 02002 } 02003 02004 inline 02005 ModelEvaluator::MPDerivative 02006 ModelEvaluator::OutArgs::get_DgDx_mp(int j) const 02007 { 02008 assert_supports(OUT_ARG_DgDx_mp,j); 02009 return DgDx_mp_[j]; 02010 } 02011 02012 inline 02013 ModelEvaluator::DerivativeProperties 02014 ModelEvaluator::OutArgs::get_DgDx_mp_properties(int j) const 02015 { 02016 assert_supports(OUT_ARG_DgDx_mp,j); 02017 return DgDx_mp_properties_[j]; 02018 } 02019 02020 inline 02021 void ModelEvaluator::OutArgs::set_DgDp( int j, int l, const Derivative &DgDp_j_l ) 02022 { 02023 assert_supports(OUT_ARG_DgDp,j,l); 02024 DgDp_[ j*Np() + l ] = DgDp_j_l; 02025 } 02026 02027 inline 02028 ModelEvaluator::Derivative 02029 ModelEvaluator::OutArgs::get_DgDp(int j, int l) const 02030 { 02031 assert_supports(OUT_ARG_DgDp,j,l); 02032 return DgDp_[ j*Np() + l ]; 02033 } 02034 02035 inline 02036 ModelEvaluator::DerivativeProperties 02037 ModelEvaluator::OutArgs::get_DgDp_properties(int j, int l) const 02038 { 02039 assert_supports(OUT_ARG_DgDp,j,l); 02040 return DgDp_properties_[ j*Np() + l ]; 02041 } 02042 02043 inline 02044 void ModelEvaluator::OutArgs::set_DgDp_sg( int j, int l, const SGDerivative &DgDp_sg_j_l ) 02045 { 02046 assert_supports(OUT_ARG_DgDp_sg,j,l); 02047 DgDp_sg_[ j*Np() + l ] = DgDp_sg_j_l; 02048 } 02049 02050 inline 02051 ModelEvaluator::SGDerivative 02052 ModelEvaluator::OutArgs::get_DgDp_sg(int j, int l) const 02053 { 02054 assert_supports(OUT_ARG_DgDp_sg,j,l); 02055 return DgDp_sg_[ j*Np() + l ]; 02056 } 02057 02058 inline 02059 ModelEvaluator::DerivativeProperties 02060 ModelEvaluator::OutArgs::get_DgDp_sg_properties(int j, int l) const 02061 { 02062 assert_supports(OUT_ARG_DgDp_sg,j,l); 02063 return DgDp_sg_properties_[ j*Np() + l ]; 02064 } 02065 02066 inline 02067 void ModelEvaluator::OutArgs::set_DgDp_mp( int j, int l, const MPDerivative &DgDp_mp_j_l ) 02068 { 02069 assert_supports(OUT_ARG_DgDp_mp,j,l); 02070 DgDp_mp_[ j*Np() + l ] = DgDp_mp_j_l; 02071 } 02072 02073 inline 02074 ModelEvaluator::MPDerivative 02075 ModelEvaluator::OutArgs::get_DgDp_mp(int j, int l) const 02076 { 02077 assert_supports(OUT_ARG_DgDp_mp,j,l); 02078 return DgDp_mp_[ j*Np() + l ]; 02079 } 02080 02081 inline 02082 ModelEvaluator::DerivativeProperties 02083 ModelEvaluator::OutArgs::get_DgDp_mp_properties(int j, int l) const 02084 { 02085 assert_supports(OUT_ARG_DgDp_mp,j,l); 02086 return DgDp_mp_properties_[ j*Np() + l ]; 02087 } 02088 02089 inline 02090 void ModelEvaluator::OutArgs::set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly ) 02091 { f_poly_ = f_poly; } 02092 02093 inline 02094 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > 02095 ModelEvaluator::OutArgs::get_f_poly() const 02096 { return f_poly_; } 02097 02098 inline 02099 void ModelEvaluator::OutArgs::set_f_sg( const ModelEvaluator::OutArgs::sg_vector_t& f_sg ) 02100 { f_sg_ = f_sg; } 02101 02102 inline 02103 ModelEvaluator::OutArgs::sg_vector_t 02104 ModelEvaluator::OutArgs::get_f_sg() const 02105 { return f_sg_; } 02106 02107 inline 02108 void ModelEvaluator::OutArgs::set_W_sg( const ModelEvaluator::OutArgs::sg_operator_t& W_sg ) { W_sg_ = W_sg; } 02109 02110 inline 02111 ModelEvaluator::OutArgs::sg_operator_t ModelEvaluator::OutArgs::get_W_sg() const { return W_sg_; } 02112 02113 inline 02114 void ModelEvaluator::OutArgs::set_f_mp( const ModelEvaluator::mp_vector_t& f_mp ) 02115 { f_mp_ = f_mp; } 02116 02117 inline 02118 ModelEvaluator::mp_vector_t 02119 ModelEvaluator::OutArgs::get_f_mp() const 02120 { return f_mp_; } 02121 02122 inline 02123 void ModelEvaluator::OutArgs::set_W_mp( const ModelEvaluator::mp_operator_t& W_mp ) { W_mp_ = W_mp; } 02124 02125 inline 02126 ModelEvaluator::mp_operator_t ModelEvaluator::OutArgs::get_W_mp() const { return W_mp_; } 02127 02128 // 02129 // ModelEvaluator::InArgsSetup 02130 // 02131 02132 inline 02133 void ModelEvaluator::InArgsSetup::setModelEvalDescription( const std::string &new_modelEvalDescription ) 02134 { 02135 this->_setModelEvalDescription(new_modelEvalDescription); 02136 } 02137 02138 inline 02139 void ModelEvaluator::InArgsSetup::set_Np(int new_Np) 02140 { this->_set_Np(new_Np); } 02141 02142 inline 02143 void ModelEvaluator::InArgsSetup::setSupports( EInArgsMembers arg, bool new_supports ) 02144 { this->_setSupports(arg,new_supports); } 02145 02146 inline 02147 void ModelEvaluator::InArgsSetup::setSupports( EInArgs_p_sg arg, int l, bool new_supports ) 02148 { this->_setSupports(arg,l,new_supports); } 02149 02150 inline 02151 void ModelEvaluator::InArgsSetup::setSupports( EInArgs_p_mp arg, int l, bool new_supports ) 02152 { this->_setSupports(arg,l,new_supports); } 02153 02154 // 02155 // ModelEvaluator::OutArgsSetup 02156 // 02157 02158 inline 02159 void ModelEvaluator::OutArgsSetup::setModelEvalDescription( const std::string &new_modelEvalDescription ) 02160 { 02161 this->_setModelEvalDescription(new_modelEvalDescription); 02162 } 02163 02164 inline 02165 void ModelEvaluator::OutArgsSetup::set_Np_Ng(int new_Np, int new_Ng) 02166 { this->_set_Np_Ng(new_Np,new_Ng); } 02167 02168 inline 02169 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsMembers arg, bool new_supports ) 02170 { this->_setSupports(arg,new_supports); } 02171 02172 inline 02173 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& new_supports ) 02174 { this->_setSupports(arg,l,new_supports); } 02175 02176 inline 02177 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& new_supports ) 02178 { this->_setSupports(arg,j,new_supports); } 02179 02180 inline 02181 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dotdot arg, int j, const DerivativeSupport& new_supports ) 02182 { this->_setSupports(arg,j,new_supports); } 02183 02184 inline 02185 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& new_supports ) 02186 { this->_setSupports(arg,j,new_supports); } 02187 02188 inline 02189 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& new_supports ) 02190 { this->_setSupports(arg,j,l,new_supports); } 02191 02192 inline 02193 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgs_g_sg arg, int j, bool new_supports ) 02194 { this->_setSupports(arg,j,new_supports); } 02195 02196 inline 02197 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp_sg arg, int l, const DerivativeSupport& new_supports ) 02198 { this->_setSupports(arg,l,new_supports); } 02199 02200 inline 02201 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot_sg arg, int j, const DerivativeSupport& new_supports ) 02202 { this->_setSupports(arg,j,new_supports); } 02203 02204 inline 02205 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dotdot_sg arg, int j, const DerivativeSupport& new_supports ) 02206 { this->_setSupports(arg,j,new_supports); } 02207 02208 inline 02209 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_sg arg, int j, const DerivativeSupport& new_supports ) 02210 { this->_setSupports(arg,j,new_supports); } 02211 02212 inline 02213 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp_sg arg, int j, int l, const DerivativeSupport& new_supports ) 02214 { this->_setSupports(arg,j,l,new_supports); } 02215 02216 inline 02217 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgs_g_mp arg, int j, bool new_supports ) 02218 { this->_setSupports(arg,j,new_supports); } 02219 02220 inline 02221 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp_mp arg, int l, const DerivativeSupport& new_supports ) 02222 { this->_setSupports(arg,l,new_supports); } 02223 02224 inline 02225 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot_mp arg, int j, const DerivativeSupport& new_supports ) 02226 { this->_setSupports(arg,j,new_supports); } 02227 02228 inline 02229 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dotdot_mp arg, int j, const DerivativeSupport& new_supports ) 02230 { this->_setSupports(arg,j,new_supports); } 02231 02232 inline 02233 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_mp arg, int j, const DerivativeSupport& new_supports ) 02234 { this->_setSupports(arg,j,new_supports); } 02235 02236 inline 02237 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp_mp arg, int j, int l, const DerivativeSupport& new_supports ) 02238 { this->_setSupports(arg,j,l,new_supports); } 02239 02240 inline 02241 void ModelEvaluator::OutArgsSetup::set_W_properties( const DerivativeProperties &properties ) 02242 { this->_set_W_properties(properties); } 02243 inline 02244 void ModelEvaluator::OutArgsSetup::set_WPrec_properties( const DerivativeProperties &properties ) 02245 { this->_set_WPrec_properties(properties); } 02246 02247 inline 02248 void ModelEvaluator::OutArgsSetup::set_DfDp_properties( int l, const DerivativeProperties &properties ) 02249 { 02250 this->_set_DfDp_properties(l,properties); 02251 } 02252 02253 inline 02254 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_properties( int j, const DerivativeProperties &properties ) 02255 { 02256 this->_set_DgDx_dot_properties(j,properties); 02257 } 02258 02259 inline 02260 void ModelEvaluator::OutArgsSetup::set_DgDx_dotdot_properties( int j, const DerivativeProperties &properties ) 02261 { 02262 this->_set_DgDx_dotdot_properties(j,properties); 02263 } 02264 02265 inline 02266 void ModelEvaluator::OutArgsSetup::set_DgDx_properties( int j, const DerivativeProperties &properties ) 02267 { 02268 this->_set_DgDx_properties(j,properties); 02269 } 02270 02271 inline 02272 void ModelEvaluator::OutArgsSetup::set_DgDp_properties( int j, int l, const DerivativeProperties &properties ) 02273 { 02274 this->_set_DgDp_properties(j,l,properties); 02275 } 02276 02277 inline 02278 void ModelEvaluator::OutArgsSetup::set_DfDp_sg_properties( int l, const DerivativeProperties &properties ) 02279 { 02280 this->_set_DfDp_sg_properties(l,properties); 02281 } 02282 02283 inline 02284 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_sg_properties( int j, const DerivativeProperties &properties ) 02285 { 02286 this->_set_DgDx_dot_sg_properties(j,properties); 02287 } 02288 02289 inline 02290 void ModelEvaluator::OutArgsSetup::set_DgDx_dotdot_sg_properties( int j, const DerivativeProperties &properties ) 02291 { 02292 this->_set_DgDx_dotdot_sg_properties(j,properties); 02293 } 02294 02295 inline 02296 void ModelEvaluator::OutArgsSetup::set_DgDx_sg_properties( int j, const DerivativeProperties &properties ) 02297 { 02298 this->_set_DgDx_sg_properties(j,properties); 02299 } 02300 02301 inline 02302 void ModelEvaluator::OutArgsSetup::set_DgDp_sg_properties( int j, int l, const DerivativeProperties &properties ) 02303 { 02304 this->_set_DgDp_sg_properties(j,l,properties); 02305 } 02306 02307 inline 02308 void ModelEvaluator::OutArgsSetup::set_DfDp_mp_properties( int l, const DerivativeProperties &properties ) 02309 { 02310 this->_set_DfDp_mp_properties(l,properties); 02311 } 02312 02313 inline 02314 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_mp_properties( int j, const DerivativeProperties &properties ) 02315 { 02316 this->_set_DgDx_dot_mp_properties(j,properties); 02317 } 02318 02319 inline 02320 void ModelEvaluator::OutArgsSetup::set_DgDx_dotdot_mp_properties( int j, const DerivativeProperties &properties ) 02321 { 02322 this->_set_DgDx_dotdot_mp_properties(j,properties); 02323 } 02324 02325 inline 02326 void ModelEvaluator::OutArgsSetup::set_DgDx_mp_properties( int j, const DerivativeProperties &properties ) 02327 { 02328 this->_set_DgDx_mp_properties(j,properties); 02329 } 02330 02331 inline 02332 void ModelEvaluator::OutArgsSetup::set_DgDp_mp_properties( int j, int l, const DerivativeProperties &properties ) 02333 { 02334 this->_set_DgDp_mp_properties(j,l,properties); 02335 } 02336 02337 } // namespace EpetraExt 02338 02339 #endif // EPETRA_EXT_MODEL_EVALUATOR_HPP
1.7.6.1