void CurveNormEvaluator::internalEval(const EvalManager& mgr, Array<double>& constantResults, Array<RCP<EvalVector> >& vectorResults) const { Tabs tabs(0); SUNDANCE_MSG2(mgr.verb(), tabs << "CurveNormEvaluator::eval() expr=" << expr()->toString()); if (mgr.verb() > 2) { Out::os() << tabs << "sparsity = " << std::endl << tabs << *(this->sparsity)() << std::endl; } if (this->sparsity()->numDerivs() > 0) { vectorResults.resize(1); vectorResults[0] = mgr.popVector(); SUNDANCE_MSG3(mgr.verb(), tabs << "forwarding to evaluation manager"); mgr.evalCurveNormExpr(expr(), vectorResults[0]); mgr.stack().setVecSize(vectorResults[0]->length()); if (EvalVector::shadowOps()) vectorResults[0]->setString(stringRep_); } if (mgr.verb() > 1) { Out::os() << tabs << "results " << std::endl; mgr.showResults(Out::os(), this->sparsity(), vectorResults, constantResults); } }
void DiscreteFuncElementEvaluator ::internalEval(const EvalManager& mgr, Array<double>& constantResults, Array<RCP<EvalVector> >& vectorResults) const { Tabs tabs(0); SUNDANCE_MSG1(mgr.verb(), tabs << "DiscreteFuncElementEvaluator::eval: expr=" << expr()->toString()); vectorResults.resize(mi_.size()); for (int i=0; i<mi_.size(); i++) { Tabs tab2; vectorResults[i] = mgr.popVector(); TEUCHOS_TEST_FOR_EXCEPTION(!vectorResults[i]->isValid(), std::logic_error, "invalid evaluation vector allocated in " "DiscreteFuncElementEvaluator::internalEval()"); SUNDANCE_MSG2(mgr.verb(),tab2<< "setting string rep " << stringReps_[i]); vectorResults[i]->setString(stringReps_[i]); } mgr.evalDiscreteFuncElement(expr(), mi_, vectorResults); mgr.stack().setVecSize(vectorResults[0]->length()); if (mgr.verb() > 1) { Out::os() << tabs << "results " << std::endl; mgr.showResults(Out::os(), sparsity(), vectorResults, constantResults); } SUNDANCE_MSG1(mgr.verb(), tabs << "DiscreteFuncEvaluator::eval() done"); }
void CoordExprEvaluator::internalEval(const EvalManager& mgr, Array<double>& constantResults, Array<RCP<EvalVector> >& vectorResults) const { Tabs tabs(0); SUNDANCE_MSG1(mgr.verb(), tabs << "CoordExprEvaluator::eval() expr=" << expr()->toString()); SUNDANCE_MSG2(mgr.verb(), tabs << "sparsity = " << std::endl << *(this->sparsity)()) if (doValue_) { Tabs tab2; SUNDANCE_MSG3(mgr.verb(), tab2 << "computing value"); vectorResults.resize(1); vectorResults[0] = mgr.popVector(); mgr.evalCoordExpr(expr(), vectorResults[0]); mgr.stack().setVecSize(vectorResults[0]->length()); vectorResults[0]->setString(stringRep_); } if (doDeriv_) { Tabs tab2; SUNDANCE_MSG3(mgr.verb(), tab2 << "computing derivative"); constantResults.resize(1); constantResults[0] = 1.0; } if (mgr.verb() > 1) { Tabs tab1; Out::os() << tab1 << "results " << std::endl; mgr.showResults(Out::os(), this->sparsity(), vectorResults, constantResults); } }