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 "SundanceConstantExpr.hpp"
00043
00044 using namespace Sundance;
00045 using namespace Sundance;
00046
00047 using namespace Sundance;
00048 using namespace Teuchos;
00049
00050 ConstantExpr::ConstantExpr(const double& value)
00051 : SpatiallyConstantExpr(), value_(value)
00052 {}
00053
00054
00055
00056 Set<MultipleDeriv>
00057 ConstantExpr::internalFindW(int order, const EvalContext& context) const
00058 {
00059 Set<MultipleDeriv> rtn;
00060
00061 if (order==0) rtn.put(MultipleDeriv());
00062 Tabs tab;
00063 SUNDANCE_MSG2(context.setupVerbosity(),
00064 tab << "ConstantExpr::internalFindW found" << rtn << " for order="
00065 << order);
00066
00067 return rtn;
00068 }
00069
00070 Set<MultipleDeriv>
00071 ConstantExpr::internalFindV(int order, const EvalContext& context) const
00072 {
00073 Set<MultipleDeriv> rtn;
00074 Tabs tab;
00075 SUNDANCE_MSG2(context.setupVerbosity(),
00076 tab << "ConstantExpr::internalFindV is a no-op");
00077 return rtn;
00078 }
00079
00080
00081 Set<MultipleDeriv>
00082 ConstantExpr::internalFindC(int order, const EvalContext& context) const
00083 {
00084 Tabs tab;
00085 SUNDANCE_MSG2(context.setupVerbosity(),
00086 tab << "ConstantExpr::internalFindC is forwarding to findR()");
00087 return findR(order, context);
00088 }
00089
00090
00091 bool ConstantExpr::lessThan(const ScalarExpr* other) const
00092 {
00093 const ConstantExpr* c = dynamic_cast<const ConstantExpr*>(other);
00094 TEUCHOS_TEST_FOR_EXCEPTION(c==0, std::logic_error, "cast should never fail at this point");
00095 return value() < c->value();
00096 }
00097
00098
00099 std::ostream& ConstantExpr::toText(std::ostream& os, bool ) const
00100 {
00101 os << value();
00102 return os;
00103 }
00104
00105
00106 XMLObject ConstantExpr::toXML() const
00107 {
00108 XMLObject rtn("Constant");
00109 rtn.addAttribute("value", Teuchos::toString(value()));
00110 return rtn;
00111 }
00112
00113