00001 #ifndef FUNCTIONALEVALUATOR_H 00002 #define FUNCTIONALEVALUATOR_H 00003 00004 #include "SundanceDefs.h" 00005 #include "TSFHashtable.h" 00006 #include "Expr.h" 00007 #include "CellSet.h" 00008 #include "QuadratureFamily.h" 00009 00010 namespace Sundance 00011 { 00012 00013 using namespace TSF; 00014 using std::string; 00015 00016 using std::ostream; 00017 00018 /** \ingroup LowLevelFE 00019 */ 00020 00021 class FunctionalEvaluator 00022 { 00023 public: 00024 /** */ 00025 double evaluate(const Mesh& mesh, const Expr& u, const Expr& u0) const ; 00026 00027 /** */ 00028 double evaluate(const Mesh& mesh) const ; 00029 00030 /** */ 00031 static FunctionalEvaluator& createAndCache(const Expr& integral, int& key); 00032 /** */ 00033 static FunctionalEvaluator& getEvaluator(int key); 00034 00035 /** */ 00036 static bool& verboseInit() {static bool rtn = false; return rtn;} 00037 00038 /** */ 00039 static bool& verboseCalculations() {static bool rtn = false; return rtn;} 00040 private: 00041 /** Ctor is private. Construction of FunctionalEvaluators should be done through the 00042 * createAndCache() method */ 00043 FunctionalEvaluator(const Expr& integral); 00044 00045 /** */ 00046 void createWorkSets(const Mesh& mesh) const ; 00047 00048 TSFArray<CellSet> cellSets_; 00049 TSFArray<TSFArray<QuadratureFamily> > quad_; 00050 TSFArray<ExprArray> exprs_; 00051 Expr nonIntegralTerms_; 00052 00053 mutable TSFHashtable<int, TSFArray<TSFHashtable<CellTopologyCode, TSFSmartPtr<TSFArray<CellBlock> > > > > cellBlocks_; 00054 00055 mutable TSFHashtable<int, TSFArray<TSFNonDupArray<CellTopologyCode> > > cellTypes_; 00056 mutable TSFHashtable<int, TSFHashtable<CellTopologyCode, TSFSmartPtr<WorkSet> > > workSetTable_; 00057 00058 mutable int workSetSize_; 00059 00060 static TSFArray<TSFSmartPtr<FunctionalEvaluator> >& cache(); 00061 static int& topKey(); 00062 }; 00063 00064 } 00065 #endif