00001 // ************************************************************************ 00002 // 00003 // Sundance 00004 // Copyright (2005) Sandia Corporation 00005 // 00006 // Copyright (year first published) Sandia Corporation. Under the terms 00007 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government 00008 // retains certain rights in this software. 00009 // 00010 // This library is free software; you can redistribute it and/or modify 00011 // it under the terms of the GNU Lesser General Public License as 00012 // published by the Free Software Foundation; either version 2.1 of the 00013 // License, or (at your option) any later version. 00014 // 00015 // This library is distributed in the hope that it will be useful, but 00016 // WITHOUT ANY WARRANTY; without even the implied warranty of 00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 // Lesser General Public License for more details. 00019 // 00020 // You should have received a copy of the GNU Lesser General Public 00021 // License along with this library; if not, write to the Free Software 00022 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00023 // USA 00024 // Questions? Contact Kevin Long (krlong@sandia.gov), 00025 // Sandia National Laboratories, Livermore, California, USA 00026 // 00027 // ************************************************************************ 00028 /* @HEADER@ */ 00029 00030 #ifndef SUNDANCE_EXPLICITFUNCTIONALDERIVATIVEELEMENT_H 00031 #define SUNDANCE_EXPLICITFUNCTIONALDERIVATIVEELEMENT_H 00032 00033 00034 #include "SundanceDefs.hpp" 00035 #include "SundanceScalarExpr.hpp" 00036 #include "SundanceUnaryExpr.hpp" 00037 #include "SundanceEvalContext.hpp" 00038 #include "SundanceMultiSet.hpp" 00039 #include "SundanceSet.hpp" 00040 #include "SundanceMultipleDeriv.hpp" 00041 #include "SundanceExprWithChildren.hpp" 00042 00043 00044 namespace Sundance 00045 { 00046 using namespace Sundance; 00047 using namespace Teuchos; 00048 00049 00050 00051 00052 00053 /** 00054 * Scalar element of an explicit user-level functional derivative 00055 */ 00056 class ExplicitFunctionalDerivativeElement 00057 : virtual public UnaryExpr 00058 { 00059 public: 00060 /** */ 00061 ExplicitFunctionalDerivativeElement( 00062 const RCP<ScalarExpr>& arg, 00063 const Deriv& fd 00064 ); 00065 00066 /** virtual destructor */ 00067 virtual ~ExplicitFunctionalDerivativeElement() {;} 00068 00069 /** */ 00070 virtual Set<MultipleDeriv> 00071 internalFindW(int order, const EvalContext& context) const ; 00072 00073 00074 /** */ 00075 virtual Set<MultipleDeriv> 00076 internalFindV(int order, const EvalContext& context) const ; 00077 00078 00079 /** */ 00080 virtual Set<MultipleDeriv> 00081 internalFindC(int order, const EvalContext& context) const ; 00082 00083 00084 /** */ 00085 virtual RCP<Array<Set<MultipleDeriv> > > 00086 internalDetermineR(const EvalContext& context, 00087 const Array<Set<MultipleDeriv> >& RInput) const ; 00088 00089 00090 /** Write self in text form */ 00091 virtual std::ostream& toText(std::ostream& os, bool paren) const ; 00092 00093 /** Write in XML */ 00094 virtual XMLObject toXML() const ; 00095 00096 /** */ 00097 virtual RCP<ExprBase> getRcp() {return rcp(this);} 00098 00099 /** */ 00100 void reset() const ; 00101 00102 /** */ 00103 Evaluator* createEvaluator(const EvaluatableExpr* expr, 00104 const EvalContext& context) const ; 00105 00106 /** */ 00107 virtual bool lessThan(const ScalarExpr* other) const ; 00108 00109 00110 /** */ 00111 const Deriv& fd() const {return fd_;} 00112 00113 protected: 00114 private: 00115 Deriv fd_; 00116 }; 00117 00118 } 00119 00120 00121 #endif