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_W_prec, 
00430     OUT_ARG_f_poly  
00431   };
00433   static const int NUM_E_OUT_ARGS_MEMBERS=5;
00434 
00436   enum EOutArgsDfDp {
00437     OUT_ARG_DfDp   
00438   };
00439 
00441   enum EOutArgsDgDx_dot {
00442     OUT_ARG_DgDx_dot   
00443   };
00444 
00446   enum EOutArgsDgDx {
00447     OUT_ARG_DgDx   
00448   };
00449 
00451   enum EOutArgsDgDp {
00452     OUT_ARG_DgDp   
00453   };
00454   
00475   template<class Scalar>
00476   class OutArgs : public Teuchos::Describable {
00477   public:
00479     OutArgs();
00482     int Np() const;
00485     int Ng() const;
00487     bool supports(EOutArgsMembers arg) const;
00490     const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const;
00493     const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const;
00496     const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const;
00499     const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const;
00501     void set_f( const RCP<VectorBase<Scalar> > &f );
00503     RCP<VectorBase<Scalar> > get_f() const;
00505     void set_g( int j, const RCP<VectorBase<Scalar> > &g_j );
00507     RCP<VectorBase<Scalar> > get_g(int j) const;
00509     void set_W( const RCP<LinearOpWithSolveBase<Scalar> > &W );
00511     RCP<LinearOpWithSolveBase<Scalar> > get_W() const;
00513     void set_W_op( const RCP<LinearOpBase<Scalar> > &W_op );
00515     RCP<LinearOpBase<Scalar> > get_W_op() const;
00517     void set_W_prec( const RCP<PreconditionerBase<Scalar> > &W_prec );
00519     RCP<PreconditionerBase<Scalar> > get_W_prec() const;
00522     DerivativeProperties get_W_properties() const;
00524     void set_DfDp(int l,  const Derivative<Scalar> &DfDp_l);
00526     Derivative<Scalar> get_DfDp(int l) const;
00529     DerivativeProperties get_DfDp_properties(int l) const;
00531     void set_DgDx_dot(int j, const Derivative<Scalar> &DgDx_dot_j);
00533     Derivative<Scalar> get_DgDx_dot(int j) const;
00536     DerivativeProperties get_DgDx_dot_properties(int j) const;
00538     void set_DgDx(int j, const Derivative<Scalar> &DgDx_j);
00540     Derivative<Scalar> get_DgDx(int j) const;
00543     DerivativeProperties get_DgDx_properties(int j) const;
00545     void set_DgDp( int j, int l, const Derivative<Scalar> &DgDp_j_l );
00547     Derivative<Scalar> get_DgDp(int j, int l) const;
00550     DerivativeProperties get_DgDp_properties(int j, int l) const;
00551 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00552 
00553     void set_f_poly( const RCP<Teuchos::Polynomial< VectorBase<Scalar> > > &f_poly );
00555     RCP<Teuchos::Polynomial< VectorBase<Scalar> > > get_f_poly() const;
00556 #endif // HAVE_THYRA_ME_POLYNOMIAL
00557 
00562     void setArgs( const OutArgs<Scalar>& outArgs, bool ignoreUnsupported = false );
00574     void setFailed() const;
00580     bool isFailed() const;
00582     bool isEmpty() const;
00584     void assertSameSupport( const OutArgs<Scalar> &outArgs ) const;
00586     std::string modelEvalDescription() const;
00588     std::string description() const;
00591     void describe(
00592       Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel
00593       ) const;
00594   protected:
00596     void _setModelEvalDescription( const std::string &modelEvalDescription );
00598     void _set_Np_Ng(int Np, int Ng);
00600     void _setSupports( EOutArgsMembers arg, bool supports );
00602     void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& );
00604     void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00606     void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& );
00608     void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00610     void _set_W_properties( const DerivativeProperties &properties );
00612     void _set_DfDp_properties( int l, const DerivativeProperties &properties );
00614     void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00616     void _set_DgDx_properties( int j, const DerivativeProperties &properties );
00618     void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00620     void _setSupports( const OutArgs<Scalar>& inputOutArgs );
00622     void _setUnsupportsAndRelated( EInArgsMembers arg );
00624     void _setUnsupportsAndRelated( EOutArgsMembers arg );
00625   private:
00626     // types
00627     typedef Teuchos::Array<RCP<VectorBase<Scalar> > > g_t;
00628     typedef Teuchos::Array<Derivative<Scalar> > deriv_t;
00629     typedef Teuchos::Array<DerivativeProperties> deriv_properties_t;
00630     typedef Teuchos::Array<DerivativeSupport> supports_t;
00631     // data
00632     std::string modelEvalDescription_;
00633     bool supports_[NUM_E_OUT_ARGS_MEMBERS];
00634     supports_t supports_DfDp_; // Np
00635     supports_t supports_DgDx_dot_; // Ng
00636     supports_t supports_DgDx_; // Ng
00637     supports_t supports_DgDp_; // Ng x Np
00638     RCP<VectorBase<Scalar> > f_;
00639     g_t g_; // Ng
00640     RCP<LinearOpWithSolveBase<Scalar> > W_;
00641     RCP<LinearOpBase<Scalar> > W_op_;
00642     RCP<PreconditionerBase<Scalar> > W_prec_;
00643     DerivativeProperties W_properties_;
00644     deriv_t DfDp_; // Np
00645     deriv_properties_t DfDp_properties_; // Np
00646     deriv_t DgDx_dot_; // Ng
00647     deriv_t DgDx_; // Ng
00648     deriv_properties_t DgDx_dot_properties_; // Ng
00649     deriv_properties_t DgDx_properties_; // Ng
00650     deriv_t DgDp_; // Ng x Np
00651     deriv_properties_t DgDp_properties_; // Ng x Np
00652 #ifdef HAVE_THYRA_ME_POLYNOMIAL
00653    RCP<Teuchos::Polynomial< VectorBase<Scalar> > > f_poly_;
00654 #endif // HAVE_THYRA_ME_POLYNOMIAL
00655     mutable bool isFailed_;
00656     // functions
00657     void assert_supports(EOutArgsMembers arg) const;
00658     void assert_supports(
00659       EOutArgsDfDp arg, int l,
00660       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00661       ) const;
00662     void assert_supports(
00663       EOutArgsDgDx_dot arg, int j,
00664       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00665       ) const;
00666     void assert_supports(
00667       EOutArgsDgDx arg, int j,
00668       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00669       ) const;
00670     void assert_supports(
00671       EOutArgsDgDp arg, int j, int l,
00672       const Derivative<Scalar> &deriv = Derivative<Scalar>()
00673       ) const;
00674     void assert_l(int l) const;
00675     void assert_j(int j) const;
00676   };
00677 
00679 
00680 // Added since at least gcc 3.3.4 does not do the right thing here!
00681 #ifdef HAVE_PROTECTED_NESTED_TEMPLATE_CLASS_ACCESS
00682 protected:
00683 #endif
00684 
00687 
00695   template<class Scalar>
00696   class InArgsSetup : public InArgs<Scalar> {
00697   public:
00699     InArgsSetup();
00701     InArgsSetup( const InArgs<Scalar>& );
00703     void setModelEvalDescription( const std::string &modelEvalDescription );
00705     void set_Np(int Np);
00707     void setSupports( EInArgsMembers arg, bool supports = true );
00709     void setSupports( const InArgs<Scalar>& inputInArgs, const int Np = -1 );
00711     void setUnsupportsAndRelated( EInArgsMembers arg );
00712   };
00713 
00721   template<class Scalar>
00722   class OutArgsSetup : public OutArgs<Scalar> {
00723   public:
00725     OutArgsSetup();
00727     OutArgsSetup( const OutArgs<Scalar>& );
00729     void setModelEvalDescription( const std::string &modelEvalDescription );
00731     void set_Np_Ng(int Np, int Ng);
00733     void setSupports( EOutArgsMembers arg, bool supports = true );
00735     void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& );
00737     void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00739     void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& );
00741     void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00743     void set_W_properties( const DerivativeProperties &properties );
00745     void set_DfDp_properties( int l, const DerivativeProperties &properties );
00747     void set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00749     void set_DgDx_properties( int j, const DerivativeProperties &properties );
00751     void set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00753     void setSupports( const OutArgs<Scalar>& inputOutArgs );
00755     void setUnsupportsAndRelated( EInArgsMembers arg );
00757     void setUnsupportsAndRelated( EOutArgsMembers arg );
00758    };
00759 
00761 
00762 };
00763 
00764 
00766 std::string toString(ModelEvaluatorBase::EInArgsMembers);
00767 
00768 
00770 std::string toString(ModelEvaluatorBase::EOutArgsMembers);
00771 
00772 
00774 std::string toString(
00775   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00776   );
00777 
00778 
00780 ModelEvaluatorBase::EDerivativeMultiVectorOrientation
00781 getOtherDerivativeMultiVectorOrientation(
00782   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00783   );
00784 
00785 
00786 } // namespace Thyra
00787 
00788 
00789 // //////////////////////////////////
00790 // Inline Defintions
00791 
00792 
00793 //
00794 // Thyra_MEB_helper_functions_grp
00795 //
00796 
00797 
00798 inline
00799 std::string Thyra::toString(ModelEvaluatorBase::EInArgsMembers arg)
00800 {
00801   switch(arg) {
00802     case ModelEvaluatorBase::IN_ARG_x_dot:
00803       return "IN_ARG_x_dot";
00804     case ModelEvaluatorBase::IN_ARG_x:
00805       return "IN_ARG_x";
00806     case ModelEvaluatorBase::IN_ARG_x_dot_poly:
00807       return "IN_ARG_x_dot_poly";
00808     case ModelEvaluatorBase::IN_ARG_x_poly:
00809       return "IN_ARG_x_poly";
00810     case ModelEvaluatorBase::IN_ARG_t:
00811       return "IN_ARG_t";
00812     case ModelEvaluatorBase::IN_ARG_alpha:
00813       return "IN_ARG_alpha";
00814     case ModelEvaluatorBase::IN_ARG_beta:
00815       return "IN_ARG_beta";
00816 #ifdef TEUCHOS_DEBUG
00817     default:
00818       TEUCHOS_TEST_FOR_EXCEPT(true);
00819 #endif
00820   }
00821   return ""; // Will never be executed!
00822 }
00823 
00824 
00825 inline
00826 std::string Thyra::toString(ModelEvaluatorBase::EOutArgsMembers arg)
00827 {
00828   switch(arg) {
00829     case ModelEvaluatorBase::OUT_ARG_f:
00830       return "OUT_ARG_f";
00831     case ModelEvaluatorBase::OUT_ARG_W:
00832       return "OUT_ARG_W";
00833     case ModelEvaluatorBase::OUT_ARG_W_op:
00834       return "OUT_ARG_W_op";
00835     case ModelEvaluatorBase::OUT_ARG_W_prec:
00836       return "OUT_ARG_W_prec";
00837     case ModelEvaluatorBase::OUT_ARG_f_poly:
00838       return "OUT_ARG_f_poly";
00839 #ifdef TEUCHOS_DEBUG
00840     default:
00841       TEUCHOS_TEST_FOR_EXCEPT(true);
00842 #endif
00843   }
00844   return ""; // Will never be executed!
00845 }
00846 
00847 
00848 inline
00849 std::string Thyra::toString(
00850   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00851   )
00852 {
00853   switch(orientation) {
00854     case ModelEvaluatorBase::DERIV_MV_BY_COL:
00855       return "DERIV_MV_BY_COL";
00856     case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW:
00857       return "DERIV_TRANS_MV_BY_ROW";
00858 #ifdef TEUCHOS_DEBUG
00859     default:
00860       TEUCHOS_TEST_FOR_EXCEPT(true);
00861 #endif
00862   }
00863   return ""; // Should never execute this!
00864 }
00865 
00866 
00867 inline
00868 Thyra::ModelEvaluatorBase::EDerivativeMultiVectorOrientation
00869 Thyra::getOtherDerivativeMultiVectorOrientation(
00870   ModelEvaluatorBase::EDerivativeMultiVectorOrientation orientation
00871   )
00872 {
00873   switch(orientation) {
00874     case ModelEvaluatorBase::DERIV_MV_BY_COL:
00875       return ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW;
00876     case ModelEvaluatorBase::DERIV_TRANS_MV_BY_ROW:
00877       return ModelEvaluatorBase::DERIV_MV_BY_COL;
00878 #ifdef TEUCHOS_DEBUG
00879     default:
00880       TEUCHOS_TEST_FOR_EXCEPT(true);
00881 #endif
00882   }
00883   return ModelEvaluatorBase::DERIV_MV_BY_COL; // Should never execute this!
00884 }
00885 
00886 
00887 #endif // THYRA_MODEL_EVALUATOR_BASE_DECL_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines