00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 #ifndef SUNDANCE_CELLVECTOREXPR_H
00032 #define SUNDANCE_CELLVECTOREXPR_H
00033 
00034 #include "SundanceEvaluatorFactory.hpp"
00035 #include "SundanceCellVectorEvaluator.hpp"
00036 #include "SundanceExpr.hpp"
00037 
00038 namespace Sundance
00039 {
00040 using namespace Sundance;
00041 using namespace Sundance;
00042 
00043 
00044 enum CellVectorExprType {CellNormalVector, CellTangentSpace};
00045 
00046 
00047 
00048 
00049 
00050 
00051 class CellVectorExpr
00052   : public EvaluatableExpr,
00053     public GenericEvaluatorFactory<CellVectorExpr, CellVectorEvaluator>
00054 {
00055 public:
00056 
00057   CellVectorExpr(
00058     int normalComponentIndex, 
00059     int dimension,
00060     const std::string& name
00061     );
00062 
00063 
00064   CellVectorExpr(
00065     int tangentBasisIndex, 
00066     int tangentComponentIndex,
00067     int dimension,
00068     const std::string& name
00069     );
00070 
00071 
00072     
00073 
00074   virtual ~CellVectorExpr() {;}
00075 
00076 
00077   bool isTangent() const {return type_ == CellTangentSpace;}
00078 
00079 
00080   bool isNormal() const {return !isTangent();}
00081 
00082 
00083   int componentIndex() const {return componentIndex_;}
00084 
00085 
00086   int basisMemberIndex() const {return basisMemberIndex_;}
00087 
00088 
00089   int dimension() const {return dim_;}
00090 
00091 
00092   virtual XMLObject toXML() const ;
00093 
00094   const std::string& name() const {return name_;}
00095 
00096 
00097 
00098   virtual std::ostream& toText(std::ostream& os, bool paren) const ;
00099     
00100 
00101 
00102   virtual Set<MultipleDeriv> 
00103   internalFindW(int order, const EvalContext& context) const ;
00104 
00105 
00106   virtual RCP<ExprBase> getRcp() {return rcp(this);}
00107 
00108 
00109   virtual bool lessThan(const ScalarExpr* other) const ;
00110 private:
00111   std::string name_;
00112   int dim_;
00113   CellVectorExprType type_;
00114   int basisMemberIndex_;
00115   int componentIndex_;
00116   
00117 };
00118 
00119 
00120 
00121 Expr CellNormalExpr(int dimension, const std::string& name);
00122 
00123 
00124 Expr CellTangentExpr(int dimension, const std::string& name);
00125 
00126 }
00127 
00128 #endif