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 #include "SundanceDerivOfSymbFunc.hpp"
00043
00044 #include "SundanceTestFuncElement.hpp"
00045
00046 #include "SundanceCoordExpr.hpp"
00047 #include "PlayaTabs.hpp"
00048 #include "SundanceOut.hpp"
00049
00050 using namespace Sundance;
00051 using namespace Sundance;
00052
00053 using namespace Sundance;
00054 using namespace Teuchos;
00055
00056
00057 DerivOfSymbFunc::DerivOfSymbFunc(const MultiIndex& op,
00058 const RCP<ScalarExpr>& arg)
00059 : DiffOp(op, arg), argFid_(FunctionIdentifier())
00060 {
00061 const SymbolicFuncElement* f
00062 = dynamic_cast<const SymbolicFuncElement*>(evaluatableArg());
00063 TEUCHOS_TEST_FOR_EXCEPTION(f==0, std::logic_error, "argument to DerivOfSymbFunc ctor "
00064 "is not a symbolic function");
00065 argFid_ = f->fid();
00066 }
00067
00068
00069 Deriv DerivOfSymbFunc::representMeAsFunctionalDeriv() const
00070 {
00071 const SymbolicFuncElement* f
00072 = dynamic_cast<const SymbolicFuncElement*>(evaluatableArg());
00073 TEUCHOS_TEST_FOR_EXCEPTION(f==0, std::logic_error, "DerivOfSymbFunc::"
00074 "representMeAsFunctionalDeriv(), 'this' pointer "
00075 "is not a symbolic function");
00076 return Deriv(f, SpatialDerivSpecifier(mi()));
00077 }
00078
00079 Evaluator* DerivOfSymbFunc::createEvaluator(const EvaluatableExpr* expr,
00080 const EvalContext& context) const
00081 {
00082 return new DerivOfSymbFuncEvaluator(dynamic_cast<const DerivOfSymbFunc*>(expr), context);
00083 }
00084
00085
00086 bool DerivOfSymbFunc::lessThan(const ScalarExpr* other) const
00087 {
00088 const DerivOfSymbFunc* d = dynamic_cast<const DerivOfSymbFunc*>(other);
00089 TEUCHOS_TEST_FOR_EXCEPTION(d==0, std::logic_error, "cast should never fail at this point");
00090
00091 if (argFid_ < d->argFid_) return true;
00092 if (d->argFid_ < argFid_) return false;
00093
00094 return DiffOp::lessThan(other);
00095 }