Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

RegionalExpr.h

Go to the documentation of this file.
00001 #ifndef REGIONALEXPR_H
00002 #define REGIONALEXPR_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "Expr.h"
00007 #include "DenseSerialVector.h"
00008 #include "ExprHashtable.h"
00009 
00010 
00011 namespace Sundance
00012 {
00013 
00014   using namespace TSF;
00015   using std::string;
00016 
00017   using std::ostream;
00018 
00019   /**
00020    * \ingroup UserLevelSymbolics
00021    * RegionalExpr is an expression that takes on different definitions in different
00022    * labeled regions.
00023    */
00024 
00025   class RegionalExpr : public ExprBase
00026     {
00027     public:
00028       /** \name User-level methods */
00029       //@{
00030       RegionalExpr(const string& name = "");
00031       //@}
00032 
00033       virtual ~RegionalExpr(){;}
00034 
00035       /** \name Developer-only methods */
00036       //@{
00037       // evaluation
00038 
00039       /** average over the nodes of a cell */
00040       virtual ExprValue average(const Cell& cell) const ;
00041 
00042       /** */
00043       virtual void evaluate(const WorkSet& workSet,
00044                             const QuadratureFamily& quadFamily,
00045                             DenseSerialVector& result) const ;
00046 
00047       /** */
00048       virtual void evaluate(const AbstractFunctionSpace& targetSpace, const TSFArray<Cell>& cells,
00049                             const TSFArray<int>& cellIndices,
00050                             const TSFArray<int>& dofIndices,
00051                             const TSFArray<Point>& x,
00052                             DenseSerialVector& values) const ;
00053 
00054 
00055       /** take derivative: first
00056        * derivative will be 1 if d=coordDirection, 0 otherwise. */
00057       virtual void derivative(const MultiIndex& d, Expr& result) const ;
00058 
00059       /** */
00060       virtual const Expr& getRegionalExpr(const string& region) const ;
00061 
00062       /** */
00063       virtual bool isDefinedOnRegion(const string& region) const ;
00064 
00065       /** */
00066       virtual void setRegionalExpr(const string& region, const Expr& expr);
00067 
00068       // ordering support
00069       /** */
00070       virtual bool operator==(const Expr& other) const ;
00071       /** */
00072       virtual bool operator<(const Expr& other) const ;
00073       /** */
00074       virtual int sortPriority() const {return REGIONALEXPR;}
00075 
00076       // RTTI
00077       /** identify self as a RegionalExpr */
00078       virtual bool isRegionalExpr() const {return true;}
00079 
00080       /** virtual copy ctor */
00081       virtual ExprBase* clone() const ;
00082 
00083       /** print */
00084       virtual void print(ostream& os, bool paren=false) const ;
00085       /** write to string */
00086       virtual string toString(bool paren=false) const ;
00087       /** write to XML form */
00088       virtual XMLObject toXML() const ;
00089 
00090       /** return name of expr */
00091       const string& name() const {return name_;}
00092 
00093       /** */
00094       virtual void differential(const Expr& u, const Expr& du,
00095                                 Expr& result) const ;
00096 
00097       /** */
00098       virtual void substitute(const Expr& u, const Expr& u0,
00099                               Expr& result) const ;
00100       //@}
00101     private:
00102 
00103       string name_;
00104 
00105       ExprHashtable exprs_;
00106 
00107       static int topID_;
00108 
00109     };
00110 
00111 
00112 }
00113 #endif
00114 
00115 
00116 
00117 
00118 

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by