|
Thyra Package Browser (Single Doxygen Collection) Version of the Day
|
00001 // @HEADER 00002 // *********************************************************************** 00003 // 00004 // Thyra: Interfaces and Support for Abstract Numerical Algorithms 00005 // Copyright (2004) 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 THYRA_MODEL_EVALUATOR_BASE_DECL_HPP 00030 #define THYRA_MODEL_EVALUATOR_BASE_DECL_HPP 00031 00032 00033 #include "Thyra_LinearOpWithSolveBase.hpp" 00034 #include "Teuchos_Describable.hpp" 00035 #include "Teuchos_Assert.hpp" 00036 00037 #ifdef HAVE_THYRA_ME_POLYNOMIAL 00038 # include "Teuchos_Polynomial.hpp" 00039 #endif 00040 00041 00042 namespace Thyra { 00043 00044 00064 class ModelEvaluatorBase 00065 : virtual public Teuchos::Describable, 00066 virtual public Teuchos::VerboseObject<ModelEvaluatorBase> 00067 { 00068 public: 00069 00072 00074 enum EInArgsMembers { 00075 IN_ARG_x_dot 00076 ,IN_ARG_x 00077 ,IN_ARG_x_dot_poly 00078 ,IN_ARG_x_poly 00079 ,IN_ARG_t 00080 ,IN_ARG_alpha 00081 ,IN_ARG_beta 00082 }; 00084 static const int NUM_E_IN_ARGS_MEMBERS=7; 00085 00096 template<class Scalar> 00097 class InArgs : public Teuchos::Describable { 00098 public: 00100 typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag; 00102 InArgs(); 00105 int Np() const; 00107 bool supports(EInArgsMembers arg) const; 00109 void set_x_dot( const RCP<const VectorBase<Scalar> > &x_dot ); 00111 RCP<const VectorBase<Scalar> > get_x_dot() const; 00113 void set_x( const RCP<const VectorBase<Scalar> > &x ); 00115 RCP<const VectorBase<Scalar> > get_x() const; 00116 #ifdef HAVE_THYRA_ME_POLYNOMIAL 00117 00118 void set_x_poly( 00119 const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_poly ); 00121 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > get_x_poly() const; 00123 void set_x_dot_poly( 00124 const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_dot_poly ); 00126 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > get_x_dot_poly() const; 00127 #endif // HAVE_THYRA_ME_POLYNOMIAL 00128 00129 void set_p( int l, const RCP<const VectorBase<Scalar> > &p_l ); 00131 RCP<const VectorBase<Scalar> > get_p(int l) const; 00133 void set_t( ScalarMag t ); 00135 ScalarMag get_t() const; 00137 void set_alpha( Scalar alpha ); 00139 Scalar get_alpha() const; 00141 void set_beta( Scalar beta ); 00143 Scalar get_beta() const; 00146 void setArgs( 00147 const InArgs<Scalar>& inArgs, bool ignoreUnsupported = false, 00148 bool cloneObjects = false 00149 ); 00151 void assertSameSupport( const InArgs<Scalar> &inArgs ) const; 00153 std::string modelEvalDescription() const; 00155 std::string description() const; 00158 void describe( 00159 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel 00160 ) const; 00161 protected: 00163 void _setModelEvalDescription( const std::string &modelEvalDescription ); 00165 void _set_Np(int Np); 00167 void _setSupports( EInArgsMembers arg, bool supports ); 00169 void _setSupports( const InArgs<Scalar>& inputInArgs, const int Np ); 00171 void _setUnsupportsAndRelated( EInArgsMembers arg ); 00172 private: 00173 // types 00174 typedef Teuchos::Array<RCP<const VectorBase<Scalar> > > p_t; 00175 // data 00176 std::string modelEvalDescription_; 00177 RCP<const VectorBase<Scalar> > x_dot_; 00178 RCP<const VectorBase<Scalar> > x_; 00179 #ifdef HAVE_THYRA_ME_POLYNOMIAL 00180 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > x_dot_poly_; 00181 RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > x_poly_; 00182 #endif // HAVE_THYRA_ME_POLYNOMIAL 00183 p_t p_; 00184 ScalarMag t_; 00185 Scalar alpha_; 00186 Scalar beta_; 00187 bool supports_[NUM_E_IN_ARGS_MEMBERS]; 00188 // functions 00189 void assert_supports(EInArgsMembers arg) const; 00190 void assert_l(int l) const; 00191 }; 00192 00194 enum EDerivativeMultiVectorOrientation { 00195 DERIV_MV_JACOBIAN_FORM, 00196 DERIV_MV_GRADIENT_FORM, 00197 DERIV_MV_BY_COL = DERIV_MV_JACOBIAN_FORM, 00198 DERIV_TRANS_MV_BY_ROW = DERIV_MV_GRADIENT_FORM 00199 }; 00200 00202 enum EDerivativeLinearOp { 00203 DERIV_LINEAR_OP 00204 }; 00205 00208 class DerivativeSupport { 00209 public: 00211 DerivativeSupport() 00212 :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false) 00213 {} 00215 DerivativeSupport( EDerivativeLinearOp ) 00216 :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false) 00217 {} 00219 DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation ) 00220 :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL) 00221 ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW) 00222 {} 00224 DerivativeSupport& plus(EDerivativeLinearOp) 00225 { supportsLinearOp_ = true; return *this; } 00227 DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation) 00228 { 00229 switch(mvOrientation) { 00230 case DERIV_MV_BY_COL: supportsMVByCol_ = true; break; 00231 case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break; 00232 default: TEST_FOR_EXCEPT(true); 00233 } 00234 return *this; 00235 } 00237 bool none() const 00238 { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); } 00240 bool supports(EDerivativeLinearOp) const 00241 { return supportsLinearOp_; } 00243 bool supports(EDerivativeMultiVectorOrientation mvOrientation) const 00244 { 00245 switch(mvOrientation) { 00246 case DERIV_MV_BY_COL: return supportsMVByCol_; 00247 case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_; 00248 default: TEST_FOR_EXCEPT(true); 00249 } 00250 return false; // Will never be called! 00251 } 00253 bool isSameSupport(const DerivativeSupport &derivSupport) const 00254 { 00255 return ( 00256 supportsLinearOp_ == derivSupport.supportsLinearOp_ 00257 && supportsMVByCol_ == derivSupport.supportsMVByCol_ 00258 && supportsTransMVByRow_ == derivSupport.supportsTransMVByRow_ 00259 ); 00260 } 00262 std::string description() const; 00263 private: 00264 bool supportsLinearOp_; 00265 bool supportsMVByCol_; 00266 bool supportsTransMVByRow_; 00267 public: 00268 }; 00269 00271 enum EDerivativeLinearity { 00272 DERIV_LINEARITY_UNKNOWN 00273 ,DERIV_LINEARITY_CONST 00274 ,DERIV_LINEARITY_NONCONST 00275 }; 00276 00278 enum ERankStatus { 00279 DERIV_RANK_UNKNOWN 00280 ,DERIV_RANK_FULL 00281 ,DERIV_RANK_DEFICIENT 00282 }; 00283 00286 struct DerivativeProperties { 00288 EDerivativeLinearity linearity; 00290 ERankStatus rank; 00292 bool supportsAdjoint; 00294 DerivativeProperties() 00295 :linearity(DERIV_LINEARITY_UNKNOWN), 00296 rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) 00297 {} 00299 DerivativeProperties( 00300 EDerivativeLinearity in_linearity, ERankStatus in_rank, 00301 bool in_supportsAdjoint 00302 ) 00303 :linearity(in_linearity),rank(in_rank), 00304 supportsAdjoint(in_supportsAdjoint) 00305 {} 00306 }; 00307 00311 template<class Scalar> 00312 class DerivativeMultiVector { 00313 public: 00315 DerivativeMultiVector() 00316 :orientation_(DERIV_MV_BY_COL) 00317 {} 00319 DerivativeMultiVector( 00320 const RCP<MultiVectorBase<Scalar> > &mv 00321 ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00322 ) : mv_(mv.assert_not_null()), orientation_(orientation) {} 00324 void changeOrientation( const EDerivativeMultiVectorOrientation orientation ) 00325 { orientation_ = orientation; }; 00327 const DerivativeMultiVector<Scalar>& assert_not_null() const 00328 { mv_.assert_not_null(); return *this; } 00330 RCP<MultiVectorBase<Scalar> > getMultiVector() const 00331 { return mv_; } 00333 EDerivativeMultiVectorOrientation getOrientation() const 00334 { return orientation_; } 00336 std::string description() const; 00338 void describe( 00339 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel 00340 ) const; 00341 private: 00342 RCP<MultiVectorBase<Scalar> > mv_; 00343 EDerivativeMultiVectorOrientation orientation_; 00344 }; 00345 00349 template<class Scalar> 00350 class Derivative { 00351 public: 00353 Derivative() {} 00355 Derivative( const RCP<LinearOpBase<Scalar> > &lo ) 00356 : lo_(lo.assert_not_null()) {} 00358 Derivative( 00359 const RCP<MultiVectorBase<Scalar> > &mv, 00360 const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL 00361 ) : dmv_(mv,orientation) {} 00363 Derivative( const DerivativeMultiVector<Scalar> &dmv ) 00364 : dmv_(dmv) {} 00366 bool isEmpty() const 00367 { return ( lo_.get()==NULL && dmv_.getMultiVector().get()==NULL ); } 00369 const Derivative<Scalar>& assert_not_null() const 00370 { dmv_.assert_not_null(); lo_.assert_not_null(); return *this; } 00372 RCP<LinearOpBase<Scalar> > getLinearOp() const 00373 { return lo_; } 00375 RCP<MultiVectorBase<Scalar> > getMultiVector() const 00376 { return dmv_.getMultiVector(); } 00378 EDerivativeMultiVectorOrientation getMultiVectorOrientation() const 00379 { return dmv_.getOrientation(); } 00381 DerivativeMultiVector<Scalar> getDerivativeMultiVector() const 00382 { return dmv_; } 00386 bool isSupportedBy( const DerivativeSupport &derivSupport ) const 00387 { 00388 // If there is not derivative support then we will return false! 00389 if (derivSupport.none()) 00390 return false; 00391 if (!is_null(getMultiVector())) { 00392 return derivSupport.supports(getMultiVectorOrientation()); 00393 } 00394 else if(!is_null(getLinearOp())) { 00395 return derivSupport.supports(DERIV_LINEAR_OP); 00396 } 00397 // If nothing is set then of course we support that! 00398 return true; 00399 } 00401 std::string description() const; 00403 void describe( 00404 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel 00405 ) const; 00406 private: 00407 RCP<LinearOpBase<Scalar> > lo_; 00408 DerivativeMultiVector<Scalar> dmv_; 00409 }; 00410 00412 enum EOutArgsMembers { 00413 OUT_ARG_f 00414 ,OUT_ARG_W 00415 ,OUT_ARG_W_op 00416 ,OUT_ARG_f_poly 00417 }; 00419 static const int NUM_E_OUT_ARGS_MEMBERS=4; 00420 00422 enum EOutArgsDfDp { 00423 OUT_ARG_DfDp 00424 }; 00425 00427 enum EOutArgsDgDx_dot { 00428 OUT_ARG_DgDx_dot 00429 }; 00430 00432 enum EOutArgsDgDx { 00433 OUT_ARG_DgDx 00434 }; 00435 00437 enum EOutArgsDgDp { 00438 OUT_ARG_DgDp 00439 }; 00440 00461 template<class Scalar> 00462 class OutArgs : public Teuchos::Describable { 00463 public: 00465 OutArgs(); 00468 int Np() const; 00471 int Ng() const; 00473 bool supports(EOutArgsMembers arg) const; 00476 const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const; 00479 const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const; 00482 const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const; 00485 const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const; 00487 void set_f( const RCP<VectorBase<Scalar> > &f ); 00489 RCP<VectorBase<Scalar> > get_f() const; 00491 void set_g( int j, const RCP<VectorBase<Scalar> > &g_j ); 00493 RCP<VectorBase<Scalar> > get_g(int j) const; 00495 void set_W( const RCP<LinearOpWithSolveBase<Scalar> > &W ); 00497 RCP<LinearOpWithSolveBase<Scalar> > get_W() const; 00499 void set_W_op( const RCP<LinearOpBase<Scalar> > &W_op ); 00501 RCP<LinearOpBase<Scalar> > get_W_op() const; 00504 DerivativeProperties get_W_properties() const; 00506 void set_DfDp(int l, const Derivative<Scalar> &DfDp_l); 00508 Derivative<Scalar> get_DfDp(int l) const; 00511 DerivativeProperties get_DfDp_properties(int l) const; 00513 void set_DgDx_dot(int j, const Derivative<Scalar> &DgDx_dot_j); 00515 Derivative<Scalar> get_DgDx_dot(int j) const; 00518 DerivativeProperties get_DgDx_dot_properties(int j) const; 00520 void set_DgDx(int j, const Derivative<Scalar> &DgDx_j); 00522 Derivative<Scalar> get_DgDx(int j) const; 00525 DerivativeProperties get_DgDx_properties(int j) const; 00527 void set_DgDp( int j, int l, const Derivative<Scalar> &DgDp_j_l ); 00529 Derivative<Scalar> get_DgDp(int j, int l) const; 00532 DerivativeProperties get_DgDp_properties(int j, int l) const; 00533 #ifdef HAVE_THYRA_ME_POLYNOMIAL 00534 00535 void set_f_poly( const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly ); 00537 RCP<Teuchos::Polynomial< VectorBase<Scalar> > > get_f_poly() const; 00538 #endif // HAVE_THYRA_ME_POLYNOMIAL 00539 00544 void setArgs( const OutArgs<Scalar>& outArgs, bool ignoreUnsupported = false ); 00556 void setFailed() const; 00562 bool isFailed() const; 00564 bool isEmpty() const; 00566 void assertSameSupport( const OutArgs<Scalar> &outArgs ) const; 00568 std::string modelEvalDescription() const; 00570 std::string description() const; 00573 void describe( 00574 Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel 00575 ) const; 00576 protected: 00578 void _setModelEvalDescription( const std::string &modelEvalDescription ); 00580 void _set_Np_Ng(int Np, int Ng); 00582 void _setSupports( EOutArgsMembers arg, bool supports ); 00584 void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& ); 00586 void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& ); 00588 void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& ); 00590 void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& ); 00592 void _set_W_properties( const DerivativeProperties &properties ); 00594 void _set_DfDp_properties( int l, const DerivativeProperties &properties ); 00596 void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties ); 00598 void _set_DgDx_properties( int j, const DerivativeProperties &properties ); 00600 void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties ); 00602 void _setSupports( const OutArgs<Scalar>& inputOutArgs ); 00604 void _setUnsupportsAndRelated( EInArgsMembers arg ); 00606 void _setUnsupportsAndRelated( EOutArgsMembers arg ); 00607 private: 00608 // types 00609 typedef Teuchos::Array<RCP<VectorBase<Scalar> > > g_t; 00610 typedef Teuchos::Array<Derivative<Scalar> > deriv_t; 00611 typedef Teuchos::Array<DerivativeProperties> deriv_properties_t; 00612 typedef Teuchos::Array<DerivativeSupport> supports_t; 00613 // data 00614 std::string modelEvalDescription_; 00615 bool supports_[NUM_E_OUT_ARGS_MEMBERS]; 00616 supports_t supports_DfDp_; // Np 00617 supports_t supports_DgDx_dot_; // Ng 00618 supports_t supports_DgDx_; // Ng 00619 supports_t supports_DgDp_; // Ng x Np 00620 RCP<VectorBase<Scalar> > f_; 00621 g_t g_; // Ng 00622 RCP<LinearOpWithSolveBase<Scalar> > W_; 00623 RCP<LinearOpBase<Scalar> > W_op_; 00624 DerivativeProperties W_properties_; 00625 deriv_t DfDp_; // Np 00626 deriv_properties_t DfDp_properties_; // Np 00627 deriv_t DgDx_dot_; // Ng 00628 deriv_t DgDx_; // Ng 00629 deriv_properties_t DgDx_dot_properties_; // Ng 00630 deriv_properties_t DgDx_properties_; // Ng 00631 deriv_t DgDp_; // Ng x Np 00632 deriv_properties_t DgDp_properties_; // Ng x Np 00633 #ifdef HAVE_THYRA_ME_POLYNOMIAL 00634 RCP<Teuchos::Polynomial< VectorBase<Scalar> > > f_poly_; 00635 #endif // HAVE_THYRA_ME_POLYNOMIAL 00636 mutable bool isFailed_; 00637 // functions 00638 void assert_supports(EOutArgsMembers arg) const; 00639 void assert_supports( 00640 EOutArgsDfDp arg, int l, 00641 const Derivative<Scalar> &deriv = Derivative<Scalar>() 00642 ) const; 00643 void assert_supports( 00644 EOutArgsDgDx_dot arg, int j, 00645 const Derivative<Scalar> &deriv = Derivative<Scalar>() 00646 ) const; 00647 void assert_supports( 00648 EOutArgsDgDx arg, int j, 00649 const Derivative<Scalar> &deriv = Derivative<Scalar>() 00650 ) const; 00651 void assert_supports( 00652 EOutArgsDgDp arg, int j, int l, 00653 const Derivative<Scalar> &deriv = Derivative<Scalar>() 00654 ) const; 00655 void assert_l(int l) const; 00656 void assert_j(int j) const; 00657 }; 00658 00660 00661 // Added since at least gcc 3.3.4 does not do the right thing here! 00662 #ifdef HAVE_PROTECTED_NESTED_TEMPLATE_CLASS_ACCESS 00663 protected: 00664 #endif 00665 00668 00676 template<class Scalar> 00677 class InArgsSetup : public InArgs<Scalar> { 00678 public: 00680 InArgsSetup(); 00682 InArgsSetup( const InArgs<Scalar>& ); 00684 void setModelEvalDescription( const std::string &modelEvalDescription ); 00686 void set_Np(int Np); 00688 void setSupports( EInArgsMembers arg, bool supports = true ); 00690 void setSupports( const InArgs<Scalar>& inputInArgs, const int Np = -1 ); 00692 void setUnsupportsAndRelated( EInArgsMembers arg ); 00693 }; 00694 00702 template<class Scalar> 00703 class OutArgsSetup : public OutArgs<Scalar> { 00704 public: 00706 OutArgsSetup(); 00708 OutArgsSetup( const OutArgs<Scalar>& ); 00710 void setModelEvalDescription( const std::string &modelEvalDescription ); 00712 void set_Np_Ng(int Np, int Ng); 00714 void setSupports( EOutArgsMembers arg, bool supports = true ); 00716 void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& ); 00718 void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& ); 00720 void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& ); 00722 void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& ); 00724 void set_W_properties( const DerivativeProperties &properties ); 00726 void set_DfDp_properties( int l, const DerivativeProperties &properties ); 00728 void set_DgDx_dot_properties( int j, const DerivativeProperties &properties ); 00730 void set_DgDx_properties( int j, const DerivativeProperties &properties ); 00732 void set_DgDp_properties( int j, int l, const DerivativeProperties &properties ); 00734 void setSupports( const OutArgs<Scalar>& inputOutArgs ); 00736 void setUnsupportsAndRelated( EInArgsMembers arg ); 00738 void setUnsupportsAndRelated( EOutArgsMembers arg ); 00739 }; 00740 00742 00743 }; 00744 00745 00747 std::string toString(ModelEvaluatorBase::EInArgsMembers); 00748 00749 00751 std::string toString(ModelEvaluatorBase::EOutArgsMembers); 00752 00753 00755 std::string toString( 00756 ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation 00757 ); 00758 00759 00761 ModelEvaluatorBase::EDerivativeMultiVectorOrientation 00762 getOtherDerivativeMultiVectorOrientation( 00763 ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation 00764 ); 00765 00766 00767 } // namespace Thyra 00768 00769 00770 // ////////////////////////////////// 00771 // Inline Defintions 00772 00773 00774 // 00775 // Thyra_MEB_helper_functions_grp 00776 // 00777 00778 00779 inline 00780 std::string Thyra::toString(ModelEvaluatorBase::EInArgsMembers arg) 00781 { 00782 switch(arg) { 00783 case ModelEvaluatorBase::IN_ARG_x_dot: 00784 return "IN_ARG_x_dot"; 00785 case ModelEvaluatorBase::IN_ARG_x: 00786 return "IN_ARG_x"; 00787 case ModelEvaluatorBase::IN_ARG_x_dot_poly: 00788 return "IN_ARG_x_dot_poly"; 00789 case ModelEvaluatorBase::IN_ARG_x_poly: 00790 return "IN_ARG_x_poly"; 00791 case ModelEvaluatorBase::IN_ARG_t: 00792 return "IN_ARG_t"; 00793 case ModelEvaluatorBase::IN_ARG_alpha: 00794 return "IN_ARG_alpha"; 00795 case ModelEvaluatorBase::IN_ARG_beta: 00796 return "IN_ARG_beta"; 00797 #ifdef TEUCHOS_DEBUG 00798 default: 00799 TEST_FOR_EXCEPT(true); 00800 #endif 00801 } 00802 return ""; // Will never be executed! 00803 } 00804 00805 00806 inline 00807 std::string Thyra::toString(ModelEvaluatorBase::EOutArgsMembers arg) 00808 { 00809 switch(arg) { 00810 case ModelEvaluatorBase::OUT_ARG_f: 00811 return "OUT_ARG_f"; 00812 case ModelEvaluatorBase::OUT_ARG_W: 00813 return "OUT_ARG_W"; 00814 case ModelEvaluatorBase::OUT_ARG_W_op: 00815 return "OUT_ARG_W_op"; 00816 case ModelEvaluatorBase::OUT_ARG_f_poly: 00817 return "OUT_ARG_f_poly"; 00818 #ifdef TEUCHOS_DEBUG 00819 default: 00820 TEST_FOR_EXCEPT(true); 00821 #endif 00822 } 00823 return ""; // Will never be executed! 00824 } 00825 00826 00827 inline 00828 std::string Thyra::toString( 00829 ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation 00830 ) 00831 { 00832 switch(orientation) { 00833 case ModelEvaluatorBase::DERIV_MV_BY_COL: 00834 return "DERIV_MV_BY_COL"; 00835 case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW: 00836 return "DERIV_TRANS_MV_BY_ROW"; 00837 #ifdef TEUCHOS_DEBUG 00838 default: 00839 TEST_FOR_EXCEPT(true); 00840 #endif 00841 } 00842 return ""; // Should never execute this! 00843 } 00844 00845 00846 inline 00847 Thyra::ModelEvaluatorBase::EDerivativeMultiVectorOrientation 00848 Thyra::getOtherDerivativeMultiVectorOrientation( 00849 ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation 00850 ) 00851 { 00852 switch(orientation) { 00853 case ModelEvaluatorBase::DERIV_MV_BY_COL: 00854 return ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW; 00855 case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW: 00856 return ModelEvaluatorBase::DERIV_MV_BY_COL; 00857 #ifdef TEUCHOS_DEBUG 00858 default: 00859 TEST_FOR_EXCEPT(true); 00860 #endif 00861 } 00862 return ModelEvaluatorBase::DERIV_MV_BY_COL; // Should never execute this! 00863 } 00864 00865 00866 #endif // THYRA_MODEL_EVALUATOR_BASE_DECL_HPP
1.7.4