本文整理汇总了C++中EvalContext类的典型用法代码示例。如果您正苦于以下问题:C++ EvalContext类的具体用法?C++ EvalContext怎么用?C++ EvalContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EvalContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculate
void WaitPhase::calculate(EvalContext context)
{
if (context.ib()->rule_exec->phase == m_data->phase) {
children().back()->eval(context);
forward(children().back());
}
}
示例2: leftEvaluatable
Set<MultiSet<int> > ProductExpr::internalFindQ_V(int order, const EvalContext& context) const
{
Tabs tab0(0);
int verb = context.setupVerbosity();
SUNDANCE_MSG2(verb, tab0 << "ProdExpr::internalFindQ_V(" << order << ")");
Set<MultiSet<int> > rtn;
if (order > 1) return rtn;
const Set<MultipleDeriv>& vLeft
= leftEvaluatable()->findV(0, context);
const Set<MultipleDeriv>& vRight
= rightEvaluatable()->findV(0, context);
if (order==0)
{
if (vLeft.size() > 0)
{
rtn.put(makeMultiSet<int>(0));
}
if (vRight.size() > 0)
{
rtn.put(makeMultiSet<int>(1));
}
}
if (order==1)
{
if (vLeft.size() > 0) rtn.put(makeMultiSet<int>(1));
if (vRight.size() > 0) rtn.put(makeMultiSet<int>(0));
}
SUNDANCE_MSG2(verb, tab0 << "Q_V[" << order << "]=" << rtn);
return rtn;
}
示例3: tabs
Set<MultipleDeriv> DiffOp::internalFindC(int order, const EvalContext& context) const
{
Tabs tabs(0);
int verb = context.setupVerbosity();
SUNDANCE_MSG2(verb, tabs << "DiffOp::internalFindC() for "
<< toString());
Set<MultipleDeriv> rtn ;
{
Tabs tab1;
SUNDANCE_MSG5(verb, tab1 << "finding R");
const Set<MultipleDeriv>& R = findR(order, context);
SUNDANCE_MSG5(verb, tab1 << "finding V");
const Set<MultipleDeriv>& V = findV(order, context);
/** Call findC() to ensure that the argument has C tabulated */
evaluatableArg()->findC(order, context);
SUNDANCE_MSG5(verb, tab1 << "R=" << R);
SUNDANCE_MSG5(verb, tab1 << "V=" << V);
rtn = R.setDifference(V);
SUNDANCE_MSG3(verb, tabs << "C[" << order << "]=" << rtn);
}
SUNDANCE_MSG2(verb, tabs << "C[" << order << "]=R\\V = " << rtn);
SUNDANCE_MSG2(verb, tabs << "done with DiffOp::internalFindC for "
<< toString());
return rtn;
}
示例4: tabs
Set<MultipleDeriv> ExplicitFunctionalDerivativeElement
::internalFindC(int order, const EvalContext& context) const
{
Tabs tabs(0);
int verb = context.setupVerbosity();
SUNDANCE_MSG2(verb, tabs << "ExplicitFunctionalDerivativeElement::internalFindC() for "
<< toString());
Set<MultipleDeriv> rtn ;
if (order < 3)
{
Tabs tab1;
SUNDANCE_MSG5(verb, tab1 << "finding R");
const Set<MultipleDeriv>& R = findR(order, context);
SUNDANCE_MSG5(verb, tab1 << "R=" << R);
SUNDANCE_MSG5(verb, tab1 << "finding C for arg");
const Set<MultipleDeriv>& argC
= evaluatableArg()->findC(order+1, context);
SUNDANCE_MSG5(verb, tab1 << "argC=" << argC);
MultipleDeriv me(fd_);
Set<MultipleDeriv> tmp = setDivision(argC, makeSet(me));
rtn = tmp.intersection(R);
}
SUNDANCE_MSG2(verb, tabs << "C[" << order << "]=" << rtn);
SUNDANCE_MSG2(verb, tabs << "done with ExplicitFunctionalDerivativeElement::internalFindC for "
<< toString());
return rtn;
}
示例5: me
Set<MultipleDeriv> ExplicitFunctionalDerivativeElement
::internalFindW(int order, const EvalContext& context) const
{
Tabs tab0(0);
int verb = context.setupVerbosity();
SUNDANCE_MSG2(verb, tab0
<< "ExplicitFunctionalDerivativeElement::internalFindW(order="
<< order << ") for " << toString());
Set<MultipleDeriv> rtn ;
if (order < 3)
{
Tabs tab1;
const Set<MultipleDeriv>& WArgPlus
= evaluatableArg()->findW(order+1, context);
SUNDANCE_MSG5(verb, tab1 << "WArgPlus = " << WArgPlus);
MultipleDeriv me(fd_);
Set<MultipleDeriv> WargPlusOslashFD = setDivision(WArgPlus, makeSet(me));
SUNDANCE_MSG5(verb, tab1 << "WArgPlus / fd = "
<< WargPlusOslashFD);
rtn = WargPlusOslashFD;
}
SUNDANCE_MSG2(verb, tab0 << "W[" << order << "]=" << rtn);
SUNDANCE_MSG2(verb, tab0 << "done with ExplicitFunctionalDerivativeElement::internalFindW(" << order << ") for "
<< toString());
return rtn;
}
示例6: setupEval
void EvaluatableExpr::setupEval(const EvalContext& context) const
{
Tabs tabs0(0);
int verb = context.evalSetupVerbosity();
SUNDANCE_MSG1(verb, tabs0 << "setupEval() for " << this->toString());
if (!evaluators_.containsKey(context))
{
Tabs tabs;
SUNDANCE_MSG2(verb, tabs << "creating new evaluator...");
SUNDANCE_MSG2(verb, tabs << "my sparsity superset = " << std::endl
<< *sparsitySuperset(context));
RCP<Evaluator> eval;
if (sparsitySuperset(context)->numDerivs()>0)
{
SUNDANCE_MSG2(verb, tabs << "calling createEvaluator()");
eval = rcp(createEvaluator(this, context));
}
else
{
SUNDANCE_MSG2(verb,
tabs << "EE: no results needed... creating null evaluator");
eval = rcp(new NullEvaluator());
}
evaluators_.put(context, eval);
}
else
{
Tabs tabs;
SUNDANCE_MSG2(verb, tabs << "reusing existing evaluator...");
}
}
示例7: requestMultiIndexAtEvalPoint
void DiffOp::requestMultiIndexAtEvalPoint(const MultiIndex& mi,
const MultipleDeriv& u,
const EvalContext& context) const
{
int verb = context.setupVerbosity();
Tabs tab0(0);
SUNDANCE_MSG3(verb, tab0 << "DiffOp::requestMultiIndexAtEvalPoint() for=" << toString());
TEUCHOS_TEST_FOR_EXCEPT(u.size() != 1);
const Deriv& d = *(u.begin());
if (d.isFunctionalDeriv())
{
const SpatialDerivSpecifier& sds = d.opOnFunc();
TEUCHOS_TEST_FOR_EXCEPTION(sds.isDivergence(), std::logic_error,
"divergence operators not possible within DiffOp");
TEUCHOS_TEST_FOR_EXCEPTION(sds.isNormal(), std::logic_error,
"normal deriv operators not possible within DiffOp");
const MultiIndex& newMi = sds.mi();
const SymbolicFuncElement* sfe = d.symbFuncElem();
TEUCHOS_TEST_FOR_EXCEPT(sfe == 0);
const EvaluatableExpr* evalPt = sfe->evalPt();
const ZeroExpr* z = dynamic_cast<const ZeroExpr*>(evalPt);
if (z != 0) return;
const DiscreteFuncElement* df
= dynamic_cast<const DiscreteFuncElement*>(evalPt);
df->addMultiIndex(newMi);
df->findW(1, context);
df->findV(1, context);
df->findC(1, context);
}
}
示例8: Evaluate
Value OrExpr::Evaluate(SymbolTable *scope, EvalContext& context, bool asbool)
{
// Scope override; must do this for every expression that might contain an identifier
if(this->scope != NULL)
scope = this->scope;
// Lowering of A or B:
// [A]
// [iftrue goto end]
// [B]
// label end:
String* value = new String();
string labelbase = context.GetUniqueLabelName();
Anchor* endanchor = new Anchor(labelbase + ".end");
// a
value->Append( a->Evaluate(scope, context, true).ToCodeString() );
// iftrue goto end:
value->Code("1B 03 FF FF FF FF");
value->AddReference(value->GetPos()-4, endanchor);
// b
value->Append( b->Evaluate(scope, context, true).ToCodeString() );
// end:
value->AddAnchor(endanchor);
return Value(value);
}
示例9: findR
Set<MultipleDeriv>
ConstantExpr::internalFindC(int order, const EvalContext& context) const
{
Tabs tab;
SUNDANCE_MSG2(context.setupVerbosity(),
tab << "ConstantExpr::internalFindC is forwarding to findR()");
return findR(order, context);
}
示例10:
Set<MultipleDeriv>
ConstantExpr::internalFindV(int order, const EvalContext& context) const
{
Set<MultipleDeriv> rtn;
Tabs tab;
SUNDANCE_MSG2(context.setupVerbosity(),
tab << "ConstantExpr::internalFindV is a no-op");
return rtn;
}
示例11: value_calculate
Value Operator::value_calculate(Value v, EvalContext context)
{
static const char* c_capture_name = "predicate_operator_capture";
if (! m_data) {
BOOST_THROW_EXCEPTION(
einval() << errinfo_what(
"Evaluation without pre evaluation!"
)
);
}
IronBee::Field capture = IronBee::Field::create_no_copy_list<void *>(
context.memory_pool(),
c_capture_name,
sizeof(c_capture_name) - 1,
List<void *>::create(context.memory_pool())
);
int success = 0;
try {
success = m_data->op.execute_instance(
m_data->instance_data,
context,
v,
capture
);
}
catch (const error& e) {
string old_what = *boost::get_error_info<errinfo_what>(e);
e << errinfo_what(
"Predicate operator failure for " +
to_s() + " : " + old_what
);
throw e;
}
if (success) {
return capture;
}
else {
return Value();
}
}
示例12:
Set<MultipleDeriv>
UnknownParameterElement::internalFindV(int order, const EvalContext& context) const
{
Tabs tab;
SUNDANCE_MSG2(context.setupVerbosity(),
tab << "UPE::internalFindV is a no-op");
Set<MultipleDeriv> rtn;
return rtn;
}
示例13:
Set<MultipleDeriv>
ZeroExpr::internalFindC(int order, const EvalContext& context) const
{
Set<MultipleDeriv> rtn;
Tabs tab;
SUNDANCE_MSG2(context.setupVerbosity(),
tab << "ZeroExpr::internalFindC found" << rtn << " for order="
<< order);
return rtn;
}
示例14: toString
RCP<SparsitySuperset>
EvaluatableExpr::sparsitySuperset(const EvalContext& context) const
{
Tabs tab;
SUNDANCE_MSG2(context.setupVerbosity(),
tab << "getting sparsity superset for " << toString());
RCP<SparsitySuperset> rtn;
if (sparsity_.containsKey(context))
{
Tabs tab1;
SUNDANCE_MSG2(context.setupVerbosity(),
tab1 << "reusing previously computed data...");
rtn = sparsity_.get(context);
}
else
{
Tabs tab1;
SUNDANCE_MSG2(context.setupVerbosity(),
tab1 << "computing from scratch...");
const Set<MultipleDeriv>& R = findR(context);
const Set<MultipleDeriv>& C = findC(context);
const Set<MultipleDeriv>& V = findV(context);
if (context.setupVerbosity() > 4)
{
Out::os() << tab1 << "R=" << R << endl;
Out::os() << tab1 << "C=" << C << endl;
Out::os() << tab1 << "V=" << V << endl;
}
rtn = rcp(new SparsitySuperset(C.intersection(R), V.intersection(R)));
sparsity_.put(context, rtn);
}
return rtn;
}
示例15: findW
Set<MultiSet<int> > ProductExpr::internalFindQ_W(int order, const EvalContext& context) const
{
Tabs tab0(0);
int verb = context.setupVerbosity();
SUNDANCE_MSG2(verb, tab0 << "ProdExpr::internalFindQ_W(" << order << ")");
Set<MultiSet<int> > rtn;
if (order > 2) return rtn;
if (order==2)
{
rtn.put(makeMultiSet<int>(0,1));
return rtn;
}
Tabs tab1;
SUNDANCE_MSG3(verb, tab1 << "calling findW(0) for left");
const Set<MultipleDeriv>& wLeft
= leftEvaluatable()->findW(0, context);
SUNDANCE_MSG3(verb, tab1 << "found wLeft(0)=" << wLeft);
SUNDANCE_MSG3(verb, tab1 << "calling findW(0) for right");
const Set<MultipleDeriv>& wRight
= rightEvaluatable()->findW(0, context);
SUNDANCE_MSG3(verb, tab1 << "found wRight(0)=" << wRight);
if (order==0)
{
if (wLeft.size() > 0)
{
rtn.put(makeMultiSet<int>(0));
}
if (wRight.size() > 0)
{
rtn.put(makeMultiSet<int>(1));
}
}
if (order==1)
{
if (wLeft.size() > 0) rtn.put(makeMultiSet<int>(1));
if (wRight.size() > 0) rtn.put(makeMultiSet<int>(0));
}
SUNDANCE_MSG2(verb, tab0 << "Q_W[" << order << "]=" << rtn);
return rtn;
}