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

CoordExpr.h

Go to the documentation of this file.
00001 #ifndef COORDEXPR_H
00002 #define COORDEXPR_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "ExprBase.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 UserLevelSymbolics
00020    * A function that varies linearly with one of the Cartesian coordinate
00021    * directions. You can use this to create arbitrary functions of position
00022    * using Expr operations.
00023    */
00024 
00025   class CoordExpr : public ExprBase
00026     {
00027     public:
00028       /** \name User-level methods */
00029       //@{
00030       /** Construct with a coordinate direction and a name for pretty-printing. */
00031       CoordExpr(int direction, const string& name);
00032 
00033       /** Construct with a coordinate direction */
00034       CoordExpr(int direction);
00035       //@}
00036 
00037       virtual ~CoordExpr(){;}
00038 
00039       /** \name Developer-only methods */
00040       //@{
00041       // evaluation
00042 
00043       /** average over the nodes of a cell */
00044       virtual ExprValue average(const Cell& cell) const ;
00045 
00046       /** */
00047       virtual void evaluate(const WorkSet& workSet,
00048                             const QuadratureFamily& quadFamily,
00049                             DenseSerialVector& result) const ;
00050 
00051       /** */
00052       virtual void evaluate(const AbstractFunctionSpace& targetSpace, const TSFArray<Cell>& cells,
00053                             const TSFArray<int>& cellIndices,
00054                             const TSFArray<int>& dofIndices,
00055                             const TSFArray<Point>& x,
00056                             DenseSerialVector& values) const ;
00057 
00058 
00059       // differentiation
00060       /** take derivative: first
00061        * derivative will be 1 if d=coordDirection, 0 otherwise. */
00062       virtual void derivative(const MultiIndex& d, Expr& result) const ;
00063 
00064       // ordering support
00065       /** */
00066       virtual bool operator==(const Expr& other) const ;
00067       /** */
00068       virtual bool operator<(const Expr& other) const ;
00069       /** */
00070       virtual int sortPriority() const {return COORDEXPR;}
00071 
00072       // RTTI
00073       /** identify self as a CoordExpr */
00074       virtual bool isCoordExpr() const {return true;}
00075 
00076       /** virtual copy ctor */
00077       virtual ExprBase* clone() const ;
00078 
00079       /** print */
00080       virtual void print(ostream& os, bool paren=false) const ;
00081       /** write to string */
00082       virtual string toString(bool paren=false) const ;
00083       /** write to XML form */
00084       virtual XMLObject toXML() const ;
00085 
00086       /** return name of coordinate */
00087       const string& name() const {return name_;}
00088       //@}
00089     private:
00090       int direction_;
00091       string name_;
00092 
00093     };
00094 
00095 
00096 }
00097 #endif
00098 
00099 
00100 
00101 
00102 

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


Documentation generated by