本文整理汇总了C++中CExpression::calcValue方法的典型用法代码示例。如果您正苦于以下问题:C++ CExpression::calcValue方法的具体用法?C++ CExpression::calcValue怎么用?C++ CExpression::calcValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CExpression
的用法示例。
在下文中一共展示了CExpression::calcValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotDerivButtonPressed
void CQMathMatrixWidget::slotDerivButtonPressed()
{
#ifdef _DERIV_TEST_
std::cout << "Deriv" << std::endl;
CModel* pModel = CCopasiRootContainer::getDatamodelList()->operator[](0).getModel();
CEvaluationNode* tmpnode = pModel->prepareElasticity(&pModel->getReactions()[0],
&pModel->getMetabolites()[0], false);
CEvaluationNode* tmpnode2 = pModel->prepareElasticity(&pModel->getReactions()[0],
&pModel->getMetabolites()[0], true);
//create empty environment. Variable nodes should not occur in an expression
std::vector<std::vector<std::string> > env;
std::string tmpstring = tmpnode->buildMMLString(false, env);
std::string tmpstring2 = tmpnode2->buildMMLString(false, env);
mpMML->setBaseFontPointSize(qApp->font().pointSize());
mpMML->setFontName(QtMmlWidget::NormalFont, qApp->font().family());
mpMML->setContent(tmpstring.c_str());
mpMML2->setBaseFontPointSize(qApp->font().pointSize());
mpMML2->setFontName(QtMmlWidget::NormalFont, qApp->font().family());
mpMML2->setContent(tmpstring2.c_str());
QTableWidget * pTable = new QTableWidget(pModel->getReactions().size(), pModel->getMetabolites().size());
pTable->show();
int i, imax = pModel->getMetabolites().size();
int j, jmax = pModel->getReactions().size();
for (i = 0; i < imax; ++i)
for (j = 0; j < jmax; ++j)
{
//CEvaluationNode* tmpnode = pModel->prepareElasticity(pModel->getReactions()[j],
// pModel->getMetabolites()[i], false);
CEvaluationNode* tmpnode2 = pModel->prepareElasticity(&pModel->getReactions()[j],
&pModel->getMetabolites()[i], true);
//evaluate
CExpression * tmpExp = new CExpression("tmp expr", pModel);
tmpExp->setRoot(tmpnode2);
tmpExp->compile();
std::cout << tmpExp->calcValue() << std::endl;
//create empty environment. Variable nodes should not occur in an expression
std::vector<std::vector<std::string> > env;
//std::string tmpstring = tmpnode->buildMMLString(false, env);
std::string tmpstring2 = tmpnode2->buildMMLString(false, env);
QtMmlWidget* tmpmml = new QtMmlWidget();
tmpmml->setBaseFontPointSize(qApp->font().pointSize() - 2);
tmpmml->setFontName(QtMmlWidget::NormalFont, qApp->font().family());
tmpmml->setContent(tmpstring2.c_str());
pTable->setCellWidget(j, i, tmpmml);
//tmpmml = new QtMmlWidget();
//tmpmml->setBaseFontPointSize(qApp->font().pointSize()-2);
//tmpmml->setFontName(QtMmlWidget::NormalFont, qApp->font().family());
//tmpmml->setContent(tmpstring.c_str());
//pTable->setCellWidget(i, 1, tmpmml);
}
pTable->resizeColumnsToContents();
pTable->resizeRowsToContents();
#endif
}