00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef SUNDANCE_EVALMANAGER_H
00032 #define SUNDANCE_EVALMANAGER_H
00033 
00034 #include "SundanceDefs.hpp"
00035 #include "SundanceEvalContext.hpp"
00036 #include "SundanceAbstractEvalMediator.hpp"
00037 #include "SundanceTempStack.hpp"
00038 #include "SundanceNoncopyable.hpp"
00039 #include "Teuchos_TimeMonitor.hpp"
00040 
00041 namespace Sundance
00042 {
00043 using namespace Sundance;
00044 class CoordExpr;
00045 class MultiIndex;
00046 class DiscreteFuncElement;
00047 
00048 
00049 
00050 
00051 
00052 
00053 
00054 
00055 
00056 class EvalManager : public Noncopyable
00057 {
00058 public:
00059 
00060   EvalManager();
00061 
00062 
00063   void evalCoordExpr(const CoordExpr* expr,
00064     RCP<EvalVector>&  result) const ;
00065 
00066 
00067   void evalCellDiameterExpr(const CellDiameterExpr* expr,
00068     RCP<EvalVector>&  result) const ;
00069 
00070 
00071   void evalCurveNormExpr(const CurveNormExpr* expr,
00072     RCP<EvalVector>&  result) const ;
00073 
00074 
00075   void evalCellVectorExpr(const CellVectorExpr* expr,
00076     RCP<EvalVector>&  result) const ;
00077 
00078 
00079   void evalDiscreteFuncElement(const DiscreteFuncElement* expr,
00080     const Array<MultiIndex>& mi,
00081     Array<RCP<EvalVector> >& result) const ;
00082 
00083   void showResults(std::ostream& os,
00084        const RCP<SparsitySuperset>& sparsity,
00085        const Array<RCP<EvalVector> >& vecResults,
00086        const Array<double>& constantResults) const ;
00087 
00088 
00089   void setMediator(const RCP<AbstractEvalMediator>& med) 
00090     {mediator_ = med;}
00091 
00092 
00093   void setVerb(int verb) ;
00094 
00095 
00096 
00097   int verb() const {return verb_;}
00098 
00099 
00100   void setVecSize(int vecSize) {stack().setVecSize(vecSize);}
00101           
00102 
00103 
00104 
00105 
00106   const AbstractEvalMediator* mediator() const {return mediator_.get();}
00107 
00108 
00109   void setRegion(const EvalContext& region)
00110     {region_ = region;}
00111 
00112 
00113   const EvalContext& getRegion() const {return region_;}
00114 
00115 
00116   static TempStack& stack();
00117 
00118 
00119   int getMaxDiffOrder() const ;
00120 
00121 
00122 
00123   RCP<EvalVector> popVector() const ;
00124 
00125 
00126   TEUCHOS_TIMER(coordEvalTimer, "coord function evaluation");
00127 
00128 
00129   TEUCHOS_TIMER(discFuncEvalTimer, "discrete function evaluation");
00130 
00131 private:
00132   int verb_;
00133 
00134   EvalContext region_;
00135 
00136   RCP<AbstractEvalMediator> mediator_;
00137 
00138 };
00139 
00140 }
00141 
00142 #endif