00001 /* @HEADER@ */ 00002 // ************************************************************************ 00003 // 00004 // Sundance 00005 // Copyright (2005) Sandia Corporation 00006 // 00007 // Copyright (year first published) Sandia Corporation. Under the terms 00008 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00009 // retains certain rights in this software. 00010 // 00011 // This library is free software; you can redistribute it and/or modify 00012 // it under the terms of the GNU Lesser General Public License as 00013 // published by the Free Software Foundation; either version 2.1 of the 00014 // License, or (at your option) any later version. 00015 // 00016 // This library is distributed in the hope that it will be useful, but 00017 // WITHOUT ANY WARRANTY; without even the implied warranty of 00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 // Lesser General Public License for more details. 00020 // 00021 // You should have received a copy of the GNU Lesser General Public 00022 // License along with this library; if not, write to the Free Software 00023 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00024 // USA 00025 // Questions? Contact Kevin Long (krlong@sandia.gov), 00026 // Sandia National Laboratories, Livermore, California, USA 00027 // 00028 // ************************************************************************ 00029 /* @HEADER@ */ 00030 00031 #ifndef SUNDANCE_SCALAREXPR_H 00032 #define SUNDANCE_SCALAREXPR_H 00033 00034 00035 #include "SundanceDefs.hpp" 00036 #include "PlayaExceptions.hpp" 00037 #include "Teuchos_XMLObject.hpp" 00038 #include "Teuchos_RefCountPtrDecl.hpp" 00039 #include "SundanceExprBase.hpp" 00040 #include "SundanceExpr.hpp" 00041 00042 namespace Sundance 00043 { 00044 00045 using namespace Sundance; 00046 using namespace Teuchos; 00047 00048 00049 00050 00051 00052 /** */ 00053 class ScalarExpr : virtual public ExprBase 00054 { 00055 public: 00056 /** empty ctor */ 00057 ScalarExpr(); 00058 00059 /** virtual destructor */ 00060 virtual ~ScalarExpr() {;} 00061 00062 00063 /** Indicate whether this expression is constant in space */ 00064 virtual bool isConstant() const {return false;} 00065 00066 00067 /** Indicate whether this expression is an immutable constant */ 00068 virtual bool isImmutable() const {return false;} 00069 00070 /** Indicate whether this expression is a "hungry" 00071 * differential operator that is awaiting an argument. */ 00072 virtual bool isHungryDiffOp() const {return false;} 00073 00074 /** Indicate whether the expression is independent of the given 00075 * functions */ 00076 virtual bool isIndependentOf(const Expr& u) const {return true;} 00077 00078 /** 00079 * Indicate whether the expression is nonlinear 00080 * with respect to test functions */ 00081 virtual bool isLinearInTests() const {return false;} 00082 00083 /** 00084 * Indicate whether every term in the expression contains test functions */ 00085 virtual bool everyTermHasTestFunctions() const {return hasTestFunctions();} 00086 00087 /** 00088 * Indicate whether the expression contains test functions */ 00089 virtual bool hasTestFunctions() const {return false;} 00090 /** 00091 * Indicate whether the expression contains unknown functions */ 00092 virtual bool hasUnkFunctions() const {return false;} 00093 00094 /** Indicate whether the expression is linear in the given 00095 * functions */ 00096 virtual bool isLinearForm(const Expr& u) const {return false;} 00097 00098 /** Indicate whether the expression is quadratic in the given 00099 * functions */ 00100 virtual bool isQuadraticForm(const Expr& u) const {return false;} 00101 00102 /** Find all the unknown functions in this expression. */ 00103 virtual void getUnknowns(Set<int>& unkID, Array<Expr>& unks) const {;} 00104 00105 /** Find all the test functions in this expression. */ 00106 virtual void getTests(Set<int>& varID, Array<Expr>& vars) const {;} 00107 00108 /** Ordering operator for use in transforming exprs 00109 * to standard form */ 00110 virtual bool lessThan(const ScalarExpr* other) const = 0 ; 00111 00112 00113 protected: 00114 private: 00115 }; 00116 } 00117 00118 #endif