Thyra_ModelEvaluatorBase_decl.hpp

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 "Thyra_PolynomialVectorTraits.hpp"
00035 #include "Teuchos_Describable.hpp"
00036 #include "Teuchos_Polynomial.hpp"
00037 #include "Teuchos_Assert.hpp"
00038 
00039 
00040 namespace Thyra {
00041 
00042 
00060 class ModelEvaluatorBase
00061   : virtual public Teuchos::Describable,
00062     virtual public Teuchos::VerboseObject<ModelEvaluatorBase>
00063 {
00064 public:
00065 
00068 
00070   enum EInArgsMembers {
00071     IN_ARG_x_dot 
00072     ,IN_ARG_x 
00073     ,IN_ARG_x_dot_poly 
00074     ,IN_ARG_x_poly 
00075     ,IN_ARG_t 
00076     ,IN_ARG_alpha 
00077     ,IN_ARG_beta 
00078   };
00080   static const int NUM_E_IN_ARGS_MEMBERS=7;
00081 
00092   template<class Scalar>
00093   class InArgs : public Teuchos::Describable {
00094   public:
00096     typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00098     InArgs();
00101     int Np() const;
00103     bool supports(EInArgsMembers arg) const;
00105     void set_x_dot( const RCP<const VectorBase<Scalar> > &x_dot );
00107     RCP<const VectorBase<Scalar> > get_x_dot() const;
00109     void set_x( const RCP<const VectorBase<Scalar> > &x );
00111     RCP<const VectorBase<Scalar> > get_x() const;
00113     void set_x_poly( 
00114       const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_poly );
00116     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > get_x_poly() const;
00118     void set_x_dot_poly(
00119       const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_dot_poly );
00121     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > get_x_dot_poly() const;
00123     void set_p( int l, const RCP<const VectorBase<Scalar> > &p_l );
00125     RCP<const VectorBase<Scalar> > get_p(int l) const;
00127     void set_t( ScalarMag t );
00129     ScalarMag get_t() const;
00131     void set_alpha( Scalar alpha );
00133     Scalar get_alpha() const;
00135     void set_beta( Scalar beta );
00137     Scalar get_beta() const;
00140     void setArgs(
00141       const InArgs<Scalar>& inArgs, bool ignoreUnsupported = false,
00142       bool cloneObjects = false
00143       );
00145     void assertSameSupport( const InArgs<Scalar> &inArgs ) const;
00147     std::string modelEvalDescription() const;
00149     std::string description() const;
00152     void describe(
00153       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00154       ) const;
00155   protected:
00157     void _setModelEvalDescription( const std::string &modelEvalDescription );
00159     void _set_Np(int Np);
00161     void _setSupports( EInArgsMembers arg, bool supports );
00163     void _setSupports( const InArgs<Scalar>& inputInArgs, const int Np );
00165     void _setUnsupportsAndRelated( EInArgsMembers arg );
00166   private:
00167     // types
00168     typedef Teuchos::Array<RCP<const VectorBase<Scalar> > > p_t;
00169     // data
00170     std::string modelEvalDescription_;
00171     RCP<const VectorBase<Scalar> > x_dot_;
00172     RCP<const VectorBase<Scalar> > x_;
00173     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > x_dot_poly_;
00174     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > x_poly_;
00175     p_t p_;
00176     ScalarMag t_;
00177     Scalar alpha_;
00178     Scalar beta_;
00179     bool supports_[NUM_E_IN_ARGS_MEMBERS];
00180     // functions
00181     void assert_supports(EInArgsMembers arg) const;
00182     void assert_l(int l) const;
00183   };
00184 
00186   enum EDerivativeMultiVectorOrientation {
00187     DERIV_MV_JACOBIAN_FORM, 
00188     DERIV_MV_GRADIENT_FORM, 
00189     DERIV_MV_BY_COL = DERIV_MV_JACOBIAN_FORM, 
00190     DERIV_TRANS_MV_BY_ROW = DERIV_MV_GRADIENT_FORM 
00191   };
00192 
00194   enum EDerivativeLinearOp {
00195     DERIV_LINEAR_OP 
00196   };
00197 
00200   class DerivativeSupport {
00201   public:
00203     DerivativeSupport()
00204       :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false)
00205       {}
00207     DerivativeSupport( EDerivativeLinearOp )
00208       :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false)
00209       {}
00211     DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation )
00212       :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00213       ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00214       {}
00216     DerivativeSupport& plus(EDerivativeLinearOp)
00217       { supportsLinearOp_ = true; return *this; }
00219     DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation)
00220       {
00221         switch(mvOrientation) {
00222           case DERIV_MV_BY_COL: supportsMVByCol_ = true; break;
00223           case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break;
00224           default: TEST_FOR_EXCEPT(true);
00225         }
00226         return *this;
00227       }
00229     bool none() const
00230       { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); }
00232     bool supports(EDerivativeLinearOp) const
00233       { return supportsLinearOp_; }
00235     bool supports(EDerivativeMultiVectorOrientation mvOrientation) const
00236       {
00237         switch(mvOrientation) {
00238           case DERIV_MV_BY_COL: return supportsMVByCol_;
00239           case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_;
00240           default: TEST_FOR_EXCEPT(true);
00241         }
00242         return false; // Will never be called!
00243       }
00245     bool isSameSupport(const DerivativeSupport &derivSupport) const
00246       {
00247         return (
00248           supportsLinearOp_ == derivSupport.supportsLinearOp_
00249           && supportsMVByCol_ == derivSupport.supportsMVByCol_
00250           && supportsTransMVByRow_ == derivSupport.supportsTransMVByRow_
00251           );
00252       } 
00254     std::string description() const;
00255   private:
00256     bool supportsLinearOp_;
00257     bool supportsMVByCol_;
00258     bool supportsTransMVByRow_;
00259   public:
00260   };
00261   
00263   enum EDerivativeLinearity {
00264     DERIV_LINEARITY_UNKNOWN      
00265     ,DERIV_LINEARITY_CONST       
00266     ,DERIV_LINEARITY_NONCONST    
00267   };
00268 
00270   enum ERankStatus {
00271     DERIV_RANK_UNKNOWN       
00272     ,DERIV_RANK_FULL         
00273     ,DERIV_RANK_DEFICIENT    
00274   };
00275 
00278   struct DerivativeProperties {
00280     EDerivativeLinearity     linearity;
00282     ERankStatus              rank;
00284     bool                     supportsAdjoint;
00286     DerivativeProperties()
00287       :linearity(DERIV_LINEARITY_UNKNOWN),
00288        rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false)
00289       {}
00291     DerivativeProperties(
00292       EDerivativeLinearity in_linearity, ERankStatus in_rank,
00293       bool in_supportsAdjoint
00294       )
00295       :linearity(in_linearity),rank(in_rank),
00296        supportsAdjoint(in_supportsAdjoint)
00297       {}
00298   };
00299 
00303   template<class Scalar>
00304   class DerivativeMultiVector {
00305   public:
00307     DerivativeMultiVector()
00308       :orientation_(DERIV_MV_BY_COL)
00309       {}
00311     DerivativeMultiVector(
00312       const RCP<MultiVectorBase<Scalar> > &mv
00313       ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00314       ) : mv_(mv.assert_not_null()), orientation_(orientation) {}
00316     void changeOrientation( const EDerivativeMultiVectorOrientation orientation )
00317       { orientation_ = orientation; };
00319     const DerivativeMultiVector<Scalar>& assert_not_null() const
00320       { mv_.assert_not_null(); return *this; }
00322     RCP<MultiVectorBase<Scalar> > getMultiVector() const
00323       { return mv_; }
00325     EDerivativeMultiVectorOrientation getOrientation() const
00326       { return orientation_; }
00328     std::string description() const;
00330     void describe( 
00331       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00332       ) const;
00333   private:
00334     RCP<MultiVectorBase<Scalar> > mv_;
00335     EDerivativeMultiVectorOrientation orientation_;
00336   };
00337 
00341   template<class Scalar>
00342   class Derivative {
00343   public:
00345     Derivative() {}
00347     Derivative( const RCP<LinearOpBase<Scalar> > &lo )
00348       : lo_(lo.assert_not_null()) {}
00350     Derivative(
00351       const RCP<MultiVectorBase<Scalar> > &mv,
00352       const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00353       ) : dmv_(mv,orientation) {}
00355     Derivative( const DerivativeMultiVector<Scalar> &dmv )
00356       : dmv_(dmv) {}
00358     bool isEmpty() const
00359       { return ( lo_.get()==NULL && dmv_.getMultiVector().get()==NULL ); }
00361     const Derivative<Scalar>& assert_not_null() const
00362       { dmv_.assert_not_null(); lo_.assert_not_null(); return *this; }
00364     RCP<LinearOpBase<Scalar> > getLinearOp() const
00365       { return lo_; }
00367     RCP<MultiVectorBase<Scalar> > getMultiVector() const
00368       { return dmv_.getMultiVector(); }
00370     EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
00371       { return dmv_.getOrientation(); }
00373     DerivativeMultiVector<Scalar> getDerivativeMultiVector() const
00374       { return dmv_; }
00378     bool isSupportedBy( const DerivativeSupport &derivSupport ) const
00379       {
00380         // If there is not derivative support then we will return false!
00381         if (derivSupport.none())
00382           return false;
00383         if (!is_null(getMultiVector())) {
00384           return derivSupport.supports(getMultiVectorOrientation());
00385         }
00386         else if(!is_null(getLinearOp())) {
00387           return derivSupport.supports(DERIV_LINEAR_OP);
00388         }
00389         // If nothing is set then of course we support that!
00390         return true;
00391       }
00393     std::string description() const;
00395     void describe( 
00396       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00397       ) const;
00398   private:
00399     RCP<LinearOpBase<Scalar> > lo_;
00400     DerivativeMultiVector<Scalar> dmv_;
00401   };
00402 
00404   enum EOutArgsMembers {
00405     OUT_ARG_f       
00406     ,OUT_ARG_W      
00407     ,OUT_ARG_W_op   
00408     ,OUT_ARG_f_poly 
00409   };
00411   static const int NUM_E_OUT_ARGS_MEMBERS=4;
00412 
00414   enum EOutArgsDfDp {
00415     OUT_ARG_DfDp   
00416   };
00417 
00419   enum EOutArgsDgDx_dot {
00420     OUT_ARG_DgDx_dot   
00421   };
00422 
00424   enum EOutArgsDgDx {
00425     OUT_ARG_DgDx   
00426   };
00427 
00429   enum EOutArgsDgDp {
00430     OUT_ARG_DgDp   
00431   };
00432   
00453   template<class Scalar>
00454   class OutArgs : public Teuchos::Describable {
00455   public:
00457     OutArgs();
00460     int Np() const;
00463     int Ng() const;
00465     bool supports(EOutArgsMembers arg) const;
00468     const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const;
00471     const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const;
00474     const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const;
00477     const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const;
00479     void set_f( const RCP<VectorBase<Scalar> > &f );
00481     RCP<VectorBase<Scalar> > get_f() const;
00483     void set_g( int j, const RCP<VectorBase<Scalar> > &g_j );
00485     RCP<VectorBase<Scalar> > get_g(int j) const;
00487     void set_W( const RCP<LinearOpWithSolveBase<Scalar> > &W );
00489     RCP<LinearOpWithSolveBase<Scalar> > get_W() const;
00491     void set_W_op( const RCP<LinearOpBase<Scalar> > &W_op );
00493     RCP<LinearOpBase<Scalar> > get_W_op() const;
00496     DerivativeProperties get_W_properties() const;
00498     void set_DfDp(int l,  const Derivative<Scalar> &DfDp_l);
00500     Derivative<Scalar> get_DfDp(int l) const;
00503     DerivativeProperties get_DfDp_properties(int l) const;
00505     void set_DgDx_dot(int j, const Derivative<Scalar> &DgDx_dot_j);
00507     Derivative<Scalar> get_DgDx_dot(int j) const;
00510     DerivativeProperties get_DgDx_dot_properties(int j) const;
00512     void set_DgDx(int j, const Derivative<Scalar> &DgDx_j);
00514     Derivative<Scalar> get_DgDx(int j) const;
00517     DerivativeProperties get_DgDx_properties(int j) const;
00519     void set_DgDp( int j, int l, const Derivative<Scalar> &DgDp_j_l );
00521     Derivative<Scalar> get_DgDp(int j, int l) const;
00524     DerivativeProperties get_DgDp_properties(int j, int l) const;
00526     void set_f_poly( const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly );
00528     RCP<Teuchos::Polynomial< VectorBase<Scalar> > > get_f_poly() const;
00534     void setArgs( const OutArgs<Scalar>& outArgs, bool ignoreUnsupported = false );
00546     void setFailed() const;
00552     bool isFailed() const;
00554     bool isEmpty() const;
00556     void assertSameSupport( const OutArgs<Scalar> &outArgs ) const;
00558     std::string modelEvalDescription() const;
00560     std::string description() const;
00563     void describe(
00564       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00565       ) const;
00566   protected:
00568     void _setModelEvalDescription( const std::string &modelEvalDescription );
00570     void _set_Np_Ng(int Np, int Ng);
00572     void _setSupports( EOutArgsMembers arg, bool supports );
00574     void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& );
00576     void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00578     void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& );
00580     void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00582     void _set_W_properties( const DerivativeProperties &properties );
00584     void _set_DfDp_properties( int l, const DerivativeProperties &properties );
00586     void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00588     void _set_DgDx_properties( int j, const DerivativeProperties &properties );
00590     void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00592     void _setSupports( const OutArgs<Scalar>& inputOutArgs );
00594     void _setUnsupportsAndRelated( EInArgsMembers arg );
00596     void _setUnsupportsAndRelated( EOutArgsMembers arg );
00597   private:
00598     // types
00599     typedef Teuchos::Array<RCP<VectorBase<Scalar> > > g_t;
00600     typedef Teuchos::Array<Derivative<Scalar> > deriv_t;
00601     typedef Teuchos::Array<DerivativeProperties> deriv_properties_t;
00602     typedef Teuchos::Array<DerivativeSupport> supports_t;
00603     // data
00604     std::string modelEvalDescription_;
00605     bool supports_[NUM_E_OUT_ARGS_MEMBERS];
00606     supports_t supports_DfDp_; // Np
00607     supports_t supports_DgDx_dot_; // Ng
00608     supports_t supports_DgDx_; // Ng
00609     supports_t supports_DgDp_; // Ng x Np
00610     RCP<VectorBase<Scalar> > f_;
00611     g_t g_; // Ng
00612     RCP<LinearOpWithSolveBase<Scalar> > W_;
00613     RCP<LinearOpBase<Scalar> > W_op_;
00614     DerivativeProperties W_properties_;
00615     deriv_t DfDp_; // Np
00616     deriv_properties_t DfDp_properties_; // Np
00617     deriv_t DgDx_dot_; // Ng
00618     deriv_t DgDx_; // Ng
00619     deriv_properties_t DgDx_dot_properties_; // Ng
00620     deriv_properties_t DgDx_properties_; // Ng
00621     deriv_t DgDp_; // Ng x Np
00622     deriv_properties_t DgDp_properties_; // Ng x Np
00623     RCP<Teuchos::Polynomial< VectorBase<Scalar> > > f_poly_;
00624     mutable bool isFailed_;
00625     // functions
00626     void assert_supports(EOutArgsMembers arg) const;
00627     void assert_supports(
00628       EOutArgsDfDp arg, int l,
00629       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00630       ) const;
00631     void assert_supports(
00632       EOutArgsDgDx_dot arg, int j,
00633       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00634       ) const;
00635     void assert_supports(
00636       EOutArgsDgDx arg, int j,
00637       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00638       ) const;
00639     void assert_supports(
00640       EOutArgsDgDp arg, int j, int l,
00641       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00642       ) const;
00643     void assert_l(int l) const;
00644     void assert_j(int j) const;
00645   };
00646 
00648 
00649 // Added since at least gcc 3.3.4 does not do the right thing here!
00650 #ifdef HAVE_PROTECTED_NESTED_TEMPLATE_CLASS_ACCESS
00651 protected:
00652 #endif
00653 
00656 
00664   template<class Scalar>
00665   class InArgsSetup : public InArgs<Scalar> {
00666   public:
00668     InArgsSetup();
00670     InArgsSetup( const InArgs<Scalar>& );
00672     void setModelEvalDescription( const std::string &modelEvalDescription );
00674     void set_Np(int Np);
00676     void setSupports( EInArgsMembers arg, bool supports = true );
00678     void setSupports( const InArgs<Scalar>& inputInArgs, const int Np = -1 );
00680     void setUnsupportsAndRelated( EInArgsMembers arg );
00681   };
00682 
00690   template<class Scalar>
00691   class OutArgsSetup : public OutArgs<Scalar> {
00692   public:
00694     OutArgsSetup();
00696     OutArgsSetup( const OutArgs<Scalar>& );
00698     void setModelEvalDescription( const std::string &modelEvalDescription );
00700     void set_Np_Ng(int Np, int Ng);
00702     void setSupports( EOutArgsMembers arg, bool supports = true );
00704     void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& );
00706     void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00708     void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& );
00710     void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00712     void set_W_properties( const DerivativeProperties &properties );
00714     void set_DfDp_properties( int l, const DerivativeProperties &properties );
00716     void set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00718     void set_DgDx_properties( int j, const DerivativeProperties &properties );
00720     void set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00722     void setSupports( const OutArgs<Scalar>& inputOutArgs );
00724     void setUnsupportsAndRelated( EInArgsMembers arg );
00726     void setUnsupportsAndRelated( EOutArgsMembers arg );
00727    };
00728 
00730 
00731 };
00732 
00733 
00738 
00739 
00741 std::string toString(ModelEvaluatorBase::EInArgsMembers);
00742 
00743 
00745 std::string toString(ModelEvaluatorBase::EOutArgsMembers);
00746 
00747 
00749 std::string toString(
00750   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00751   );
00752 
00753 
00755 ModelEvaluatorBase::EDerivativeMultiVectorOrientation
00756 getOtherDerivativeMultiVectorOrientation(
00757   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00758   );
00759 
00760 
00762 
00763 
00764 } // namespace Thyra
00765 
00766 
00767 // //////////////////////////////////
00768 // Inline Defintions
00769 
00770 
00771 //
00772 // Thyra_MEB_helper_functions_grp
00773 //
00774 
00775 
00776 inline
00777 std::string Thyra::toString(ModelEvaluatorBase::EInArgsMembers arg)
00778 {
00779   switch(arg) {
00780     case ModelEvaluatorBase::IN_ARG_x_dot:
00781       return "IN_ARG_x_dot";
00782     case ModelEvaluatorBase::IN_ARG_x:
00783       return "IN_ARG_x";
00784     case ModelEvaluatorBase::IN_ARG_x_dot_poly:
00785       return "IN_ARG_x_dot_poly";
00786     case ModelEvaluatorBase::IN_ARG_x_poly:
00787       return "IN_ARG_x_poly";
00788     case ModelEvaluatorBase::IN_ARG_t:
00789       return "IN_ARG_t";
00790     case ModelEvaluatorBase::IN_ARG_alpha:
00791       return "IN_ARG_alpha";
00792     case ModelEvaluatorBase::IN_ARG_beta:
00793       return "IN_ARG_beta";
00794 #ifdef TEUCHOS_DEBUG
00795     default:
00796       TEST_FOR_EXCEPT(true);
00797 #endif
00798   }
00799   return ""; // Will never be executed!
00800 }
00801 
00802 
00803 inline
00804 std::string Thyra::toString(ModelEvaluatorBase::EOutArgsMembers arg)
00805 {
00806   switch(arg) {
00807     case ModelEvaluatorBase::OUT_ARG_f:
00808       return "OUT_ARG_f";
00809     case ModelEvaluatorBase::OUT_ARG_W:
00810       return "OUT_ARG_W";
00811     case ModelEvaluatorBase::OUT_ARG_W_op:
00812       return "OUT_ARG_W_op";
00813     case ModelEvaluatorBase::OUT_ARG_f_poly:
00814       return "OUT_ARG_f_poly";
00815 #ifdef TEUCHOS_DEBUG
00816     default:
00817       TEST_FOR_EXCEPT(true);
00818 #endif
00819   }
00820   return ""; // Will never be executed!
00821 }
00822 
00823 
00824 inline
00825 std::string Thyra::toString(
00826   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00827   )
00828 {
00829   switch(orientation) {
00830     case ModelEvaluatorBase::DERIV_MV_BY_COL:
00831       return "DERIV_MV_BY_COL";
00832     case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW:
00833       return "DERIV_TRANS_MV_BY_ROW";
00834 #ifdef TEUCHOS_DEBUG
00835     default:
00836       TEST_FOR_EXCEPT(true);
00837 #endif
00838   }
00839   return ""; // Should never execute this!
00840 }
00841 
00842 
00843 inline
00844 Thyra::ModelEvaluatorBase::EDerivativeMultiVectorOrientation
00845 Thyra::getOtherDerivativeMultiVectorOrientation(
00846   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00847   )
00848 {
00849   switch(orientation) {
00850     case ModelEvaluatorBase::DERIV_MV_BY_COL:
00851       return ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW;
00852     case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW:
00853       return ModelEvaluatorBase::DERIV_MV_BY_COL;
00854 #ifdef TEUCHOS_DEBUG
00855     default:
00856       TEST_FOR_EXCEPT(true);
00857 #endif
00858   }
00859   return ModelEvaluatorBase::DERIV_MV_BY_COL; // Should never execute this!
00860 }
00861 
00862 
00863 #endif // THYRA_MODEL_EVALUATOR_BASE_DECL_HPP

Generated on Wed May 12 21:26:47 2010 for Thyra ANA Nonlinear Model Evaluator Interfaces by  doxygen 1.4.7