Thyra Version of the Day
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 // 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 Roscoe A. Bartlett (bartlettra@ornl.gov) 
00038 // 
00039 // ***********************************************************************
00040 // @HEADER
00041 
00042 #ifndef THYRA_MODEL_EVALUATOR_BASE_DECL_HPP
00043 #define THYRA_MODEL_EVALUATOR_BASE_DECL_HPP
00044 
00045 
00046 #include "Thyra_LinearOpWithSolveBase.hpp"
00047 #include "Teuchos_Describable.hpp"
00048 #include "Teuchos_Assert.hpp"
00049 
00050 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00051 #  include "Teuchos_Polynomial.hpp"
00052 #endif
00053 
00054 
00055 namespace Thyra {
00056 
00057 
00077 class ModelEvaluatorBase
00078   : virtual public Teuchos::Describable,
00079     virtual public Teuchos::VerboseObject<ModelEvaluatorBase>
00080 {
00081 public:
00082 
00085 
00087   enum EInArgsMembers {
00088     IN_ARG_x_dot 
00089     ,IN_ARG_x 
00090     ,IN_ARG_x_dot_poly 
00091     ,IN_ARG_x_poly 
00092     ,IN_ARG_t 
00093     ,IN_ARG_alpha 
00094     ,IN_ARG_beta 
00095   };
00097   static const int NUM_E_IN_ARGS_MEMBERS=7;
00098 
00109   template<class Scalar>
00110   class InArgs : public Teuchos::Describable {
00111   public:
00113     typedef typename Teuchos::ScalarTraits<Scalar>::magnitudeType ScalarMag;
00115     InArgs();
00118     int Np() const;
00120     bool supports(EInArgsMembers arg) const;
00122     void set_x_dot( const RCP<const VectorBase<Scalar> > &x_dot );
00124     RCP<const VectorBase<Scalar> > get_x_dot() const;
00126     void set_x( const RCP<const VectorBase<Scalar> > &x );
00128     RCP<const VectorBase<Scalar> > get_x() const;
00129 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00130 
00131     void set_x_poly( 
00132       const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_poly );
00134     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > get_x_poly() const;
00136     void set_x_dot_poly(
00137       const RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > &x_dot_poly );
00139     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > get_x_dot_poly() const;
00140 #endif // HAVE_THYRA_ME_POLYNOMIAL
00141 
00142     void set_p( int l, const RCP<const VectorBase<Scalar> > &p_l );
00144     RCP<const VectorBase<Scalar> > get_p(int l) const;
00146     void set_t( ScalarMag t );
00148     ScalarMag get_t() const;
00150     void set_alpha( Scalar alpha );
00152     Scalar get_alpha() const;
00154     void set_beta( Scalar beta );
00156     Scalar get_beta() const;
00159     void setArgs(
00160       const InArgs<Scalar>& inArgs, bool ignoreUnsupported = false,
00161       bool cloneObjects = false
00162       );
00164     void assertSameSupport( const InArgs<Scalar> &inArgs ) const;
00166     std::string modelEvalDescription() const;
00168     std::string description() const;
00171     void describe(
00172       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00173       ) const;
00174   protected:
00176     void _setModelEvalDescription( const std::string &modelEvalDescription );
00178     void _set_Np(int Np);
00180     void _setSupports( EInArgsMembers arg, bool supports );
00182     void _setSupports( const InArgs<Scalar>& inputInArgs, const int Np );
00184     void _setUnsupportsAndRelated( EInArgsMembers arg );
00185   private:
00186     // types
00187     typedef Teuchos::Array<RCP<const VectorBase<Scalar> > > p_t;
00188     // data
00189     std::string modelEvalDescription_;
00190     RCP<const VectorBase<Scalar> > x_dot_;
00191     RCP<const VectorBase<Scalar> > x_;
00192 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00193     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > x_dot_poly_;
00194     RCP<const Teuchos::Polynomial< VectorBase<Scalar> > > x_poly_;
00195 #endif // HAVE_THYRA_ME_POLYNOMIAL
00196     p_t p_;
00197     ScalarMag t_;
00198     Scalar alpha_;
00199     Scalar beta_;
00200     bool supports_[NUM_E_IN_ARGS_MEMBERS];
00201     // functions
00202     void assert_supports(EInArgsMembers arg) const;
00203     void assert_l(int l) const;
00204   };
00205 
00207   enum EDerivativeMultiVectorOrientation {
00208     DERIV_MV_JACOBIAN_FORM, 
00209     DERIV_MV_GRADIENT_FORM, 
00210     DERIV_MV_BY_COL = DERIV_MV_JACOBIAN_FORM, 
00211     DERIV_TRANS_MV_BY_ROW = DERIV_MV_GRADIENT_FORM 
00212   };
00213 
00215   enum EDerivativeLinearOp {
00216     DERIV_LINEAR_OP 
00217   };
00218 
00221   class DerivativeSupport {
00222   public:
00224     DerivativeSupport()
00225       :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false)
00226       {}
00228     DerivativeSupport( EDerivativeLinearOp )
00229       :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false)
00230       {}
00232     DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation )
00233       :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00234       ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00235       {}
00237     DerivativeSupport& plus(EDerivativeLinearOp)
00238       { supportsLinearOp_ = true; return *this; }
00240     DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation)
00241       {
00242         switch(mvOrientation) {
00243           case DERIV_MV_BY_COL: supportsMVByCol_ = true; break;
00244           case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break;
00245           default: TEUCHOS_TEST_FOR_EXCEPT(true);
00246         }
00247         return *this;
00248       }
00250     bool none() const
00251       { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); }
00253     bool supports(EDerivativeLinearOp) const
00254       { return supportsLinearOp_; }
00256     bool supports(EDerivativeMultiVectorOrientation mvOrientation) const
00257       {
00258         switch(mvOrientation) {
00259           case DERIV_MV_BY_COL: return supportsMVByCol_;
00260           case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_;
00261           default: TEUCHOS_TEST_FOR_EXCEPT(true);
00262         }
00263         return false; // Will never be called!
00264       }
00266     bool isSameSupport(const DerivativeSupport &derivSupport) const
00267       {
00268         return (
00269           supportsLinearOp_ == derivSupport.supportsLinearOp_
00270           && supportsMVByCol_ == derivSupport.supportsMVByCol_
00271           && supportsTransMVByRow_ == derivSupport.supportsTransMVByRow_
00272           );
00273       } 
00275     std::string description() const;
00276   private:
00277     bool supportsLinearOp_;
00278     bool supportsMVByCol_;
00279     bool supportsTransMVByRow_;
00280   public:
00281   };
00282   
00284   enum EDerivativeLinearity {
00285     DERIV_LINEARITY_UNKNOWN      
00286     ,DERIV_LINEARITY_CONST       
00287     ,DERIV_LINEARITY_NONCONST    
00288   };
00289 
00291   enum ERankStatus {
00292     DERIV_RANK_UNKNOWN       
00293     ,DERIV_RANK_FULL         
00294     ,DERIV_RANK_DEFICIENT    
00295   };
00296 
00299   struct DerivativeProperties {
00301     EDerivativeLinearity     linearity;
00303     ERankStatus              rank;
00305     bool                     supportsAdjoint;
00307     DerivativeProperties()
00308       :linearity(DERIV_LINEARITY_UNKNOWN),
00309        rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false)
00310       {}
00312     DerivativeProperties(
00313       EDerivativeLinearity in_linearity, ERankStatus in_rank,
00314       bool in_supportsAdjoint
00315       )
00316       :linearity(in_linearity),rank(in_rank),
00317        supportsAdjoint(in_supportsAdjoint)
00318       {}
00319   };
00320 
00324   template<class Scalar>
00325   class DerivativeMultiVector {
00326   public:
00328     DerivativeMultiVector()
00329       :orientation_(DERIV_MV_BY_COL)
00330       {}
00332     DerivativeMultiVector(
00333       const RCP<MultiVectorBase<Scalar> > &mv
00334       ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00335       ) : mv_(mv.assert_not_null()), orientation_(orientation) {}
00337     void changeOrientation( const EDerivativeMultiVectorOrientation orientation )
00338       { orientation_ = orientation; };
00340     const DerivativeMultiVector<Scalar>& assert_not_null() const
00341       { mv_.assert_not_null(); return *this; }
00343     RCP<MultiVectorBase<Scalar> > getMultiVector() const
00344       { return mv_; }
00346     EDerivativeMultiVectorOrientation getOrientation() const
00347       { return orientation_; }
00349     std::string description() const;
00351     void describe( 
00352       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00353       ) const;
00354   private:
00355     RCP<MultiVectorBase<Scalar> > mv_;
00356     EDerivativeMultiVectorOrientation orientation_;
00357   };
00358 
00362   template<class Scalar>
00363   class Derivative {
00364   public:
00366     Derivative() {}
00368     Derivative( const RCP<LinearOpBase<Scalar> > &lo )
00369       : lo_(lo.assert_not_null()) {}
00371     Derivative(
00372       const RCP<MultiVectorBase<Scalar> > &mv,
00373       const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00374       ) : dmv_(mv,orientation) {}
00376     Derivative( const DerivativeMultiVector<Scalar> &dmv )
00377       : dmv_(dmv) {}
00379     bool isEmpty() const
00380       { return ( lo_.get()==NULL && dmv_.getMultiVector().get()==NULL ); }
00382     const Derivative<Scalar>& assert_not_null() const
00383       { dmv_.assert_not_null(); lo_.assert_not_null(); return *this; }
00385     RCP<LinearOpBase<Scalar> > getLinearOp() const
00386       { return lo_; }
00388     RCP<MultiVectorBase<Scalar> > getMultiVector() const
00389       { return dmv_.getMultiVector(); }
00391     EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
00392       { return dmv_.getOrientation(); }
00394     DerivativeMultiVector<Scalar> getDerivativeMultiVector() const
00395       { return dmv_; }
00399     bool isSupportedBy( const DerivativeSupport &derivSupport ) const
00400       {
00401         // If there is not derivative support then we will return false!
00402         if (derivSupport.none())
00403           return false;
00404         if (!is_null(getMultiVector())) {
00405           return derivSupport.supports(getMultiVectorOrientation());
00406         }
00407         else if(!is_null(getLinearOp())) {
00408           return derivSupport.supports(DERIV_LINEAR_OP);
00409         }
00410         // If nothing is set then of course we support that!
00411         return true;
00412       }
00414     std::string description() const;
00416     void describe( 
00417       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00418       ) const;
00419   private:
00420     RCP<LinearOpBase<Scalar> > lo_;
00421     DerivativeMultiVector<Scalar> dmv_;
00422   };
00423 
00425   enum EOutArgsMembers {
00426     OUT_ARG_f       
00427     ,OUT_ARG_W      
00428     ,OUT_ARG_W_op   
00429     ,OUT_ARG_f_poly 
00430   };
00432   static const int NUM_E_OUT_ARGS_MEMBERS=4;
00433 
00435   enum EOutArgsDfDp {
00436     OUT_ARG_DfDp   
00437   };
00438 
00440   enum EOutArgsDgDx_dot {
00441     OUT_ARG_DgDx_dot   
00442   };
00443 
00445   enum EOutArgsDgDx {
00446     OUT_ARG_DgDx   
00447   };
00448 
00450   enum EOutArgsDgDp {
00451     OUT_ARG_DgDp   
00452   };
00453   
00474   template<class Scalar>
00475   class OutArgs : public Teuchos::Describable {
00476   public:
00478     OutArgs();
00481     int Np() const;
00484     int Ng() const;
00486     bool supports(EOutArgsMembers arg) const;
00489     const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const;
00492     const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const;
00495     const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const;
00498     const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const;
00500     void set_f( const RCP<VectorBase<Scalar> > &f );
00502     RCP<VectorBase<Scalar> > get_f() const;
00504     void set_g( int j, const RCP<VectorBase<Scalar> > &g_j );
00506     RCP<VectorBase<Scalar> > get_g(int j) const;
00508     void set_W( const RCP<LinearOpWithSolveBase<Scalar> > &W );
00510     RCP<LinearOpWithSolveBase<Scalar> > get_W() const;
00512     void set_W_op( const RCP<LinearOpBase<Scalar> > &W_op );
00514     RCP<LinearOpBase<Scalar> > get_W_op() const;
00517     DerivativeProperties get_W_properties() const;
00519     void set_DfDp(int l,  const Derivative<Scalar> &DfDp_l);
00521     Derivative<Scalar> get_DfDp(int l) const;
00524     DerivativeProperties get_DfDp_properties(int l) const;
00526     void set_DgDx_dot(int j, const Derivative<Scalar> &DgDx_dot_j);
00528     Derivative<Scalar> get_DgDx_dot(int j) const;
00531     DerivativeProperties get_DgDx_dot_properties(int j) const;
00533     void set_DgDx(int j, const Derivative<Scalar> &DgDx_j);
00535     Derivative<Scalar> get_DgDx(int j) const;
00538     DerivativeProperties get_DgDx_properties(int j) const;
00540     void set_DgDp( int j, int l, const Derivative<Scalar> &DgDp_j_l );
00542     Derivative<Scalar> get_DgDp(int j, int l) const;
00545     DerivativeProperties get_DgDp_properties(int j, int l) const;
00546 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00547 
00548     void set_f_poly( const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly );
00550     RCP<Teuchos::Polynomial< VectorBase<Scalar> > > get_f_poly() const;
00551 #endif // HAVE_THYRA_ME_POLYNOMIAL
00552 
00557     void setArgs( const OutArgs<Scalar>& outArgs, bool ignoreUnsupported = false );
00569     void setFailed() const;
00575     bool isFailed() const;
00577     bool isEmpty() const;
00579     void assertSameSupport( const OutArgs<Scalar> &outArgs ) const;
00581     std::string modelEvalDescription() const;
00583     std::string description() const;
00586     void describe(
00587       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00588       ) const;
00589   protected:
00591     void _setModelEvalDescription( const std::string &modelEvalDescription );
00593     void _set_Np_Ng(int Np, int Ng);
00595     void _setSupports( EOutArgsMembers arg, bool supports );
00597     void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& );
00599     void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00601     void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& );
00603     void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00605     void _set_W_properties( const DerivativeProperties &properties );
00607     void _set_DfDp_properties( int l, const DerivativeProperties &properties );
00609     void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00611     void _set_DgDx_properties( int j, const DerivativeProperties &properties );
00613     void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00615     void _setSupports( const OutArgs<Scalar>& inputOutArgs );
00617     void _setUnsupportsAndRelated( EInArgsMembers arg );
00619     void _setUnsupportsAndRelated( EOutArgsMembers arg );
00620   private:
00621     // types
00622     typedef Teuchos::Array<RCP<VectorBase<Scalar> > > g_t;
00623     typedef Teuchos::Array<Derivative<Scalar> > deriv_t;
00624     typedef Teuchos::Array<DerivativeProperties> deriv_properties_t;
00625     typedef Teuchos::Array<DerivativeSupport> supports_t;
00626     // data
00627     std::string modelEvalDescription_;
00628     bool supports_[NUM_E_OUT_ARGS_MEMBERS];
00629     supports_t supports_DfDp_; // Np
00630     supports_t supports_DgDx_dot_; // Ng
00631     supports_t supports_DgDx_; // Ng
00632     supports_t supports_DgDp_; // Ng x Np
00633     RCP<VectorBase<Scalar> > f_;
00634     g_t g_; // Ng
00635     RCP<LinearOpWithSolveBase<Scalar> > W_;
00636     RCP<LinearOpBase<Scalar> > W_op_;
00637     DerivativeProperties W_properties_;
00638     deriv_t DfDp_; // Np
00639     deriv_properties_t DfDp_properties_; // Np
00640     deriv_t DgDx_dot_; // Ng
00641     deriv_t DgDx_; // Ng
00642     deriv_properties_t DgDx_dot_properties_; // Ng
00643     deriv_properties_t DgDx_properties_; // Ng
00644     deriv_t DgDp_; // Ng x Np
00645     deriv_properties_t DgDp_properties_; // Ng x Np
00646 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00647    RCP<Teuchos::Polynomial< VectorBase<Scalar> > > f_poly_;
00648 #endif // HAVE_THYRA_ME_POLYNOMIAL
00649     mutable bool isFailed_;
00650     // functions
00651     void assert_supports(EOutArgsMembers arg) const;
00652     void assert_supports(
00653       EOutArgsDfDp arg, int l,
00654       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00655       ) const;
00656     void assert_supports(
00657       EOutArgsDgDx_dot arg, int j,
00658       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00659       ) const;
00660     void assert_supports(
00661       EOutArgsDgDx arg, int j,
00662       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00663       ) const;
00664     void assert_supports(
00665       EOutArgsDgDp arg, int j, int l,
00666       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00667       ) const;
00668     void assert_l(int l) const;
00669     void assert_j(int j) const;
00670   };
00671 
00673 
00674 // Added since at least gcc 3.3.4 does not do the right thing here!
00675 #ifdef HAVE_PROTECTED_NESTED_TEMPLATE_CLASS_ACCESS
00676 protected:
00677 #endif
00678 
00681 
00689   template<class Scalar>
00690   class InArgsSetup : public InArgs<Scalar> {
00691   public:
00693     InArgsSetup();
00695     InArgsSetup( const InArgs<Scalar>& );
00697     void setModelEvalDescription( const std::string &modelEvalDescription );
00699     void set_Np(int Np);
00701     void setSupports( EInArgsMembers arg, bool supports = true );
00703     void setSupports( const InArgs<Scalar>& inputInArgs, const int Np = -1 );
00705     void setUnsupportsAndRelated( EInArgsMembers arg );
00706   };
00707 
00715   template<class Scalar>
00716   class OutArgsSetup : public OutArgs<Scalar> {
00717   public:
00719     OutArgsSetup();
00721     OutArgsSetup( const OutArgs<Scalar>& );
00723     void setModelEvalDescription( const std::string &modelEvalDescription );
00725     void set_Np_Ng(int Np, int Ng);
00727     void setSupports( EOutArgsMembers arg, bool supports = true );
00729     void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& );
00731     void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00733     void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& );
00735     void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00737     void set_W_properties( const DerivativeProperties &properties );
00739     void set_DfDp_properties( int l, const DerivativeProperties &properties );
00741     void set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00743     void set_DgDx_properties( int j, const DerivativeProperties &properties );
00745     void set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00747     void setSupports( const OutArgs<Scalar>& inputOutArgs );
00749     void setUnsupportsAndRelated( EInArgsMembers arg );
00751     void setUnsupportsAndRelated( EOutArgsMembers arg );
00752    };
00753 
00755 
00756 };
00757 
00758 
00760 std::string toString(ModelEvaluatorBase::EInArgsMembers);
00761 
00762 
00764 std::string toString(ModelEvaluatorBase::EOutArgsMembers);
00765 
00766 
00768 std::string toString(
00769   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00770   );
00771 
00772 
00774 ModelEvaluatorBase::EDerivativeMultiVectorOrientation
00775 getOtherDerivativeMultiVectorOrientation(
00776   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00777   );
00778 
00779 
00780 } // namespace Thyra
00781 
00782 
00783 // //////////////////////////////////
00784 // Inline Defintions
00785 
00786 
00787 //
00788 // Thyra_MEB_helper_functions_grp
00789 //
00790 
00791 
00792 inline
00793 std::string Thyra::toString(ModelEvaluatorBase::EInArgsMembers arg)
00794 {
00795   switch(arg) {
00796     case ModelEvaluatorBase::IN_ARG_x_dot:
00797       return "IN_ARG_x_dot";
00798     case ModelEvaluatorBase::IN_ARG_x:
00799       return "IN_ARG_x";
00800     case ModelEvaluatorBase::IN_ARG_x_dot_poly:
00801       return "IN_ARG_x_dot_poly";
00802     case ModelEvaluatorBase::IN_ARG_x_poly:
00803       return "IN_ARG_x_poly";
00804     case ModelEvaluatorBase::IN_ARG_t:
00805       return "IN_ARG_t";
00806     case ModelEvaluatorBase::IN_ARG_alpha:
00807       return "IN_ARG_alpha";
00808     case ModelEvaluatorBase::IN_ARG_beta:
00809       return "IN_ARG_beta";
00810 #ifdef TEUCHOS_DEBUG
00811     default:
00812       TEUCHOS_TEST_FOR_EXCEPT(true);
00813 #endif
00814   }
00815   return ""; // Will never be executed!
00816 }
00817 
00818 
00819 inline
00820 std::string Thyra::toString(ModelEvaluatorBase::EOutArgsMembers arg)
00821 {
00822   switch(arg) {
00823     case ModelEvaluatorBase::OUT_ARG_f:
00824       return "OUT_ARG_f";
00825     case ModelEvaluatorBase::OUT_ARG_W:
00826       return "OUT_ARG_W";
00827     case ModelEvaluatorBase::OUT_ARG_W_op:
00828       return "OUT_ARG_W_op";
00829     case ModelEvaluatorBase::OUT_ARG_f_poly:
00830       return "OUT_ARG_f_poly";
00831 #ifdef TEUCHOS_DEBUG
00832     default:
00833       TEUCHOS_TEST_FOR_EXCEPT(true);
00834 #endif
00835   }
00836   return ""; // Will never be executed!
00837 }
00838 
00839 
00840 inline
00841 std::string Thyra::toString(
00842   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00843   )
00844 {
00845   switch(orientation) {
00846     case ModelEvaluatorBase::DERIV_MV_BY_COL:
00847       return "DERIV_MV_BY_COL";
00848     case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW:
00849       return "DERIV_TRANS_MV_BY_ROW";
00850 #ifdef TEUCHOS_DEBUG
00851     default:
00852       TEUCHOS_TEST_FOR_EXCEPT(true);
00853 #endif
00854   }
00855   return ""; // Should never execute this!
00856 }
00857 
00858 
00859 inline
00860 Thyra::ModelEvaluatorBase::EDerivativeMultiVectorOrientation
00861 Thyra::getOtherDerivativeMultiVectorOrientation(
00862   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00863   )
00864 {
00865   switch(orientation) {
00866     case ModelEvaluatorBase::DERIV_MV_BY_COL:
00867       return ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW;
00868     case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW:
00869       return ModelEvaluatorBase::DERIV_MV_BY_COL;
00870 #ifdef TEUCHOS_DEBUG
00871     default:
00872       TEUCHOS_TEST_FOR_EXCEPT(true);
00873 #endif
00874   }
00875   return ModelEvaluatorBase::DERIV_MV_BY_COL; // Should never execute this!
00876 }
00877 
00878 
00879 #endif // THYRA_MODEL_EVALUATOR_BASE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines