Go to the documentation of this file.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
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef SUNDANCE_USERDEFOPELEMENT_H
00043 #define SUNDANCE_USERDEFOPELEMENT_H
00044
00045
00046 #include "SundanceDefs.hpp"
00047 #include "SundanceScalarExpr.hpp"
00048 #include "SundanceEvalContext.hpp"
00049 #include "SundanceMultiSet.hpp"
00050 #include "SundanceSet.hpp"
00051 #include "SundanceMultipleDeriv.hpp"
00052 #include "SundanceUserDefFunctor.hpp"
00053 #include "SundanceUserDefFunctorElement.hpp"
00054 #include "SundanceUserDefOpEvaluator.hpp"
00055
00056
00057 namespace Sundance
00058 {
00059 using namespace Sundance;
00060 using namespace Teuchos;
00061
00062
00063
00064
00065
00066 class UserDefOp;
00067
00068
00069
00070
00071 class UserDefOpElement : virtual public ExprWithChildren
00072 {
00073 public:
00074
00075 UserDefOpElement(const Array<RCP<ScalarExpr> >& args,
00076 const RCP<Sundance::Map<EvalContext, RCP<const UserDefOpCommonEvaluator> > >& evalMap,
00077 const RCP<const UserDefFunctorElement>& functorElement);
00078
00079
00080 virtual ~UserDefOpElement() {;}
00081
00082
00083
00084 int myIndex() const {return functorElement_->myIndex();}
00085
00086
00087
00088 virtual std::ostream& toText(std::ostream& os, bool paren) const ;
00089
00090
00091 virtual XMLObject toXML() const ;
00092
00093
00094 virtual RCP<ExprBase> getRcp() {return rcp(this);}
00095
00096
00097 const UserDefFunctorElement* functorElement() const
00098 {return functorElement_.get();}
00099
00100
00101 void reset() const ;
00102
00103
00104 Evaluator* createEvaluator(const EvaluatableExpr* expr,
00105 const EvalContext& context) const ;
00106
00107
00108 virtual void getArgDerivIndices(const Array<int>& orders,
00109 Sundance::Map<MultiSet<int>, int>& varArgDerivs,
00110 Sundance::Map<MultiSet<int>, int>& constArgDerivs) const ;
00111
00112 protected:
00113
00114
00115 RCP<const UserDefOpCommonEvaluator>
00116 getCommonEvaluator(const EvalContext& context) const ;
00117
00118 private:
00119 mutable RCP<Sundance::Map<EvalContext, RCP<const UserDefOpCommonEvaluator> > > commonEvaluatorsMap_;
00120 const RCP<const UserDefFunctorElement> functorElement_;
00121 };
00122 }
00123
00124 #endif