EpetraExt_ModelEvaluator.h

Go to the documentation of this file.
00001 // @HEADER
00002 // ***********************************************************************
00003 // 
00004 //     EpetraExt: Epetra Extended - Linear Algebra Services Package
00005 //                 Copyright (2001) 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 EPETRA_EXT_MODEL_EVALUATOR_HPP
00030 #define EPETRA_EXT_MODEL_EVALUATOR_HPP
00031 
00032 #include "EpetraExt_ConfigDefs.h"
00033 #include "Teuchos_RefCountPtr.hpp"
00034 #include "Teuchos_Describable.hpp"
00035 #include "Teuchos_Polynomial.hpp"
00036 #include "EpetraExt_PolynomialVectorTraits.h"
00037 
00038 class Epetra_Map;
00039 class Epetra_Vector;
00040 class Epetra_Operator;
00041 
00042 namespace EpetraExt {
00043 
00048 class ModelEvaluator : virtual public Teuchos::Describable {
00049 public:
00050 
00053 
00055   enum EInArgsMembers {
00056     IN_ARG_x_dot
00057     ,IN_ARG_x
00058     ,IN_ARG_x_dot_poly 
00059     ,IN_ARG_x_poly 
00060     ,IN_ARG_t
00061     ,IN_ARG_alpha
00062     ,IN_ARG_beta
00063   };
00064   static const int NUM_E_IN_ARGS_MEMBERS=7;
00065 
00067   class InArgs {
00068   public:
00070     InArgs();
00072     std::string modelEvalDescription() const;
00074     int Np() const;
00076     void set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot );
00078     Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot() const;
00080     void set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x );
00082     Teuchos::RefCountPtr<const Epetra_Vector> get_x() const;
00083     void set_x_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly );
00085     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_poly() const;
00087     void set_x_dot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly );
00089     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dot_poly() const;
00091     void set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l );
00093     Teuchos::RefCountPtr<const Epetra_Vector> get_p(int l) const;
00095     void set_t( double t );
00097     double get_alpha() const;
00099     void set_alpha( double alpha );
00101     double get_beta() const;
00103     void set_beta( double beta );
00105     double get_t() const;
00107     bool supports(EInArgsMembers arg) const;
00108   protected:
00110     void _setModelEvalDescription( const std::string &modelEvalDescription );
00112     void _set_Np(int Np);
00114     void _setSupports( EInArgsMembers arg, bool supports );
00115   private:
00116     // types
00117     typedef std::vector<Teuchos::RefCountPtr<const Epetra_Vector> > p_t;
00118     // data
00119     std::string                                modelEvalDescription_;
00120     Teuchos::RefCountPtr<const Epetra_Vector>  x_dot_;
00121     Teuchos::RefCountPtr<const Epetra_Vector>  x_;
00122     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dot_poly_;
00123     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_poly_;
00124     p_t                                        p_;
00125     double                                     t_;
00126     double                                     alpha_;
00127     double                                     beta_;
00128     bool supports_[NUM_E_IN_ARGS_MEMBERS];
00129     // functions
00130     void assert_supports(EInArgsMembers arg) const;
00131     void assert_l(int l) const;
00132   };
00133 
00135   enum EEvalType {
00136     EVAL_TYPE_EXACT                
00137     ,EVAL_TYPE_APPROX_DERIV        
00138     ,EVAL_TYPE_VERY_APPROX_DERIV   
00139   };
00140 
00142   template<class ObjType>
00143   class Evaluation : public Teuchos::RefCountPtr<ObjType> {
00144   public:
00146     Evaluation() : evalType_(EVAL_TYPE_EXACT) {}
00148     Evaluation( const Teuchos::RefCountPtr<ObjType> &obj )
00149       : Teuchos::RefCountPtr<ObjType>(obj), evalType_(EVAL_TYPE_EXACT) {}
00151     Evaluation( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType )
00152       : Teuchos::RefCountPtr<ObjType>(obj), evalType_(evalType) {}
00154     EEvalType getType() const { return evalType_; }
00156     void reset( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType ) 
00157     { this->operator=(obj); evalType_ = evalType; }
00158   private:
00159     EEvalType                      evalType_;
00160   };
00161   
00163   enum EDerivativeMultiVectorOrientation {
00164     DERIV_MV_BY_COL           
00165     ,DERIV_TRANS_MV_BY_ROW    
00166   };
00167 
00169   enum EDerivativeLinearOp { DERIV_LINEAR_OP };
00170 
00172   class DerivativeSupport {
00173   public:
00175     DerivativeSupport()
00176       :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false)
00177       {}
00179     DerivativeSupport( EDerivativeLinearOp )
00180       :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false)
00181       {}
00183     DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation )
00184       :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00185       ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00186       {}
00188     DerivativeSupport( EDerivativeLinearOp, EDerivativeMultiVectorOrientation mvOrientation )
00189       :supportsLinearOp_(true), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00190       ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00191       {}
00193     DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation1, EDerivativeMultiVectorOrientation mvOrientation2 )
00194       :supportsLinearOp_(false)
00195       ,supportsMVByCol_(mvOrientation1==DERIV_MV_BY_COL||mvOrientation2==DERIV_MV_BY_COL)
00196       ,supportsTransMVByRow_(mvOrientation1==DERIV_TRANS_MV_BY_ROW||mvOrientation2==DERIV_TRANS_MV_BY_ROW)
00197       {}
00199     DerivativeSupport& plus(EDerivativeLinearOp)
00200       { supportsLinearOp_ = true; return *this; }
00202     DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation)
00203       {
00204         switch(mvOrientation) {
00205           case DERIV_MV_BY_COL: supportsMVByCol_ = true; break;
00206           case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break;
00207           default: TEST_FOR_EXCEPT(true);
00208         }
00209         return *this;
00210       }
00212     bool none() const
00213       { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); }
00215     bool supports(EDerivativeLinearOp) const
00216       { return supportsLinearOp_; }
00218     bool supports(EDerivativeMultiVectorOrientation mvOrientation) const
00219       {
00220         switch(mvOrientation) {
00221           case DERIV_MV_BY_COL: return supportsMVByCol_;
00222           case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_;
00223           default: TEST_FOR_EXCEPT(true);
00224         }
00225         return false; // Will never be called!
00226       }
00227   private:
00228     bool supportsLinearOp_;
00229     bool supportsMVByCol_;
00230     bool supportsTransMVByRow_;
00231   public:
00232   };
00233 
00235   enum EDerivativeLinearity {
00236     DERIV_LINEARITY_UNKNOWN      
00237     ,DERIV_LINEARITY_CONST       
00238     ,DERIV_LINEARITY_NONCONST    
00239   };
00241   enum ERankStatus {
00242     DERIV_RANK_UNKNOWN       
00243     ,DERIV_RANK_FULL         
00244     ,DERIV_RANK_DEFICIENT    
00245   };
00246 
00248   struct DerivativeProperties {
00250     EDerivativeLinearity     linearity;
00252     ERankStatus              rank;
00254     bool                     supportsAdjoint;
00256     DerivativeProperties()
00257       :linearity(DERIV_LINEARITY_UNKNOWN),rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) {}
00259     DerivativeProperties(
00260       EDerivativeLinearity in_linearity, ERankStatus in_rank, bool in_supportsAdjoint
00261       ):linearity(in_linearity),rank(in_rank),supportsAdjoint(in_supportsAdjoint) {}
00262   };
00263 
00267   class DerivativeMultiVector {
00268   public:
00270     DerivativeMultiVector() {}
00272     DerivativeMultiVector(
00273       const Teuchos::RefCountPtr<Epetra_MultiVector>  &mv
00274       ,const EDerivativeMultiVectorOrientation        orientation = DERIV_MV_BY_COL
00275       ) : mv_(mv), orientation_(orientation) {}
00277     void changeOrientation( const EDerivativeMultiVectorOrientation orientation )
00278       { orientation_ = orientation; };
00280     Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const
00281       { return mv_; }
00283     EDerivativeMultiVectorOrientation getOrientation() const
00284       { return orientation_; }
00285   private:
00286     Teuchos::RefCountPtr<Epetra_MultiVector>   mv_;
00287     EDerivativeMultiVectorOrientation          orientation_;
00288   };
00289 
00293   class Derivative {
00294   public:
00296     Derivative() {}
00298     Derivative( const Teuchos::RefCountPtr<Epetra_Operator> &lo )
00299       : lo_(lo) {}
00301     Derivative( const DerivativeMultiVector &dmv )
00302       : dmv_(dmv) {}
00304     Teuchos::RefCountPtr<Epetra_Operator> getLinearOp() const
00305       { return lo_; }
00307     DerivativeMultiVector getDerivativeMultiVector() const
00308       { return dmv_; }
00310     bool isEmpty() const
00311         { return !lo_.get() && !dmv_.getMultiVector().get(); }
00312   private:
00313     Teuchos::RefCountPtr<Epetra_Operator>   lo_;
00314     DerivativeMultiVector                   dmv_;
00315   };
00316 
00318   enum EOutArgsMembers {
00319     OUT_ARG_f
00320     ,OUT_ARG_W
00321     ,OUT_ARG_f_poly
00322   };
00323   static const int NUM_E_OUT_ARGS_MEMBERS=3;
00324 
00326   enum EOutArgsDfDp {
00327     OUT_ARG_DfDp   
00328   };
00329 
00331   enum EOutArgsDgDx {
00332     OUT_ARG_DgDx   
00333   };
00334 
00336   enum EOutArgsDgDp {
00337     OUT_ARG_DgDp   
00338   };
00339 
00341   class OutArgs {
00342   public:
00344     OutArgs();
00346     std::string modelEvalDescription() const;
00348     int Np() const;
00350     int Ng() const;
00352     bool supports(EOutArgsMembers arg) const;
00354     const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const;
00356     const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const;
00358     const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const;
00360     void set_f( const Evaluation<Epetra_Vector> &f );
00362     Evaluation<Epetra_Vector> get_f() const;
00364     void set_g( int j, const Evaluation<Epetra_Vector> &g_j );
00366     Evaluation<Epetra_Vector> get_g(int j) const;
00368     void set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W );
00370     Teuchos::RefCountPtr<Epetra_Operator> get_W() const;
00372     DerivativeProperties get_W_properties() const;
00374     void set_DfDp(int l,  const Derivative &DfDp_l);
00376     Derivative get_DfDp(int l) const;
00378     DerivativeProperties get_DfDp_properties(int l) const;
00380     void set_DgDx(int j, const Derivative &DgDx_j);
00382     Derivative get_DgDx(int j) const;
00384     DerivativeProperties get_DgDx_properties(int j) const;
00386     void set_DgDp( int j, int l, const Derivative &DgDp_j_l );
00388     Derivative get_DgDp(int j, int l) const;
00390     DerivativeProperties get_DgDp_properties(int j, int l) const;
00392     void set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly );
00394     Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > get_f_poly() const;
00395   protected:
00397     void _setModelEvalDescription( const std::string &modelEvalDescription );
00399     void _set_Np_Ng(int Np, int Ng);
00401     void _setSupports( EOutArgsMembers arg, bool supports );
00403     void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& );
00405     void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& );
00407     void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00409     void _set_W_properties( const DerivativeProperties &W_properties );
00411     void _set_DfDp_properties( int l, const DerivativeProperties &properties );
00413     void _set_DgDx_properties( int j, const DerivativeProperties &properties );
00415     void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00416   private:
00417     // types
00418     typedef std::vector<Evaluation<Epetra_Vector> >           g_t;
00419     typedef std::vector<Derivative>                           deriv_t;
00420     typedef std::vector<DerivativeProperties>                 deriv_properties_t;
00421     typedef std::vector<DerivativeSupport>                    supports_t;
00422     // data
00423     std::string                            modelEvalDescription_;
00424     bool                                   supports_[NUM_E_OUT_ARGS_MEMBERS];
00425     supports_t                             supports_DfDp_;   // Np
00426     supports_t                             supports_DgDx_;   // Ng
00427     supports_t                             supports_DgDp_;   // Ng x Np
00428     Evaluation<Epetra_Vector>              f_;
00429     g_t                                    g_;
00430     Teuchos::RefCountPtr<Epetra_Operator>  W_;
00431     DerivativeProperties                   W_properties_;
00432     deriv_t                                DfDp_;            // Np
00433     deriv_properties_t                     DfDp_properties_; // Np
00434     deriv_t                                DgDx_;            // Ng
00435     deriv_properties_t                     DgDx_properties_; // Ng
00436     deriv_t                                DgDp_;            // Ng x Np
00437     deriv_properties_t                     DgDp_properties_; // Ng x Np
00438     Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > f_poly_;
00439     // functions
00440     void assert_supports(EOutArgsMembers arg) const;
00441     void assert_supports(EOutArgsDfDp arg, int l) const;
00442     void assert_supports(EOutArgsDgDx arg, int j) const;
00443     void assert_supports(EOutArgsDgDp arg, int j, int l) const;
00444     void assert_l(int l) const;
00445     void assert_j(int j) const;
00446   };
00447 
00449 
00452 
00454   virtual ~ModelEvaluator();
00455 
00457 
00460 
00462   virtual Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const = 0;
00463 
00465   virtual Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const = 0;
00466 
00468   virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const;
00469 
00471   virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const;
00472 
00474 
00477 
00479   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const;
00480 
00482   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot_init() const;
00483 
00485   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const;
00486 
00488   virtual double get_t_init() const;
00489 
00491 
00494 
00496   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds() const;
00497 
00499   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds() const;
00500 
00502   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(int l) const;
00503 
00505   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(int l) const;
00506 
00508   virtual double get_t_lower_bound() const;
00509 
00511   virtual double get_t_upper_bound() const;
00512 
00514 
00517 
00524   virtual Teuchos::RefCountPtr<Epetra_Operator> create_W() const;
00525 
00527   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(int l) const;
00528 
00529   // ToDo: Add functions for creating D(g(j))/D(x_dot) if needed!
00530 
00532   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_op(int j) const;
00533 
00535   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_op( int j, int l ) const;
00536 
00538 
00541 
00543   virtual InArgs createInArgs() const = 0;
00544 
00546   virtual OutArgs createOutArgs() const = 0;
00547 
00549   virtual void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const = 0;
00550 
00552 
00553 protected:
00554 
00557 
00559   class InArgsSetup : public InArgs {
00560   public:
00562     void setModelEvalDescription( const std::string &modelEvalDescription );
00564     void set_Np(int Np);
00566     void setSupports( EInArgsMembers arg, bool supports = true );
00567   };
00568 
00570   class OutArgsSetup : public OutArgs {
00571   public:
00573     void setModelEvalDescription( const std::string &modelEvalDescription );
00575     void set_Np_Ng(int Np, int Ng);
00577     void setSupports( EOutArgsMembers arg, bool supports = true );
00579     void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& );
00581     void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& );
00583     void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00585     void set_W_properties( const DerivativeProperties &properties );
00587     void set_DfDp_properties( int l, const DerivativeProperties &properties );
00589     void set_DgDx_properties( int j, const DerivativeProperties &properties );
00591     void set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00592   };
00593 
00595 
00596 };
00597 
00598 // ////////////////////////////
00599 // Helper functions
00600 
00602 std::string toString( ModelEvaluator::EDerivativeMultiVectorOrientation orientation );
00603 
00605 Teuchos::RefCountPtr<Epetra_Operator>
00606 get_DfDp_op(
00607   const int                                                            l
00608   ,const ModelEvaluator::OutArgs                                       &outArgs
00609   );
00610 
00612 Teuchos::RefCountPtr<Epetra_MultiVector>
00613 get_DfDp_mv(
00614   const int                                                            l
00615   ,const ModelEvaluator::OutArgs                                       &outArgs
00616   );
00617 
00619 Teuchos::RefCountPtr<Epetra_MultiVector>
00620 get_DgDx_mv(
00621   const int                                                            j
00622   ,const ModelEvaluator::OutArgs                                       &outArgs
00623   ,const EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation  mvOrientation
00624   );
00625 
00627 Teuchos::RefCountPtr<Epetra_MultiVector>
00628 get_DgDp_mv(
00629   const int                                                            j
00630   ,const int                                                           l
00631   ,const ModelEvaluator::OutArgs                                       &outArgs
00632   ,const EpetraExt::ModelEvaluator::EDerivativeMultiVectorOrientation  mvOrientation
00633   );
00634 
00635 // ///////////////////////////
00636 // Inline Functions
00637 
00638 //
00639 // ModelEvaluator::InArgs
00640 //
00641 
00642 inline
00643 std::string ModelEvaluator::InArgs::modelEvalDescription() const
00644 { return modelEvalDescription_; }
00645 
00646 inline
00647 int ModelEvaluator::InArgs::Np() const
00648 { return p_.size(); }
00649 
00650 inline
00651 void ModelEvaluator::InArgs::set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot )
00652 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
00653 
00654 inline
00655 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dot() const
00656 { assert_supports(IN_ARG_x_dot); return x_dot_; }
00657 
00658 inline
00659 void ModelEvaluator::InArgs::set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x )
00660 { assert_supports(IN_ARG_x); x_ = x; }
00661 
00662 inline
00663 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x() const
00664 { assert_supports(IN_ARG_x); return x_; }
00665 
00666 inline 
00667 void ModelEvaluator::InArgs::set_x_dot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly )
00668 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
00669 
00670 inline 
00671 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
00672 ModelEvaluator::InArgs::get_x_dot_poly() const
00673 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; }
00674 
00675 inline 
00676 void ModelEvaluator::InArgs::set_x_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly )
00677 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
00678 
00679 inline 
00680 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
00681 ModelEvaluator::InArgs::get_x_poly() const
00682 { assert_supports(IN_ARG_x_poly); return x_poly_; }
00683 
00684 inline
00685 void ModelEvaluator::InArgs::set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l )
00686 { assert_l(l); p_[l] = p_l; }
00687 
00688 inline
00689 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_p(int l) const
00690 { assert_l(l); return p_[l]; }
00691 
00692 inline
00693 void ModelEvaluator::InArgs::set_t( double t )
00694 { assert_supports(IN_ARG_t); t_ = t; }
00695 
00696 inline
00697 double ModelEvaluator::InArgs::get_t() const
00698 { assert_supports(IN_ARG_t); return t_; }
00699 
00700 inline
00701 void ModelEvaluator::InArgs::set_alpha( double alpha )
00702 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
00703 
00704 inline
00705 double ModelEvaluator::InArgs::get_alpha() const
00706 { assert_supports(IN_ARG_alpha); return alpha_; }
00707 
00708 inline
00709 void ModelEvaluator::InArgs::set_beta( double beta )
00710 { assert_supports(IN_ARG_beta); beta_ = beta; }
00711 
00712 inline
00713 double ModelEvaluator::InArgs::get_beta() const
00714 { assert_supports(IN_ARG_beta); return beta_; }
00715 
00716 inline
00717 void ModelEvaluator::InArgs::_setModelEvalDescription( const std::string &modelEvalDescription )
00718 {
00719   modelEvalDescription_ = modelEvalDescription;
00720 }
00721 
00722 inline
00723 void ModelEvaluator::InArgs::_set_Np(int Np)
00724 {
00725   p_.resize(Np);
00726 }
00727 
00728 //
00729 // ModelEvaluator::OutArgs
00730 //
00731 
00732 inline
00733 std::string ModelEvaluator::OutArgs::modelEvalDescription() const
00734 { return modelEvalDescription_; }
00735 
00736 inline
00737 int ModelEvaluator::OutArgs::Np() const
00738 {
00739   return DfDp_.size();
00740 }
00741 
00742 inline
00743 int ModelEvaluator::OutArgs::Ng() const
00744 { 
00745   return g_.size();
00746 }
00747 
00748 inline
00749 void ModelEvaluator::OutArgs::set_f( const Evaluation<Epetra_Vector> &f ) { f_ = f; }
00750 
00751 inline
00752 ModelEvaluator::Evaluation<Epetra_Vector>
00753 ModelEvaluator::OutArgs::get_f() const { return f_; }
00754 
00755 inline
00756 void ModelEvaluator::OutArgs::set_g( int j, const Evaluation<Epetra_Vector> &g_j )
00757 {
00758   assert_j(j);
00759   g_[j] = g_j;
00760 }
00761 
00762 inline
00763 ModelEvaluator::Evaluation<Epetra_Vector>
00764 ModelEvaluator::OutArgs::get_g(int j) const
00765 {
00766   assert_j(j);
00767   return g_[j];
00768 }
00769 
00770 inline
00771 void ModelEvaluator::OutArgs::set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ) { W_ = W; }
00772 
00773 inline
00774 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_W() const { return W_; }
00775 
00776 inline
00777 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_W_properties() const
00778 {
00779   return W_properties_;
00780 }
00781 
00782 inline
00783 void ModelEvaluator::OutArgs::set_DfDp( int l, const Derivative &DfDp_l )
00784 {
00785   assert_supports(OUT_ARG_DfDp,l);
00786   DfDp_[l] = DfDp_l;
00787 }
00788 
00789 inline
00790 ModelEvaluator::Derivative
00791 ModelEvaluator::OutArgs::get_DfDp(int l) const
00792 {
00793   assert_supports(OUT_ARG_DfDp,l);
00794   return DfDp_[l];
00795 }
00796 
00797 inline
00798 ModelEvaluator::DerivativeProperties
00799 ModelEvaluator::OutArgs::get_DfDp_properties(int l) const
00800 {
00801   assert_supports(OUT_ARG_DfDp,l);
00802   return DfDp_properties_[l];
00803 }
00804 
00805 inline
00806 void ModelEvaluator::OutArgs::set_DgDx( int j, const Derivative &DgDx_j )
00807 {
00808   assert_supports(OUT_ARG_DgDx,j);
00809   DgDx_[j] = DgDx_j;
00810 }
00811 
00812 inline
00813 ModelEvaluator::Derivative
00814 ModelEvaluator::OutArgs::get_DgDx(int j) const
00815 {
00816   assert_supports(OUT_ARG_DgDx,j);
00817   return DgDx_[j];
00818 }
00819 
00820 inline
00821 ModelEvaluator::DerivativeProperties
00822 ModelEvaluator::OutArgs::get_DgDx_properties(int j) const
00823 {
00824   assert_supports(OUT_ARG_DgDx,j);
00825   return DgDx_properties_[j];
00826 }
00827 
00828 inline
00829 void ModelEvaluator::OutArgs::set_DgDp( int j, int l, const Derivative &DgDp_j_l )
00830 {
00831   assert_supports(OUT_ARG_DgDp,j,l);
00832   DgDp_[ j*Np() + l ] = DgDp_j_l;
00833 }
00834 
00835 inline
00836 ModelEvaluator::Derivative
00837 ModelEvaluator::OutArgs::get_DgDp(int j, int l) const
00838 {
00839   assert_supports(OUT_ARG_DgDp,j,l);
00840   return DgDp_[ j*Np() + l ];
00841 }
00842 
00843 inline
00844 ModelEvaluator::DerivativeProperties
00845 ModelEvaluator::OutArgs::get_DgDp_properties(int j, int l) const
00846 {
00847   assert_supports(OUT_ARG_DgDp,j,l);
00848   return DgDp_properties_[ j*Np() + l ];
00849 }
00850 
00851 inline
00852 void ModelEvaluator::OutArgs::set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly )
00853 { f_poly_ = f_poly; }
00854 
00855 inline
00856 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> >
00857 ModelEvaluator::OutArgs::get_f_poly() const
00858 { return f_poly_; }
00859 
00860 //
00861 // ModelEvaluator::InArgsSetup
00862 //
00863 
00864 inline
00865 void ModelEvaluator::InArgsSetup::setModelEvalDescription( const std::string &modelEvalDescription )
00866 {
00867   this->_setModelEvalDescription(modelEvalDescription);
00868 }
00869 
00870 inline
00871 void ModelEvaluator::InArgsSetup::set_Np(int Np)
00872 { this->_set_Np(Np); }
00873 
00874 inline
00875 void ModelEvaluator::InArgsSetup::setSupports( EInArgsMembers arg, bool supports )
00876 { this->_setSupports(arg,supports); }
00877 
00878 //
00879 // ModelEvaluator::OutArgsSetup
00880 //
00881 
00882 inline
00883 void ModelEvaluator::OutArgsSetup::setModelEvalDescription( const std::string &modelEvalDescription )
00884 {
00885   this->_setModelEvalDescription(modelEvalDescription);
00886 }
00887 
00888 inline
00889 void ModelEvaluator::OutArgsSetup::set_Np_Ng(int Np, int Ng)
00890 { this->_set_Np_Ng(Np,Ng); }
00891 
00892 inline
00893 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsMembers arg, bool supports )
00894 { this->_setSupports(arg,supports); }
00895 
00896 inline
00897 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& supports )
00898 { this->_setSupports(arg,l,supports); }
00899 
00900 inline
00901 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& supports )
00902 { this->_setSupports(arg,j,supports); }
00903 
00904 inline
00905 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports )
00906 { this->_setSupports(arg,j,l,supports); }
00907 
00908 inline
00909 void ModelEvaluator::OutArgsSetup::set_W_properties( const DerivativeProperties &properties )
00910 { this->_set_W_properties(properties); }
00911 
00912 inline
00913 void ModelEvaluator::OutArgsSetup::set_DfDp_properties( int l, const DerivativeProperties &properties )
00914 {
00915   this->_set_DfDp_properties(l,properties);
00916 }
00917 
00918 inline
00919 void ModelEvaluator::OutArgsSetup::set_DgDx_properties( int j, const DerivativeProperties &properties )
00920 {
00921   this->_set_DgDx_properties(j,properties);
00922 }
00923 
00924 inline
00925 void ModelEvaluator::OutArgsSetup::set_DgDp_properties( int j, int l, const DerivativeProperties &properties )
00926 {
00927   this->_set_DgDp_properties(j,l,properties);
00928 }
00929 
00930 } // namespace EpetraExt
00931 
00932 #endif // EPETRA_EXT_MODEL_EVALUATOR_HPP

Generated on Thu Sep 18 12:31:44 2008 for EpetraExt by doxygen 1.3.9.1