SundanceEvalManager.hpp
Go to the documentation of this file.
00001 /* @HEADER@ */
00002 // ************************************************************************
00003 // 
00004 //                              Sundance
00005 //                 Copyright (2005) Sandia Corporation
00006 // 
00007 // Copyright (year first published) Sandia Corporation.  Under the terms 
00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 
00009 // retains certain rights in this software.
00010 // 
00011 // This library is free software; you can redistribute it and/or modify
00012 // it under the terms of the GNU Lesser General Public License as
00013 // published by the Free Software Foundation; either version 2.1 of the
00014 // License, or (at your option) any later version.
00015 //  
00016 // This library is distributed in the hope that it will be useful, but
00017 // WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00019 // Lesser General Public License for more details.
00020 //                                                                                 
00021 // You should have received a copy of the GNU Lesser General Public
00022 // License along with this library; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00024 // USA                                                                                
00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 
00026 // Sandia National Laboratories, Livermore, California, USA
00027 // 
00028 // ************************************************************************
00029 /* @HEADER@ */
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  * EvalManager provides methods for interfacing to the framework
00051  * through an AbstractEvalMediator and managing temporary variables
00052  * through a TempStack.
00053  *
00054  * If no mediator is set, std::string evaluations will be done 
00055  */
00056 class EvalManager : public Noncopyable
00057 {
00058 public:
00059   /** Empty ctor */
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   /** Return a pointer to the mediator. We'll need the
00104    * mediator for computing framework-specific functions.
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

Site Contact