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_FUNCELEMENTBASE_H 00032 #define SUNDANCE_FUNCELEMENTBASE_H 00033 00034 00035 #include "SundanceDefs.hpp" 00036 #include "SundanceEvaluatableExpr.hpp" 00037 #include "SundanceEvalContext.hpp" 00038 #include "SundanceMultiSet.hpp" 00039 #include "SundanceSet.hpp" 00040 #include "SundanceMultipleDeriv.hpp" 00041 #include "SundanceFunctionWithID.hpp" 00042 00043 00044 namespace Sundance 00045 { 00046 using namespace Sundance; 00047 using namespace Teuchos; 00048 00049 00050 00051 00052 00053 /** 00054 * FuncElementBase defines the interface for scalar-valued elements 00055 * of Sundance functions. At the user level, Sundance functions can be 00056 * list (e.g, vector or tensor) valued; internally, however, compound 00057 * expressions use only scalar functions deriving from the 00058 * FuncElementBase class. 00059 */ 00060 class FuncElementBase : public virtual ScalarExpr, 00061 public FunctionWithID 00062 { 00063 public: 00064 /** */ 00065 FuncElementBase(const std::string& rootName, 00066 const std::string& suffix, 00067 const FunctionIdentifier& fid); 00068 /** */ 00069 FuncElementBase(const std::string& rootName); 00070 00071 /** virtual destructor */ 00072 virtual ~FuncElementBase() {;} 00073 00074 /** Return the name of this function */ 00075 const std::string& name() const {return name_;} 00076 00077 /** Return the root name of this function */ 00078 const std::string& rootName() const {return rootName_;} 00079 00080 /** Return the root name of this function */ 00081 const std::string& suffix() const {return suffix_;} 00082 00083 /** Write self in text form */ 00084 virtual std::ostream& toText(std::ostream& os, bool paren) const ; 00085 00086 /** Ordering operator for use in transforming exprs to standard form */ 00087 virtual bool lessThan(const ScalarExpr* other) const ; 00088 00089 00090 protected: 00091 private: 00092 00093 std::string name_; 00094 00095 std::string rootName_; 00096 00097 std::string suffix_; 00098 }; 00099 00100 } 00101 00102 #endif