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

HoldExpr.h

Go to the documentation of this file.
00001 #ifndef HOLDEXPR_H
00002 #define HOLDEXPR_H
00003 
00004 #include "SundanceDefs.h"
00005 #include "UnaryExpr.h"
00006 #include "Expr.h"
00007 #include "DenseSerialVector.h"
00008 
00009 
00010 namespace Sundance
00011 {
00012 
00013   using namespace TSF;
00014   using std::string;
00015 
00016   using std::ostream;
00017 
00018   /**
00019    * \ingroup LowLevelSymbolics
00020    *
00021    * HoldExpr is a wrapper around an expression which prevents that expression from being
00022    * expanded using Sundance's normal simplification rules.
00023    */
00024 
00025   class HoldExpr : public UnaryExpr
00026     {
00027     public:
00028       //@{
00029       /** Construct with the expression to be held */
00030       HoldExpr(const Expr& expr) : UnaryExpr(expr, false) {;}
00031 
00032       /** */
00033       virtual ~HoldExpr(){;}
00034 
00035       /** */
00036       virtual double value() const {return expr_.value();}
00037 
00038       /** */
00039       virtual void evaluate(const WorkSet& workSet,
00040                             const QuadratureFamily& quadFamily,
00041                             DenseSerialVector& result) const ;
00042 
00043       /** */
00044       virtual void evaluate(const AbstractFunctionSpace& targetSpace, const TSFArray<Cell>& cells,
00045                             const TSFArray<int>& cellIndices,
00046                             const TSFArray<int>& dofIndices,
00047                             const TSFArray<Point>& x,
00048                             DenseSerialVector& values) const ;
00049 
00050 
00051       // ordering support
00052       /** */
00053       virtual bool operator==(const Expr& other) const ;
00054       /** */
00055       virtual bool operator<(const Expr& other) const ;
00056       /** */
00057       virtual int sortPriority() const {return HOLDEXPR;}
00058 
00059       // RTTI
00060       /** identify self as a HoldExpr */
00061       virtual bool isHoldExpr() const {return true;}
00062 
00063       /** */
00064       virtual bool isSpatiallyConstant() const {return expr_.isSpatiallyConstant();}
00065 
00066       /** virtual copy ctor */
00067       virtual ExprBase* clone() const ;
00068 
00069       /** extract the mesh */
00070       virtual bool getMesh(Mesh& mesh) const ;
00071 
00072       /** print */
00073       virtual void print(ostream& os, bool paren=false) const {expr_.print(os, paren);}
00074       /** write to string */
00075       virtual string toString(bool paren=false) const {return expr_.toString();}
00076       /** write to XML form */
00077       virtual XMLObject toXML() const {return expr_.toXML();}
00078 
00079       /** return name of coordinate */
00080       const string& name() const {return expr_.name();}
00081 
00082       /** */
00083       virtual void differential(const Expr& u, const Expr& du,
00084                                 Expr& result) const ;
00085 
00086       /** */
00087       virtual void substitute(const Expr& u, const Expr& u0,
00088                               Expr& result) const ;
00089       //@}
00090     private:
00091     };
00092 
00093 
00094 }
00095 #endif

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


Documentation generated by