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 }