本文整理汇总了C++中CCopasiDataModel::getReportDefinitionList方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiDataModel::getReportDefinitionList方法的具体用法?C++ CCopasiDataModel::getReportDefinitionList怎么用?C++ CCopasiDataModel::getReportDefinitionList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCopasiDataModel
的用法示例。
在下文中一共展示了CCopasiDataModel::getReportDefinitionList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: btnCopyReportClicked
void CQReportDefinition::btnCopyReportClicked()
{
btnCommitClicked();
CCopasiDataModel* pDataModel = mpObject->getObjectDataModel();
if (pDataModel == NULL) return;
CReportDefinition * pRep = new CReportDefinition(*dynamic_cast<CReportDefinition*>(CCopasiRootContainer::getKeyFactory()->get(mKey)));
std::string baseName = pRep->getObjectName() + "_copy";
std::string name = baseName;
int i = 1;
while (pDataModel->getReportDefinitionList()->getIndex(name) != C_INVALID_INDEX)
{
i++;
name = baseName + TO_UTF8(QString::number(i));
}
pRep->setObjectName(name);
pDataModel->getReportDefinitionList()->add(pRep, true);
std::string key = pRep->getKey();
protectedNotify(ListViews::REPORT, ListViews::ADD, key);
enter(key);
mpListView->switchToOtherWidget(C_INVALID_INDEX, key);
}
示例2: loadReportDefinitionVector
void CQReportDefinitionSelect::loadReportDefinitionVector()
{
CCopasiDataModel* pDataModel = mpListView->getDataModel();
assert(pDataModel != NULL);
CReportDefinitionVector* pReportDefinitionVector = pDataModel->getReportDefinitionList();
unsigned C_INT32 i;
for (i = 0; i < pReportDefinitionVector->size(); i++)
mpComboDefinition->
insertItem(mpComboDefinition->count(), FROM_UTF8(pReportDefinitionVector->operator[](i).getObjectName()));
// if it is an empty list
if (mpComboDefinition->count() == 0)
{
std::string name = "ReportDefinition_0";
pDataModel->getReportDefinitionList()->createReportDefinition(name, "");
mpComboDefinition->insertItem(mpComboDefinition->count(), FROM_UTF8(name));
mpComboDefinition->setCurrentIndex(1);
mpReport->setReportDefinition(&pDataModel->getReportDefinitionList()->operator[](0)); //first one report definition
mpReport->setAppend(mpCheckAppend->isChecked());
mpReport->setConfirmOverwrite(mpCheckConfirmOverwrite->isChecked());
mpReport->setTarget(TO_UTF8(mpEditTarget->text()));
mpListView->getDataModelGUI()->notify(ListViews::REPORT, ListViews::CHANGE, ""); //notify Table Definition to
if (CQMessageBox::question(NULL, "No Report Template Defined",
"No report definition defined, COPASI has already created a new one for you.\n Do you want to switch to the GUI to edit it?",
QMessageBox::Ok | QMessageBox::No, QMessageBox::Ok) == QMessageBox::Ok)
slotEdit();
return;
}
if (!mpReport->getReportDefinition())
{
C_INT32 row;
row = mpComboDefinition->currentIndex();
mpReport->setReportDefinition(&pReportDefinitionVector->operator[](row));
mpReport->setAppend(mpCheckAppend->isChecked());
mpReport->setConfirmOverwrite(mpCheckConfirmOverwrite->isChecked());
mpReport->setTarget(TO_UTF8(mpEditTarget->text()));
return;
}
else
{
C_INT32 i;
// no use to compare the last one
for (i = mpComboDefinition->count() - 1; i >= 1; i--)
if (mpComboDefinition->itemText(i) == FROM_UTF8(mpReport->getReportDefinition()->getObjectName()))
break;
mpComboDefinition->setCurrentIndex(i);
mpCheckAppend->setChecked(mpReport->append());
mpCheckConfirmOverwrite->setChecked(mpReport->confirmOverwrite());
mpEditTarget->setText(FROM_UTF8(mpReport->getTarget()));
}
}
示例3: slotEdit
void CQReportDefinitionSelect::slotEdit()
{
CCopasiDataModel* pDataModel = mpListView->getDataModel();
assert(pDataModel != NULL);
CReportDefinitionVector* pReportDefinitionVector = pDataModel->getReportDefinitionList();
C_INT32 row;
row = mpComboDefinition->currentIndex();
mpListView->switchToOtherWidget(C_INVALID_INDEX, pReportDefinitionVector->operator[](row).getKey());
accept(); // if shown then close
mShow = false; // if not shown then close
}
示例4: accept
void CQReportDefinitionSelect::accept()
{
if (!mpReport)
//exception made here
return;
CCopasiDataModel* pDataModel = mpListView->getDataModel();
assert(pDataModel != NULL);
CReportDefinitionVector* pReportDefinitionVector = pDataModel->getReportDefinitionList();
C_INT32 row;
row = mpComboDefinition->currentIndex();
mpReport->setReportDefinition(&pReportDefinitionVector->operator[](row));
mpReport->setAppend(mpCheckAppend->isChecked());
mpReport->setConfirmOverwrite(mpCheckConfirmOverwrite->isChecked());
mpReport->setTarget(TO_UTF8(mpEditTarget->text()));
cleanup();
QDialog::done(QDialog::Accepted);
}
示例5: main
int main(int argc, char *argv[])
{
// Parse the commandline options
// first argument is the SBML filename
// second argument is the endtime
// third argument is the step number
// fourth argument is the filename where the results are to be written
// fifth argument is the tmp directory (this is not needed)
// the rest of the arguments are species names for the result
try
{
// Create the root container.
CCopasiRootContainer::init(0, NULL, false);
}
catch (copasi::autoexcept &e)
{}
catch (copasi::option_error &e)
{}
if (argc < 5)
{
std::cout << "Usage: semantic-test-suite SBMLFILENAME ENDTIME STEPNUMBER OUTFILENAME TMPDIR SPECIESID1 SPECIESID2 ..." << std::endl;
exit(1);
}
char* pSBMLFilename = argv[1];
const char* pEndTime = argv[2];
const char* pStepNumber = argv[3];
char* pOutputFilename = argv[4];
//char* pTmpDirectory=argv[5];
char** pSBMLSpeciesIds = new char * [argc - 6];
unsigned int i, iMax = argc;
CTrajectoryTask* pTrajectoryTask = NULL;
std::string CWD = COptions::getPWD();
double endTime = strToDouble(pEndTime, &pEndTime);
double stepNumber = strToDouble(pStepNumber, &pStepNumber);
if (endTime == 0.0)
{
std::cerr << "Invalid endtime " << pEndTime << std::endl;
exit(1);
}
if (stepNumber == 0.0)
{
std::cerr << "Invalid step number " << pStepNumber << std::endl;
exit(1);
}
for (i = 6; i < iMax; ++i)
{
pSBMLSpeciesIds[i - 6] = argv[i];
//std::cout << "Copying pointer to " << argv[i] << "." << std::endl;
}
try
{
// Create the global data model.
CCopasiDataModel* pDataModel = CCopasiRootContainer::addDatamodel();
// Import the SBML File
pDataModel->importSBML(pSBMLFilename);
//pDataModel->getModel()->forceCompile();
// create a report with the correct filename and all the species against
// time.
CReportDefinitionVector* pReports = pDataModel->getReportDefinitionList();
CReportDefinition* pReport = pReports->createReportDefinition("Report", "Output for SBML testsuite run");
pReport->setTaskType(CCopasiTask::timeCourse);
pReport->setIsTable(true);
std::vector<CRegisteredObjectName>* pTable = pReport->getTableAddr();
pTable->push_back(CCopasiObjectName(pDataModel->getModel()->getCN() + ",Reference=Time"));
iMax = iMax - 6;
const CCopasiVector<CMetab>& metabolites = pDataModel->getModel()->getMetabolites();
for (i = 0; i < iMax; ++i)
{
unsigned int j, jMax = metabolites.size();
for (j = 0; j < jMax; ++j)
{
if (metabolites[j]->getSBMLId() == pSBMLSpeciesIds[i])
{
pTable->push_back(metabolites[j]->getObject(CCopasiObjectName("Reference=Concentration"))->getCN());
//std::cout << "adding metabolite " << metabolites[j]->getObjectName() << " to report." << std::endl;
break;
}
}
if (j == jMax)
{
std::cerr << "Could not find a metabolite for the SBML id " << pSBMLSpeciesIds[i] << std::endl;
exit(1);
}
}
//.........这里部分代码省略.........
示例6: main
//.........这里部分代码省略.........
std::cerr << " tauLeap" << std::endl;
}
if (endTime == 0.0)
{
std::cerr << "Invalid endtime " << pEndTime << std::endl;
exit(1);
}
if (stepNumber == 0.0)
{
std::cerr << "Invalid step number " << pStepNumber << std::endl;
exit(1);
}
for (i = NUMARGS; i < iMax; ++i)
{
pSBMLSpeciesIds[i - NUMARGS] = argv[i];
//std::cout << "Copying pointer to " << argv[i] << "." << std::endl;
}
try
{
// Create the global data model.
CCopasiDataModel* pDataModel = CCopasiRootContainer::addDatamodel();
// Import the SBML File
pDataModel->importSBML(pSBMLFilename);
//pDataModel->getModel()->forceCompile();
// create a report with the correct filename and all the species against
// time.
CReportDefinitionVector* pReports = pDataModel->getReportDefinitionList();
CReportDefinition* pReport = pReports->createReportDefinition("Report", "Output for stochastic testsuite run");
pReport->setTaskType(CCopasiTask::timeCourse);
pReport->setIsTable(false);
CCopasiReportSeparator Separator(std::string(","));
pReport->setSeparator(Separator);
std::vector<CRegisteredObjectName> * pHeader = pReport->getHeaderAddr();
std::vector<CRegisteredObjectName> * pBody = pReport->getBodyAddr();
// Add time column
pHeader->push_back(CCopasiStaticString("time").getCN());
pBody->push_back(CCopasiObjectName(pDataModel->getModel()->getCN() + ",Reference=Time"));
iMax = iMax - NUMARGS;
const CCopasiVector<CMetab>& metabolites = pDataModel->getModel()->getMetabolites();
for (i = 0; i < iMax; ++i)
{
pHeader->push_back(Separator.getCN());
pBody->push_back(Separator.getCN());
unsigned int j, jMax = metabolites.size();
std::string SBMLId = unQuote(pSBMLSpeciesIds[i]);
for (j = 0; j < jMax; ++j)
{
if (metabolites[j]->getSBMLId() == SBMLId)
{
break;
}
示例7: main
int main(int argc, char** argv)
{
// initialize the backend library
CCopasiRootContainer::init(argc, argv);
assert(CCopasiRootContainer::getRoot() != NULL);
// create a new datamodel
CCopasiDataModel* pDataModel = CCopasiRootContainer::addDatamodel();
assert(CCopasiRootContainer::getDatamodelList()->size() == 1);
// the only argument to the main routine should be the name of an SBML file
if (argc == 2)
{
std::string filename = argv[1];
try
{
// load the model without progress report
pDataModel->importSBML(filename, NULL);
}
catch (...)
{
std::cerr << "Error while importing the model from file named \"" << filename << "\"." << std::endl;
CCopasiRootContainer::destroy();
return 1;
}
CModel* pModel = pDataModel->getModel();
assert(pModel != NULL);
// create a report with the correct filename and all the species against
// time.
CReportDefinitionVector* pReports = pDataModel->getReportDefinitionList();
// create a new report definition object
CReportDefinition* pReport = pReports->createReportDefinition("Report", "Output for timecourse");
// set the task type for the report definition to timecourse
pReport->setTaskType(CTaskEnum::timeCourse);
// we don't want a table
pReport->setIsTable(false);
// the entries in the output should be seperated by a ", "
pReport->setSeparator(", ");
// we need a handle to the header and the body
// the header will display the ids of the metabolites and "time" for
// the first column
// the body will contain the actual timecourse data
std::vector<CRegisteredObjectName>* pHeader = pReport->getHeaderAddr();
std::vector<CRegisteredObjectName>* pBody = pReport->getBodyAddr();
pBody->push_back(CCopasiObjectName(pDataModel->getModel()->getCN() + ",Reference=Time"));
pBody->push_back(CRegisteredObjectName(pReport->getSeparator().getCN()));
pHeader->push_back(CCopasiStaticString("time").getCN());
pHeader->push_back(pReport->getSeparator().getCN());
size_t i, iMax = pModel->getMetabolites().size();
for (i = 0; i < iMax; ++i)
{
CMetab* pMetab = &pModel->getMetabolites()[i];
assert(pMetab != NULL);
// we don't want output for FIXED metabolites right now
if (pMetab->getStatus() != CModelEntity::FIXED)
{
// we want the concentration oin the output
// alternatively, we could use "Reference=Amount" to get the
// particle number
pBody->push_back(pMetab->getObject(CCopasiObjectName("Reference=Concentration"))->getCN());
// after each entry, we need a seperator
pBody->push_back(pReport->getSeparator().getCN());
// add the corresponding id to the header
pHeader->push_back(CCopasiStaticString(pMetab->getSBMLId()).getCN());
// and a seperator
pHeader->push_back(pReport->getSeparator().getCN());
}
}
if (iMax > 0)
{
// delete the last separator
// since we don't need one after the last element on each line
if ((*pBody->rbegin()) == pReport->getSeparator().getCN())
{
pBody->erase(--pBody->end());
}
if ((*pHeader->rbegin()) == pReport->getSeparator().getCN())
{
pHeader->erase(--pHeader->end());
}
}
// get the task list
CCopasiVectorN< CCopasiTask > & TaskList = * pDataModel->getTaskList();
// get the trajectory task object
CTrajectoryTask* pTrajectoryTask = dynamic_cast<CTrajectoryTask*>(&TaskList["Time-Course"]);
// if there isn't one
if (pTrajectoryTask == NULL)
{
// remove any existing trajectory task just to be sure since in
//.........这里部分代码省略.........