本文整理汇总了C++中CCopasiDataModel::getPlotDefinitionList方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiDataModel::getPlotDefinitionList方法的具体用法?C++ CCopasiDataModel::getPlotDefinitionList怎么用?C++ CCopasiDataModel::getPlotDefinitionList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCopasiDataModel
的用法示例。
在下文中一共展示了CCopasiDataModel::getPlotDefinitionList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prepareModel
std::string Arguments::prepareModel() const
{
if (!isValid()) return "";
CCopasiDataModel* model = (*CCopasiRootContainer::getDatamodelList())[0];
model->loadModel(getFilename(), NULL);
if (mDisablePlots)
{
for (size_t index = 0; index < model->getPlotDefinitionList()->size(); ++index)
{
(*model->getPlotDefinitionList())[index]->setActive(false);
}
}
if (mClearTargets)
{
for (size_t index = 0; index < model->getTaskList()->size(); ++index)
{
(*model->getTaskList())[index]->getReport().setTarget("");
}
}
CCopasiTask *task = getTask();
if (task != NULL)
{
if (isGenerateOutput())
{
// calls initialize which is private
COutputAssistant::getListOfDefaultOutputDescriptions();
// generate the output
COutputAssistant::createDefaultOutput(mGenerateOutput, task, model);
}
if (haveReportFile())
task->getReport().setTarget(mReportFile);
COptTask* optTask = dynamic_cast<COptTask*>(task);
if (optTask != NULL)
{
COptProblem *problem = (COptProblem *)optTask->getProblem();
if (mSetSolutionStatistic)
optTask->setMethodType(CCopasiMethod::Statistics);
if (isDisableRandomizeStartValues())
problem->setRandomizeStartValues(false);
if (isDisableStatistic())
problem->setCalculateStatistics(false);
}
}
model->saveModel(getFilename() + ".view.cps", NULL, true);
return getFilename() + ".view.cps";
}
示例2: slotBtnDeactivateAllClicked
void CQPlotsWidget::slotBtnDeactivateAllClicked()
{
CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
assert(pDataModel != NULL);
if (!pDataModel->getModel())
return;
for (size_t i = 0; i < pDataModel->getPlotDefinitionList()->size(); i++)
{
CPlotSpecification *pPS = static_cast<CPlotSpecification *>(pDataModel->getPlotDefinitionList()->operator[](i));
pPS->setActive(false);
}
mpTblPlots->doItemsLayout();
}
示例3: createSEDMLDocument
void CSEDMLExporter::createSEDMLDocument(CCopasiDataModel& dataModel, std::string modelRef)
{
const SedDocument* pOldSEDMLDocument = NULL; //dataModel.getCurrentSEDMLDocument();
const CModel* pModel = dataModel.getModel();
COutputDefinitionVector *plotDef = dataModel.getPlotDefinitionList();
assert(plotDef != NULL); //need to emit a message
assert(pModel != NULL);
if (pOldSEDMLDocument == NULL)
{
this->mpSEDMLDocument = new SedDocument(mSEDMLLevel, mSEDMLVersion);
}
else
{
this->mpSEDMLDocument = dynamic_cast<SedDocument*>(pOldSEDMLDocument->clone());
}
if (this->mpSEDMLDocument == NULL) fatalError();
createModels(dataModel, modelRef);
createTasks(dataModel, modelRef);
}
示例4: createDataGenerators
/**
* Creates the data generators for SEDML.
*/
void CSEDMLExporter::createDataGenerators(CCopasiDataModel & dataModel, std::string & taskId)
{
const CModel* pModel = dataModel.getModel();
std::vector<std::string> stringsContainer; //split string container
if (pModel == NULL)
CCopasiMessage(CCopasiMessage::ERROR, "No model for this SEDML document. An SBML model must exist for every SEDML document.");
SedPlot2D* pPSedPlot;
SedCurve* pCurve; // = pPSedPlot->createCurve();
//create generator for special varibale time
const CCopasiObject* pTime = static_cast<const CCopasiObject *>(dataModel.getModel()->getObject(CCopasiObjectName("Reference=Time")));
SedDataGenerator *pTimeDGenp = this->mpSEDMLDocument->createDataGenerator();
pTimeDGenp->setId("time");
pTimeDGenp->setName(pTime->getObjectName());
SedVariable *pTimeVar = pTimeDGenp->createVariable();
pTimeVar->setId("var_time");
pTimeVar->setTaskReference(taskId);
pTimeVar->setSymbol(SEDML_TIME_URN);
pTimeDGenp->setMath(SBML_parseFormula(pTimeVar->getId().c_str()));
size_t i, imax = dataModel.getPlotDefinitionList()->size();
SedDataGenerator *pPDGen;
if (!imax)
CCopasiMessage(CCopasiMessage::ERROR, "No plot definition for this SEDML document.");
for (i = 0; i < imax; i++)
{
pPSedPlot = this->mpSEDMLDocument->createPlot2D();
const CPlotSpecification* pPlot = (*dataModel.getPlotDefinitionList())[i];
std::string plotName = pPlot->getObjectName();
SEDMLUtils::removeCharactersFromString(plotName, "[]");
pPSedPlot->setId(SEDMLUtils::getNextId("plot", mpSEDMLDocument->getNumOutputs()));
pPSedPlot->setName(plotName);
size_t j, jmax = pPlot->getItems().size();
for (j = 0; j < jmax; j++)
{
const CPlotItem* pPlotItem = pPlot->getItems()[j];
CCopasiObject *objectX, *objectY;
if (pPlotItem->getChannels().size() >= 1)
objectX = dataModel.getDataObject(pPlotItem->getChannels()[0]);
bool xIsTime = objectX->getCN() == pTime->getCN();
if (pPlotItem->getChannels().size() >= 2)
objectY = dataModel.getDataObject(pPlotItem->getChannels()[1]);
const std::string& type = objectY->getObjectName();
std::string yAxis = objectY->getObjectDisplayName();
std::string targetXPathString = SEDMLUtils::getXPathAndName(yAxis, type,
pModel, dataModel);
if (targetXPathString.empty())
{
continue;
}
pPDGen = createDataGenerator(
this->mpSEDMLDocument,
yAxis,
targetXPathString,
taskId,
i,
j
);
pCurve = pPSedPlot->createCurve();
std::ostringstream idCurveStrStream;
idCurveStrStream << "p";
idCurveStrStream << i + 1;
idCurveStrStream << "_curve_";
idCurveStrStream << j + 1;
pCurve->setId(idCurveStrStream.str());
pCurve->setLogX(pPlot->isLogX());
pCurve->setLogY(pPlot->isLogY());
pCurve->setYDataReference(pPDGen->getId());
if (xIsTime)
{
pCurve->setXDataReference(pTimeDGenp->getId());
}
else
{
const std::string& typeX = objectX->getObjectName();
std::string xAxis = objectX->getObjectDisplayName();
std::string targetXPathStringX = SEDMLUtils::getXPathAndName(xAxis, typeX,
pModel, dataModel);
pPDGen = createDataGenerator(
//.........这里部分代码省略.........
示例5: createDataGenerators
/**
* Creates the data generators for SEDML.
*/
void CSEDMLExporter::createDataGenerators(CCopasiDataModel & dataModel,
std::string & taskId,
CCopasiTask* task)
{
const CModel* pModel = dataModel.getModel();
std::vector<std::string> stringsContainer; //split string container
if (pModel == NULL)
CCopasiMessage(CCopasiMessage::ERROR, "SED-ML: No model for this SED-ML document. An SBML model must exist for every SED-ML document.");
SedPlot2D* pPSedPlot;
SedCurve* pCurve; // = pPSedPlot->createCurve();
//create generator for special varibale time
const CCopasiObject* pTime = static_cast<const CCopasiObject *>(dataModel.getModel()->getObject(CCopasiObjectName("Reference=Time")));
SedDataGenerator *pTimeDGenp = this->mpSEDMLDocument->createDataGenerator();
pTimeDGenp->setId("time");
pTimeDGenp->setName(pTime->getObjectName());
SedVariable *pTimeVar = pTimeDGenp->createVariable();
pTimeVar->setId("var_time");
pTimeVar->setTaskReference(taskId);
pTimeVar->setSymbol(SEDML_TIME_URN);
pTimeDGenp->setMath(SBML_parseFormula(pTimeVar->getId().c_str()));
size_t i, imax = dataModel.getPlotDefinitionList()->size();
SedDataGenerator *pPDGen;
if (imax == 0 && (task == NULL || task->getReport().getTarget().empty()))
CCopasiMessage(CCopasiMessage::ERROR, "SED-ML: No plot/report definition for this SED-ML document.");
// export report
if (task != NULL && !task->getReport().getTarget().empty())
{
CReportDefinition* def = task->getReport().getReportDefinition();
if (def != NULL)
{
SedReport* pReport = mpSEDMLDocument->createReport();
std::string name = def->getObjectName();
SEDMLUtils::removeCharactersFromString(name, "[]");
//
pReport->setId(SEDMLUtils::getNextId("report", mpSEDMLDocument->getNumOutputs()));
pReport->setName(name);
std::vector<CRegisteredObjectName> header = *def->getHeaderAddr();
std::vector<CRegisteredObjectName> body =
def->isTable() ? *def->getTableAddr() :
*def->getBodyAddr();
int dsCount = 0;
for (size_t i = 0; i < body.size(); ++i)
{
CRegisteredObjectName& current = body[i];
if (current == def->getSeparator().getCN()) continue;
CCopasiObject *object = dataModel.getDataObject(current);
if (object == NULL) continue;
const std::string& typeX = object->getObjectName();
std::string xAxis = object->getObjectDisplayName();
std::string targetXPathStringX = SEDMLUtils::getXPathAndName(xAxis, typeX,
pModel, dataModel);
if (object->getCN() == pTime->getCN())
pPDGen = pTimeDGenp;
else
pPDGen = createDataGenerator(
this->mpSEDMLDocument,
xAxis,
targetXPathStringX,
taskId,
i,
0
);
SedDataSet* pDS = pReport->createDataSet();
pDS->setId(SEDMLUtils::getNextId("ds", ++dsCount));
if (def->isTable())
{
CCopasiObject *headerObj = NULL;
if (header.size() > i)
headerObj = dataModel.getDataObject(header[i]);
else
headerObj = dataModel.getDataObject(body[i]);
if (headerObj != NULL)
pDS->setLabel(headerObj->getObjectDisplayName());
else
pDS->setLabel(xAxis);
}
else
//.........这里部分代码省略.........