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 "EpetraExt_PolynomialVectorTraits.h"
00034 #include "Teuchos_RefCountPtr.hpp"
00035 #include "Teuchos_Describable.hpp"
00036 #include "Teuchos_Polynomial.hpp"
00037 #include "Teuchos_Array.hpp"
00038 
00039 class Epetra_Map;
00040 class Epetra_Vector;
00041 class Epetra_Operator;
00042 
00043 namespace EpetraExt {
00044 
00049 class ModelEvaluator : virtual public Teuchos::Describable {
00050 public:
00051 
00054 
00056   enum EInArgsMembers {
00057     IN_ARG_x_dot
00058     ,IN_ARG_x
00059     ,IN_ARG_x_dot_poly 
00060     ,IN_ARG_x_poly 
00061     ,IN_ARG_t
00062     ,IN_ARG_alpha
00063     ,IN_ARG_beta
00064   };
00065   static const int NUM_E_IN_ARGS_MEMBERS=7;
00066 
00068   class InArgs {
00069   public:
00071     InArgs();
00073     std::string modelEvalDescription() const;
00075     int Np() const;
00077     void set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot );
00079     Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot() const;
00081     void set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x );
00083     Teuchos::RefCountPtr<const Epetra_Vector> get_x() const;
00084     void set_x_poly(
00085       const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly
00086       );
00088     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_poly() const;
00090     void set_x_dot_poly(
00091       const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly
00092       );
00094     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > get_x_dot_poly() const;
00096     void set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l );
00098     Teuchos::RefCountPtr<const Epetra_Vector> get_p(int l) const;
00100     void set_t( double t );
00102     double get_alpha() const;
00104     void set_alpha( double alpha );
00106     double get_beta() const;
00108     void set_beta( double beta );
00110     double get_t() const;
00112     bool supports(EInArgsMembers arg) const;
00113   protected:
00115     void _setModelEvalDescription( const std::string &modelEvalDescription );
00117     void _set_Np(int Np);
00119     void _setSupports( EInArgsMembers arg, bool supports );
00120   private:
00121     // types
00122     typedef Teuchos::Array<Teuchos::RefCountPtr<const Epetra_Vector> > p_t;
00123     // data
00124     std::string modelEvalDescription_;
00125     Teuchos::RefCountPtr<const Epetra_Vector>  x_dot_;
00126     Teuchos::RefCountPtr<const Epetra_Vector>  x_;
00127     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_dot_poly_;
00128     Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > x_poly_;
00129     p_t                                        p_;
00130     double                                     t_;
00131     double                                     alpha_;
00132     double                                     beta_;
00133     bool supports_[NUM_E_IN_ARGS_MEMBERS];
00134     // functions
00135     void assert_supports(EInArgsMembers arg) const;
00136     void assert_l(int l) const;
00137   };
00138 
00140   enum EEvalType {
00141     EVAL_TYPE_EXACT                
00142     ,EVAL_TYPE_APPROX_DERIV        
00143     ,EVAL_TYPE_VERY_APPROX_DERIV   
00144   };
00145 
00147   template<class ObjType>
00148   class Evaluation : public Teuchos::RefCountPtr<ObjType> {
00149   public:
00151     Evaluation() : evalType_(EVAL_TYPE_EXACT) {}
00153     Evaluation( const Teuchos::RefCountPtr<ObjType> &obj )
00154       : Teuchos::RefCountPtr<ObjType>(obj), evalType_(EVAL_TYPE_EXACT) {}
00156     Evaluation( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType )
00157       : Teuchos::RefCountPtr<ObjType>(obj), evalType_(evalType) {}
00159     EEvalType getType() const { return evalType_; }
00161     void reset( const Teuchos::RefCountPtr<ObjType> &obj, EEvalType evalType ) 
00162     { this->operator=(obj); evalType_ = evalType; }
00163   private:
00164     EEvalType                      evalType_;
00165   };
00166   
00168   enum EDerivativeMultiVectorOrientation {
00169     DERIV_MV_BY_COL           
00170     ,DERIV_TRANS_MV_BY_ROW    
00171   };
00172 
00174   enum EDerivativeLinearOp { DERIV_LINEAR_OP };
00175 
00177   class DerivativeSupport {
00178   public:
00180     DerivativeSupport()
00181       :supportsLinearOp_(false), supportsMVByCol_(false), supportsTransMVByRow_(false)
00182       {}
00184     DerivativeSupport( EDerivativeLinearOp )
00185       :supportsLinearOp_(true), supportsMVByCol_(false), supportsTransMVByRow_(false)
00186       {}
00188     DerivativeSupport( EDerivativeMultiVectorOrientation mvOrientation )
00189       :supportsLinearOp_(false), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00190       ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00191       {}
00193     DerivativeSupport(
00194       EDerivativeLinearOp, EDerivativeMultiVectorOrientation mvOrientation )
00195       :supportsLinearOp_(true), supportsMVByCol_(mvOrientation==DERIV_MV_BY_COL)
00196       ,supportsTransMVByRow_(mvOrientation==DERIV_TRANS_MV_BY_ROW)
00197       {}
00199     DerivativeSupport(
00200       EDerivativeMultiVectorOrientation mvOrientation1,
00201       EDerivativeMultiVectorOrientation mvOrientation2
00202       )
00203       :supportsLinearOp_(false)
00204       ,supportsMVByCol_(
00205         mvOrientation1==DERIV_MV_BY_COL||mvOrientation2==DERIV_MV_BY_COL )
00206       ,supportsTransMVByRow_(
00207         mvOrientation1==DERIV_TRANS_MV_BY_ROW||mvOrientation2==DERIV_TRANS_MV_BY_ROW )
00208       {}
00210     DerivativeSupport& plus(EDerivativeLinearOp)
00211       { supportsLinearOp_ = true; return *this; }
00213     DerivativeSupport& plus(EDerivativeMultiVectorOrientation mvOrientation)
00214       {
00215         switch(mvOrientation) {
00216           case DERIV_MV_BY_COL: supportsMVByCol_ = true; break;
00217           case DERIV_TRANS_MV_BY_ROW: supportsTransMVByRow_ = true; break;
00218           default: TEST_FOR_EXCEPT(true);
00219         }
00220         return *this;
00221       }
00223     bool none() const
00224       { return ( !supportsLinearOp_ && !supportsMVByCol_ && !supportsTransMVByRow_ ); }
00226     bool supports(EDerivativeLinearOp) const
00227       { return supportsLinearOp_; }
00229     bool supports(EDerivativeMultiVectorOrientation mvOrientation) const
00230       {
00231         switch(mvOrientation) {
00232           case DERIV_MV_BY_COL: return supportsMVByCol_;
00233           case DERIV_TRANS_MV_BY_ROW: return supportsTransMVByRow_;
00234           default: TEST_FOR_EXCEPT(true);
00235         }
00236         return false; // Will never be called!
00237       }
00238   private:
00239     bool supportsLinearOp_;
00240     bool supportsMVByCol_;
00241     bool supportsTransMVByRow_;
00242   public:
00243   };
00244 
00246   enum EDerivativeLinearity {
00247     DERIV_LINEARITY_UNKNOWN      
00248     ,DERIV_LINEARITY_CONST       
00249     ,DERIV_LINEARITY_NONCONST    
00250   };
00252   enum ERankStatus {
00253     DERIV_RANK_UNKNOWN       
00254     ,DERIV_RANK_FULL         
00255     ,DERIV_RANK_DEFICIENT    
00256   };
00257 
00259   struct DerivativeProperties {
00261     EDerivativeLinearity linearity;
00263     ERankStatus rank;
00265     bool supportsAdjoint;
00267     DerivativeProperties()
00268       :linearity(DERIV_LINEARITY_UNKNOWN),rank(DERIV_RANK_UNKNOWN),supportsAdjoint(false) {}
00270     DerivativeProperties(
00271       EDerivativeLinearity in_linearity, ERankStatus in_rank, bool in_supportsAdjoint
00272       ):linearity(in_linearity),rank(in_rank),supportsAdjoint(in_supportsAdjoint) {}
00273   };
00274 
00278   class DerivativeMultiVector {
00279   public:
00281     DerivativeMultiVector() {}
00283     DerivativeMultiVector(
00284       const Teuchos::RefCountPtr<Epetra_MultiVector> &mv
00285       ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00286       ,const Teuchos::Array<int> &paramIndexes = Teuchos::Array<int>()
00287       ) : mv_(mv), orientation_(orientation), paramIndexes_(paramIndexes) {}
00289     void changeOrientation( const EDerivativeMultiVectorOrientation orientation )
00290       { orientation_ = orientation; };
00292     Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const
00293       { return mv_; }
00295     EDerivativeMultiVectorOrientation getOrientation() const
00296       { return orientation_; }
00298     const Teuchos::Array<int>& getParamIndexes() const
00299       { return paramIndexes_; }
00300   private:
00301     Teuchos::RefCountPtr<Epetra_MultiVector> mv_;
00302     EDerivativeMultiVectorOrientation orientation_;
00303     Teuchos::Array<int> paramIndexes_;
00304   };
00305 
00309   class Derivative {
00310   public:
00312     Derivative() {}
00314     Derivative( const Teuchos::RefCountPtr<Epetra_Operator> &lo )
00315       : lo_(lo) {}
00317     Derivative(
00318       const Teuchos::RefCountPtr<Epetra_MultiVector> &mv
00319       ,const EDerivativeMultiVectorOrientation orientation = DERIV_MV_BY_COL
00320       ) : dmv_(mv,orientation) {}
00322     Derivative( const DerivativeMultiVector &dmv )
00323       : dmv_(dmv) {}
00325     Teuchos::RefCountPtr<Epetra_Operator> getLinearOp() const
00326       { return lo_; }
00328     Teuchos::RefCountPtr<Epetra_MultiVector> getMultiVector() const
00329       { return dmv_.getMultiVector(); }
00331     EDerivativeMultiVectorOrientation getMultiVectorOrientation() const
00332       { return dmv_.getOrientation(); }
00334     DerivativeMultiVector getDerivativeMultiVector() const
00335       { return dmv_; }
00337     bool isEmpty() const
00338         { return !lo_.get() && !dmv_.getMultiVector().get(); }
00339   private:
00340     Teuchos::RefCountPtr<Epetra_Operator> lo_;
00341     DerivativeMultiVector dmv_;
00342   };
00343 
00345   enum EOutArgsMembers {
00346     OUT_ARG_f
00347     ,OUT_ARG_W
00348     ,OUT_ARG_f_poly
00349   };
00350   static const int NUM_E_OUT_ARGS_MEMBERS=3;
00351 
00353   enum EOutArgsDfDp {
00354     OUT_ARG_DfDp   
00355   };
00356 
00358   enum EOutArgsDgDx_dot {
00359     OUT_ARG_DgDx_dot   
00360   };
00361 
00363   enum EOutArgsDgDx {
00364     OUT_ARG_DgDx   
00365   };
00366 
00368   enum EOutArgsDgDp {
00369     OUT_ARG_DgDp   
00370   };
00371 
00373   class OutArgs {
00374   public:
00376     OutArgs();
00378     std::string modelEvalDescription() const;
00380     int Np() const;
00382     int Ng() const;
00384     bool supports(EOutArgsMembers arg) const;
00386     const DerivativeSupport& supports(EOutArgsDfDp arg, int l) const;
00388     const DerivativeSupport& supports(EOutArgsDgDx_dot arg, int j) const;
00390     const DerivativeSupport& supports(EOutArgsDgDx arg, int j) const;
00392     const DerivativeSupport& supports(EOutArgsDgDp arg, int j, int l) const;
00394     void set_f( const Evaluation<Epetra_Vector> &f );
00396     Evaluation<Epetra_Vector> get_f() const;
00398     void set_g( int j, const Evaluation<Epetra_Vector> &g_j );
00400     Evaluation<Epetra_Vector> get_g(int j) const;
00402     void set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W );
00404     Teuchos::RefCountPtr<Epetra_Operator> get_W() const;
00406     DerivativeProperties get_W_properties() const;
00408     void set_DfDp(int l,  const Derivative &DfDp_l);
00410     Derivative get_DfDp(int l) const;
00412     DerivativeProperties get_DfDp_properties(int l) const;
00414     void set_DgDx_dot(int j, const Derivative &DgDx_dot_j);
00416     Derivative get_DgDx_dot(int j) const;
00418     DerivativeProperties get_DgDx_dot_properties(int j) const;
00420     void set_DgDx(int j, const Derivative &DgDx_j);
00422     Derivative get_DgDx(int j) const;
00424     DerivativeProperties get_DgDx_properties(int j) const;
00426     void set_DgDp( int j, int l, const Derivative &DgDp_j_l );
00428     Derivative get_DgDp(int j, int l) const;
00430     DerivativeProperties get_DgDp_properties(int j, int l) const;
00432     void set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly );
00434     Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > get_f_poly() const;
00436     bool funcOrDerivesAreSet(EOutArgsMembers arg) const;
00437   protected:
00439     void _setModelEvalDescription( const std::string &modelEvalDescription );
00441     void _set_Np_Ng(int Np, int Ng);
00443     void _setSupports( EOutArgsMembers arg, bool supports );
00445     void _setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& );
00447     void _setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00449     void _setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& );
00451     void _setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00453     void _set_W_properties( const DerivativeProperties &W_properties );
00455     void _set_DfDp_properties( int l, const DerivativeProperties &properties );
00457     void _set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00459     void _set_DgDx_properties( int j, const DerivativeProperties &properties );
00461     void _set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00462   private:
00463     // types
00464     typedef Teuchos::Array<Evaluation<Epetra_Vector> > g_t;
00465     typedef Teuchos::Array<Derivative> deriv_t;
00466     typedef Teuchos::Array<DerivativeProperties> deriv_properties_t;
00467     typedef Teuchos::Array<DerivativeSupport> supports_t;
00468     // data
00469     std::string modelEvalDescription_;
00470     bool supports_[NUM_E_OUT_ARGS_MEMBERS];
00471     supports_t supports_DfDp_; // Np
00472     supports_t supports_DgDx_dot_; // Ng
00473     supports_t supports_DgDx_; // Ng
00474     supports_t supports_DgDp_; // Ng x Np
00475     Evaluation<Epetra_Vector> f_;
00476     g_t g_;
00477     Teuchos::RefCountPtr<Epetra_Operator> W_;
00478     DerivativeProperties W_properties_;
00479     deriv_t DfDp_; // Np
00480     deriv_properties_t DfDp_properties_; // Np
00481     deriv_t DgDx_dot_; // Ng
00482     deriv_t DgDx_; // Ng
00483     deriv_properties_t DgDx_dot_properties_; // Ng
00484     deriv_properties_t DgDx_properties_; // Ng
00485     deriv_t DgDp_; // Ng x Np
00486     deriv_properties_t DgDp_properties_; // Ng x Np
00487     Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > f_poly_;
00488     // functions
00489     void assert_supports(EOutArgsMembers arg) const;
00490     void assert_supports(EOutArgsDfDp arg, int l) const;
00491     void assert_supports(EOutArgsDgDx_dot arg, int j) const;
00492     void assert_supports(EOutArgsDgDx arg, int j) const;
00493     void assert_supports(EOutArgsDgDp arg, int j, int l) const;
00494     void assert_l(int l) const;
00495     void assert_j(int j) const;
00496   };
00497 
00499 
00502 
00504   virtual ~ModelEvaluator();
00505 
00507 
00510 
00512   virtual Teuchos::RefCountPtr<const Epetra_Map> get_x_map() const = 0;
00513 
00515   virtual Teuchos::RefCountPtr<const Epetra_Map> get_f_map() const = 0;
00516 
00518   virtual Teuchos::RefCountPtr<const Epetra_Map> get_p_map(int l) const;
00519 
00534   virtual Teuchos::RefCountPtr<const Teuchos::Array<std::string> > get_p_names(int l) const;
00535 
00537   virtual Teuchos::RefCountPtr<const Epetra_Map> get_g_map(int j) const;
00538 
00540 
00543 
00545   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_init() const;
00546 
00548   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_dot_init() const;
00549 
00551   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_init(int l) const;
00552 
00554   virtual double get_t_init() const;
00555 
00557 
00560 
00565   virtual double getInfBound() const;
00566 
00568   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_lower_bounds() const;
00569 
00571   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_x_upper_bounds() const;
00572 
00574   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_lower_bounds(int l) const;
00575 
00577   virtual Teuchos::RefCountPtr<const Epetra_Vector> get_p_upper_bounds(int l) const;
00578 
00580   virtual double get_t_lower_bound() const;
00581 
00583   virtual double get_t_upper_bound() const;
00584 
00586 
00589 
00596   virtual Teuchos::RefCountPtr<Epetra_Operator> create_W() const;
00597 
00599   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DfDp_op(int l) const;
00600 
00602   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_dot_op(int j) const;
00603 
00605   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDx_op(int j) const;
00606 
00608   virtual Teuchos::RefCountPtr<Epetra_Operator> create_DgDp_op( int j, int l ) const;
00609 
00611 
00614 
00616   virtual InArgs createInArgs() const = 0;
00617 
00619   virtual OutArgs createOutArgs() const = 0;
00620 
00622   virtual void evalModel( const InArgs& inArgs, const OutArgs& outArgs ) const = 0;
00623 
00625 
00626 protected:
00627 
00630 
00632   class InArgsSetup : public InArgs {
00633   public:
00635     void setModelEvalDescription( const std::string &modelEvalDescription );
00637     void set_Np(int Np);
00639     void setSupports( EInArgsMembers arg, bool supports = true );
00640   };
00641 
00643   class OutArgsSetup : public OutArgs {
00644   public:
00646     void setModelEvalDescription( const std::string &modelEvalDescription );
00648     void set_Np_Ng(int Np, int Ng);
00650     void setSupports( EOutArgsMembers arg, bool supports = true );
00652     void setSupports(EOutArgsDfDp arg, int l, const DerivativeSupport& );
00654     void setSupports(EOutArgsDgDx_dot arg, int j, const DerivativeSupport& );
00656     void setSupports(EOutArgsDgDx arg, int j, const DerivativeSupport& );
00658     void setSupports(EOutArgsDgDp arg, int j, int l, const DerivativeSupport& );
00660     void set_W_properties( const DerivativeProperties &properties );
00662     void set_DfDp_properties( int l, const DerivativeProperties &properties );
00664     void set_DgDx_dot_properties( int j, const DerivativeProperties &properties );
00666     void set_DgDx_properties( int j, const DerivativeProperties &properties );
00668     void set_DgDp_properties( int j, int l, const DerivativeProperties &properties );
00669   };
00670 
00672 
00673 };
00674 
00675 // ////////////////////////////
00676 // Helper functions
00677 
00679 std::string toString( ModelEvaluator::EDerivativeMultiVectorOrientation orientation );
00680 
00682 std::string toString( ModelEvaluator::EInArgsMembers inArg );
00683 
00685 std::string toString( ModelEvaluator::EOutArgsMembers outArg );
00686 
00688 Teuchos::RefCountPtr<Epetra_Operator>
00689 getLinearOp(
00690   const std::string &modelEvalDescription,
00691   const ModelEvaluator::Derivative &deriv,
00692   const std::string &derivName
00693   );
00694 
00696 Teuchos::RefCountPtr<Epetra_MultiVector>
00697 getMultiVector(
00698   const std::string &modelEvalDescription,
00699   const ModelEvaluator::Derivative &deriv,
00700   const std::string &derivName,
00701   const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00702   );
00703 
00705 Teuchos::RefCountPtr<Epetra_Operator>
00706 get_DfDp_op(
00707   const int l
00708   ,const ModelEvaluator::OutArgs &outArgs
00709   );
00710 
00712 Teuchos::RefCountPtr<Epetra_MultiVector>
00713 get_DfDp_mv(
00714   const int l
00715   ,const ModelEvaluator::OutArgs &outArgs
00716   );
00717 
00719 Teuchos::RefCountPtr<Epetra_MultiVector>
00720 get_DgDx_dot_mv(
00721   const int j
00722   ,const ModelEvaluator::OutArgs &outArgs
00723   ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00724   );
00725 
00727 Teuchos::RefCountPtr<Epetra_MultiVector>
00728 get_DgDx_mv(
00729   const int j
00730   ,const ModelEvaluator::OutArgs &outArgs
00731   ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00732   );
00733 
00735 Teuchos::RefCountPtr<Epetra_MultiVector>
00736 get_DgDp_mv(
00737   const int j
00738   ,const int l
00739   ,const ModelEvaluator::OutArgs &outArgs
00740   ,const ModelEvaluator::EDerivativeMultiVectorOrientation mvOrientation
00741   );
00742 
00743 // ///////////////////////////
00744 // Inline Functions
00745 
00746 //
00747 // ModelEvaluator::InArgs
00748 //
00749 
00750 inline
00751 std::string ModelEvaluator::InArgs::modelEvalDescription() const
00752 { return modelEvalDescription_; }
00753 
00754 inline
00755 int ModelEvaluator::InArgs::Np() const
00756 { return p_.size(); }
00757 
00758 inline
00759 void ModelEvaluator::InArgs::set_x_dot( const Teuchos::RefCountPtr<const Epetra_Vector> &x_dot )
00760 { assert_supports(IN_ARG_x_dot); x_dot_ = x_dot; }
00761 
00762 inline
00763 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x_dot() const
00764 { assert_supports(IN_ARG_x_dot); return x_dot_; }
00765 
00766 inline
00767 void ModelEvaluator::InArgs::set_x( const Teuchos::RefCountPtr<const Epetra_Vector> &x )
00768 { assert_supports(IN_ARG_x); x_ = x; }
00769 
00770 inline
00771 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_x() const
00772 { assert_supports(IN_ARG_x); return x_; }
00773 
00774 inline 
00775 void ModelEvaluator::InArgs::set_x_dot_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_dot_poly )
00776 { assert_supports(IN_ARG_x_dot_poly); x_dot_poly_ = x_dot_poly; }
00777 
00778 inline 
00779 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
00780 ModelEvaluator::InArgs::get_x_dot_poly() const
00781 { assert_supports(IN_ARG_x_dot_poly); return x_dot_poly_; }
00782 
00783 inline 
00784 void ModelEvaluator::InArgs::set_x_poly( const Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> > &x_poly )
00785 { assert_supports(IN_ARG_x_poly); x_poly_ = x_poly; }
00786 
00787 inline 
00788 Teuchos::RefCountPtr<const Teuchos::Polynomial<Epetra_Vector> >
00789 ModelEvaluator::InArgs::get_x_poly() const
00790 { assert_supports(IN_ARG_x_poly); return x_poly_; }
00791 
00792 inline
00793 void ModelEvaluator::InArgs::set_p( int l, const Teuchos::RefCountPtr<const Epetra_Vector> &p_l )
00794 { assert_l(l); p_[l] = p_l; }
00795 
00796 inline
00797 Teuchos::RefCountPtr<const Epetra_Vector> ModelEvaluator::InArgs::get_p(int l) const
00798 { assert_l(l); return p_[l]; }
00799 
00800 inline
00801 void ModelEvaluator::InArgs::set_t( double t )
00802 { assert_supports(IN_ARG_t); t_ = t; }
00803 
00804 inline
00805 double ModelEvaluator::InArgs::get_t() const
00806 { assert_supports(IN_ARG_t); return t_; }
00807 
00808 inline
00809 void ModelEvaluator::InArgs::set_alpha( double alpha )
00810 { assert_supports(IN_ARG_alpha); alpha_ = alpha; }
00811 
00812 inline
00813 double ModelEvaluator::InArgs::get_alpha() const
00814 { assert_supports(IN_ARG_alpha); return alpha_; }
00815 
00816 inline
00817 void ModelEvaluator::InArgs::set_beta( double beta )
00818 { assert_supports(IN_ARG_beta); beta_ = beta; }
00819 
00820 inline
00821 double ModelEvaluator::InArgs::get_beta() const
00822 { assert_supports(IN_ARG_beta); return beta_; }
00823 
00824 inline
00825 void ModelEvaluator::InArgs::_setModelEvalDescription( const std::string &modelEvalDescription )
00826 {
00827   modelEvalDescription_ = modelEvalDescription;
00828 }
00829 
00830 inline
00831 void ModelEvaluator::InArgs::_set_Np(int Np)
00832 {
00833   p_.resize(Np);
00834 }
00835 
00836 //
00837 // ModelEvaluator::OutArgs
00838 //
00839 
00840 inline
00841 std::string ModelEvaluator::OutArgs::modelEvalDescription() const
00842 { return modelEvalDescription_; }
00843 
00844 inline
00845 int ModelEvaluator::OutArgs::Np() const
00846 {
00847   return DfDp_.size();
00848 }
00849 
00850 inline
00851 int ModelEvaluator::OutArgs::Ng() const
00852 { 
00853   return g_.size();
00854 }
00855 
00856 inline
00857 void ModelEvaluator::OutArgs::set_f( const Evaluation<Epetra_Vector> &f ) { f_ = f; }
00858 
00859 inline
00860 ModelEvaluator::Evaluation<Epetra_Vector>
00861 ModelEvaluator::OutArgs::get_f() const { return f_; }
00862 
00863 inline
00864 void ModelEvaluator::OutArgs::set_g( int j, const Evaluation<Epetra_Vector> &g_j )
00865 {
00866   assert_j(j);
00867   g_[j] = g_j;
00868 }
00869 
00870 inline
00871 ModelEvaluator::Evaluation<Epetra_Vector>
00872 ModelEvaluator::OutArgs::get_g(int j) const
00873 {
00874   assert_j(j);
00875   return g_[j];
00876 }
00877 
00878 inline
00879 void ModelEvaluator::OutArgs::set_W( const Teuchos::RefCountPtr<Epetra_Operator> &W ) { W_ = W; }
00880 
00881 inline
00882 Teuchos::RefCountPtr<Epetra_Operator> ModelEvaluator::OutArgs::get_W() const { return W_; }
00883 
00884 inline
00885 ModelEvaluator::DerivativeProperties ModelEvaluator::OutArgs::get_W_properties() const
00886 {
00887   return W_properties_;
00888 }
00889 
00890 inline
00891 void ModelEvaluator::OutArgs::set_DfDp( int l, const Derivative &DfDp_l )
00892 {
00893   assert_supports(OUT_ARG_DfDp,l);
00894   DfDp_[l] = DfDp_l;
00895 }
00896 
00897 inline
00898 ModelEvaluator::Derivative
00899 ModelEvaluator::OutArgs::get_DfDp(int l) const
00900 {
00901   assert_supports(OUT_ARG_DfDp,l);
00902   return DfDp_[l];
00903 }
00904 
00905 inline
00906 ModelEvaluator::DerivativeProperties
00907 ModelEvaluator::OutArgs::get_DfDp_properties(int l) const
00908 {
00909   assert_supports(OUT_ARG_DfDp,l);
00910   return DfDp_properties_[l];
00911 }
00912 
00913 inline
00914 void ModelEvaluator::OutArgs::set_DgDx_dot( int j, const Derivative &DgDx_dot_j )
00915 {
00916   assert_supports(OUT_ARG_DgDx_dot,j);
00917   DgDx_dot_[j] = DgDx_dot_j;
00918 }
00919 
00920 inline
00921 ModelEvaluator::Derivative
00922 ModelEvaluator::OutArgs::get_DgDx_dot(int j) const
00923 {
00924   assert_supports(OUT_ARG_DgDx_dot,j);
00925   return DgDx_dot_[j];
00926 }
00927 
00928 inline
00929 ModelEvaluator::DerivativeProperties
00930 ModelEvaluator::OutArgs::get_DgDx_dot_properties(int j) const
00931 {
00932   assert_supports(OUT_ARG_DgDx_dot,j);
00933   return DgDx_dot_properties_[j];
00934 }
00935 
00936 inline
00937 void ModelEvaluator::OutArgs::set_DgDx( int j, const Derivative &DgDx_j )
00938 {
00939   assert_supports(OUT_ARG_DgDx,j);
00940   DgDx_[j] = DgDx_j;
00941 }
00942 
00943 inline
00944 ModelEvaluator::Derivative
00945 ModelEvaluator::OutArgs::get_DgDx(int j) const
00946 {
00947   assert_supports(OUT_ARG_DgDx,j);
00948   return DgDx_[j];
00949 }
00950 
00951 inline
00952 ModelEvaluator::DerivativeProperties
00953 ModelEvaluator::OutArgs::get_DgDx_properties(int j) const
00954 {
00955   assert_supports(OUT_ARG_DgDx,j);
00956   return DgDx_properties_[j];
00957 }
00958 
00959 inline
00960 void ModelEvaluator::OutArgs::set_DgDp( int j, int l, const Derivative &DgDp_j_l )
00961 {
00962   assert_supports(OUT_ARG_DgDp,j,l);
00963   DgDp_[ j*Np() + l ] = DgDp_j_l;
00964 }
00965 
00966 inline
00967 ModelEvaluator::Derivative
00968 ModelEvaluator::OutArgs::get_DgDp(int j, int l) const
00969 {
00970   assert_supports(OUT_ARG_DgDp,j,l);
00971   return DgDp_[ j*Np() + l ];
00972 }
00973 
00974 inline
00975 ModelEvaluator::DerivativeProperties
00976 ModelEvaluator::OutArgs::get_DgDp_properties(int j, int l) const
00977 {
00978   assert_supports(OUT_ARG_DgDp,j,l);
00979   return DgDp_properties_[ j*Np() + l ];
00980 }
00981 
00982 inline
00983 void ModelEvaluator::OutArgs::set_f_poly( const Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> > &f_poly )
00984 { f_poly_ = f_poly; }
00985 
00986 inline
00987 Teuchos::RefCountPtr<Teuchos::Polynomial<Epetra_Vector> >
00988 ModelEvaluator::OutArgs::get_f_poly() const
00989 { return f_poly_; }
00990 
00991 //
00992 // ModelEvaluator::InArgsSetup
00993 //
00994 
00995 inline
00996 void ModelEvaluator::InArgsSetup::setModelEvalDescription( const std::string &modelEvalDescription )
00997 {
00998   this->_setModelEvalDescription(modelEvalDescription);
00999 }
01000 
01001 inline
01002 void ModelEvaluator::InArgsSetup::set_Np(int Np)
01003 { this->_set_Np(Np); }
01004 
01005 inline
01006 void ModelEvaluator::InArgsSetup::setSupports( EInArgsMembers arg, bool supports )
01007 { this->_setSupports(arg,supports); }
01008 
01009 //
01010 // ModelEvaluator::OutArgsSetup
01011 //
01012 
01013 inline
01014 void ModelEvaluator::OutArgsSetup::setModelEvalDescription( const std::string &modelEvalDescription )
01015 {
01016   this->_setModelEvalDescription(modelEvalDescription);
01017 }
01018 
01019 inline
01020 void ModelEvaluator::OutArgsSetup::set_Np_Ng(int Np, int Ng)
01021 { this->_set_Np_Ng(Np,Ng); }
01022 
01023 inline
01024 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsMembers arg, bool supports )
01025 { this->_setSupports(arg,supports); }
01026 
01027 inline
01028 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDfDp arg, int l, const DerivativeSupport& supports )
01029 { this->_setSupports(arg,l,supports); }
01030 
01031 inline
01032 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx_dot arg, int j, const DerivativeSupport& supports )
01033 { this->_setSupports(arg,j,supports); }
01034 
01035 inline
01036 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDx arg, int j, const DerivativeSupport& supports )
01037 { this->_setSupports(arg,j,supports); }
01038 
01039 inline
01040 void ModelEvaluator::OutArgsSetup::setSupports( EOutArgsDgDp arg, int j, int l, const DerivativeSupport& supports )
01041 { this->_setSupports(arg,j,l,supports); }
01042 
01043 inline
01044 void ModelEvaluator::OutArgsSetup::set_W_properties( const DerivativeProperties &properties )
01045 { this->_set_W_properties(properties); }
01046 
01047 inline
01048 void ModelEvaluator::OutArgsSetup::set_DfDp_properties( int l, const DerivativeProperties &properties )
01049 {
01050   this->_set_DfDp_properties(l,properties);
01051 }
01052 
01053 inline
01054 void ModelEvaluator::OutArgsSetup::set_DgDx_dot_properties( int j, const DerivativeProperties &properties )
01055 {
01056   this->_set_DgDx_dot_properties(j,properties);
01057 }
01058 
01059 inline
01060 void ModelEvaluator::OutArgsSetup::set_DgDx_properties( int j, const DerivativeProperties &properties )
01061 {
01062   this->_set_DgDx_properties(j,properties);
01063 }
01064 
01065 inline
01066 void ModelEvaluator::OutArgsSetup::set_DgDp_properties( int j, int l, const DerivativeProperties &properties )
01067 {
01068   this->_set_DgDp_properties(j,l,properties);
01069 }
01070 
01071 } // namespace EpetraExt
01072 
01073 #endif // EPETRA_EXT_MODEL_EVALUATOR_HPP

Generated on Tue Oct 20 12:45:30 2009 for EpetraExt by doxygen 1.4.7