当前位置: 首页>>代码示例>>C++>>正文


C++ CCopasiDataModel::getDataObject方法代码示例

本文整理汇总了C++中CCopasiDataModel::getDataObject方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiDataModel::getDataObject方法的具体用法?C++ CCopasiDataModel::getDataObject怎么用?C++ CCopasiDataModel::getDataObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCopasiDataModel的用法示例。


在下文中一共展示了CCopasiDataModel::getDataObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: refreshText

void CQReportListItem::refreshText()
{
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);
  const CCopasiObject * pObject = pDataModel->getDataObject(mCN);

  if (pObject)
    setText(FROM_UTF8(pObject->getObjectDisplayName()));
  else
    setText(QString("Not found: ") + FROM_UTF8(mCN));
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:12,代码来源:CQReportListItem.cpp

示例2: load

// virtual
void CScanWidgetScan::load(const CCopasiParameterGroup * pItem)
{
  if (pItem == NULL) return;

  *mpData = *pItem;

  void * tmp;

  if (!(tmp = mpData->getValue("Type").pVOID)) return;

  CScanProblem::Type type = *(CScanProblem::Type*)tmp;

  if (type != CScanProblem::SCAN_LINEAR)
    return;

  if (!(tmp = mpData->getValue("Number of steps").pVOID)) return;

  lineEditNumber->setText(QString::number(*(C_INT32*)tmp));

  if (!(tmp = mpData->getValue("Object").pVOID)) return;

  std::string tmpString = *(std::string*)tmp;

  if (tmpString == "")
    mpObject = NULL;
  else
    {
      assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
      CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
      assert(pDataModel != NULL);
      mpObject = pDataModel->getDataObject(tmpString);
    }

  if (mpObject)
    lineEditObject->setText(FROM_UTF8(mpObject->getObjectDisplayName()));
  else
    lineEditObject->setText("");

  if (!(tmp = mpData->getValue("Minimum").pVOID)) return;

  lineEditMin->setText(QString::number(*(C_FLOAT64*)tmp));

  if (!(tmp = mpData->getValue("Maximum").pVOID)) return;

  lineEditMax->setText(QString::number(*(C_FLOAT64*)tmp));

  if (!(tmp = mpData->getValue("log").pVOID)) return;

  checkBoxLog->setChecked(*(bool*)tmp);

  return;
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:53,代码来源:CScanWidgetScan.cpp

示例3: slotTypeChanged

void CQExperimentData::slotTypeChanged(int row, int index)
{
  CExperiment::Type NewType = static_cast<CExperiment::Type>(index);
  CExperiment::Type OldType = static_cast<CExperiment::Type>(mpTable->item(row, COL_TYPE_HIDDEN)->data(Qt::DisplayRole).asInt());

  if (OldType == NewType) return;

  bool BtnEnabled = true;
  C_INT32 i, imax = mpTable->rowCount();

  CCopasiObjectName CN = CCopasiObjectName(TO_UTF8(mpTable->item(row, COL_OBJECT_HIDDEN)->text()));
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);

  switch (NewType)
    {
      case CExperiment::ignore:
        BtnEnabled = false;
        break;

      case CExperiment::independent:

        if (!CQSimpleSelectionTree::filter(CQSimpleSelectionTree::InitialTime |
                                           CQSimpleSelectionTree::Parameters,
                                           pDataModel->getDataObject(CN)))
          {
            mModelObjectRow = row;
            QTimer::singleShot(10, this, SLOT(slotModelObjectDelayed()));
          }

        BtnEnabled = true;
        break;

      case CExperiment::dependent:

        if (!CQSimpleSelectionTree::filter(CQSimpleSelectionTree::Variables |
                                           CQSimpleSelectionTree::ObservedValues,
                                           pDataModel->getDataObject(CN)))
          {
            mModelObjectRow = row;
            QTimer::singleShot(10, this, SLOT(slotModelObjectDelayed()));
          }

        BtnEnabled = true;
        break;

      case CExperiment::time:
        BtnEnabled = false;
        setTypeItems(row);

        break;
    }

  QTableWidgetItem * pItem = mpTable->item(row, COL_BTN);

  if (BtnEnabled)
    {
      pItem->setFlags(pItem->flags() | Qt::ItemIsEditable | Qt::ItemIsEnabled);
      mpTable->openPersistentEditor(pItem);
    }
  else
    {
      pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsEnabled);
      mpTable->closePersistentEditor(pItem);
    }

  switch (OldType)
    {
      case CExperiment::ignore:
      case CExperiment::independent:
      case CExperiment::dependent:
        break;

      case CExperiment::time:
        setTypeItems(-1);
        break;
    }

  mpTable->item(row, COL_TYPE)->setText(FROM_UTF8(CExperiment::TypeName[NewType]));
  mpTable->item(row, COL_TYPE_HIDDEN)->setText(QString::number(NewType));

  // The default weights need to be recalculated and the table updated if the type change
  // involves dependent values.
  if (OldType == CExperiment::dependent ||
      NewType == CExperiment::dependent)
    {
      saveExperiment(mpExperiment, true);

      // Since the interpretation of the data has changed we need read the file again
      std::ifstream File;
      File.open(CLocaleString::fromUtf8(mpExperiment->getFileName()).c_str());

      size_t CurrentLine = 1;
      mpExperiment->read(File, CurrentLine);
      mpExperiment->compile();

      // We can not simply use loadTable as this would destroy the two signal maps
      // for the buttons and comboboxes leading to crashes in Qt.
      CExperimentObjectMap & ObjectMap = mpExperiment->getObjectMap();
//.........这里部分代码省略.........
开发者ID:sachiinb,项目名称:COPASI,代码行数:101,代码来源:CQExperimentData.cpp

示例4: loadTable

void CQExperimentData::loadTable(CExperiment * pExperiment, const bool & guess)
{
  if (!pExperiment)
    {
      mpTable->clearContents();
      mpTable->setRowCount(0);

      return;
    }

  size_t TimeRow = C_INVALID_INDEX;

  pExperiment->readColumnNames();
  const std::vector<std::string> & ColumnNames = pExperiment->getColumnNames();

  size_t i, imax = ColumnNames.size();
  mpTable->setRowCount((int)(imax));
  CExperimentObjectMap & ObjectMap = pExperiment->getObjectMap();
  const CCopasiObject *pObject;
  CExperiment::Type Type;
  QTableWidgetItem *pItem;
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel *pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);

  for (i = 0; i < imax; i++)
    {
      // COL_NAME
      pItem = new QTableWidgetItem(FROM_UTF8(ColumnNames[i]));
      pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
      mpTable->setItem((int) i, COL_NAME, pItem);

      // COL_TYPE
      if (guess && TimeRow == C_INVALID_INDEX &&
          mpBtnTimeCourse->isChecked() &&
          mpTable->item((int) i, COL_NAME)->text().contains("time", Qt::CaseInsensitive))
        {
          ObjectMap.setRole(i, CExperiment::time);
        }

      Type = ObjectMap.getRole(i);

      if (Type == CExperiment::time) TimeRow = i;

      pItem = new QTableWidgetItem(FROM_UTF8(CExperiment::TypeName[Type]));
      mpTable->setItem((int) i, COL_TYPE, pItem);

      // COL_TYPE_HIDDEN
      pItem = new QTableWidgetItem(QString::number(Type));
      pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
      mpTable->setItem((int) i, COL_TYPE_HIDDEN, pItem);

      // COL_BTN
      pItem = new QTableWidgetItem("");
      mpTable->setItem(i, COL_BTN, pItem);

      // Show the Button
      pItem = mpTable->item(i, COL_BTN);

      if (Type == CExperiment::ignore || Type == CExperiment::time)
        {
          pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable & ~Qt::ItemIsEnabled);
          mpTable->closePersistentEditor(pItem);
        }
      else
        {
          pItem->setFlags(pItem->flags() | Qt::ItemIsEditable | Qt::ItemIsEnabled);
          mpTable->openPersistentEditor(pItem);
        }

      // COL_OBJECT and COL_OBJECT_HIDDEN
      QTableWidgetItem * pItem;

      if (ObjectMap.getObjectCN(i) != "")
        {
          pObject = pDataModel->getDataObject(ObjectMap.getObjectCN(i));

          if (pObject)
            pItem = new QTableWidgetItem(FROM_UTF8(pObject->getObjectDisplayName()));
          else
            pItem = new QTableWidgetItem("not found");

          pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
          mpTable->setItem((int) i, COL_OBJECT, pItem);

          pItem = new QTableWidgetItem(FROM_UTF8(ObjectMap.getObjectCN(i)));
          pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
          mpTable->setItem((int) i, COL_OBJECT_HIDDEN, pItem);
        }
      else
        {
          pItem = new QTableWidgetItem("");
          pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
          mpTable->setItem((int) i, COL_OBJECT, pItem);

          pItem = new QTableWidgetItem("");
          pItem->setFlags(pItem->flags() & ~Qt::ItemIsEditable);
          mpTable->setItem((int) i, COL_OBJECT_HIDDEN, pItem);
        }

//.........这里部分代码省略.........
开发者ID:sachiinb,项目名称:COPASI,代码行数:101,代码来源:CQExperimentData.cpp

示例5: enterProtected

bool CQFittingResult::enterProtected()
{
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);

  mpTask =
    dynamic_cast<CFitTask *>((*pDataModel->getTaskList())["Parameter Estimation"]);

  if (!mpTask) return false;

  mpProblem = dynamic_cast<const CFitProblem *>(mpTask->getProblem());

  if (!mpProblem) return false;

  mpMain->load(mpProblem);

  if (mpProblem->getCalculateStatistics())
    {
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpExperiments), true);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpValues), true);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpCorrelations), true);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpFisherInformation), true);

      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpCrossValidations), true);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpCrossValidationValues), true);
    }
  else
    {
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpExperiments), false);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpValues), false);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpCorrelations), false);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpFisherInformation), false);

      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpCrossValidations), false);
      mpTabWidget->setTabEnabled(mpTabWidget->indexOf(mpCrossValidationValues), false);
    }

  size_t i, imax;
  QTableWidgetItem * pItem;

  // Loop over the optimization items
  const std::vector< COptItem * > & Items = mpProblem->getOptItemList();
  const CVector< C_FLOAT64 > & Solutions = mpProblem->getSolutionVariables();
  const CVector< C_FLOAT64 > & StdDeviations = mpProblem->getVariableStdDeviations();
  const CVector< C_FLOAT64 > & Gradients = mpProblem->getVariableGradients();

  imax = Items.size();

  if (mpProblem->getFunctionEvaluations() == 0)
    imax = 0;

  //the parameters table
  mpParameters->setRowCount((int) imax);

  QColor BackgroundColor = mpParameters->palette().brush(QPalette::Active, QPalette::Base).color();

  int h, s, v;
  BackgroundColor.getHsv(&h, &s, &v);

  if (s < 20)
    {
      s = 20;
    }

  BackgroundColor.setHsv(0, s, v);

  for (i = 0; i != imax; i++)
    {
      //1st column: parameter name
      const CCopasiObject *pObject =
        pDataModel->getDataObject(Items[i]->getObjectCN());

      if (pObject)
        {
          std::string Experiments =
            static_cast<CFitItem *>(Items[i])->getExperiments();

          if (Experiments != "")
            Experiments = "; {" + Experiments + "}";

          pItem = new QTableWidgetItem(FROM_UTF8(pObject->getObjectDisplayName() + Experiments));
        }
      else
        pItem = new QTableWidgetItem("Not Found");

      mpParameters->setItem((int) i, 0, pItem);

      const C_FLOAT64 & Solution = i < Solutions.size() ? Solutions[i] : std::numeric_limits<double>::quiet_NaN();

      //2nd column: lower bound
      const COptItem *current = Items[i];
      pItem = new QTableWidgetItem(FROM_UTF8(current->getLowerBound()));
      mpParameters->setItem((int) i, 1, pItem);

      if (current->getLowerBoundValue() != NULL && 1.01 * *current->getLowerBoundValue() > Solution)
        {
          pItem->setBackgroundColor(BackgroundColor);
        }

//.........这里部分代码省略.........
开发者ID:kgatjens,项目名称:COPASI,代码行数:101,代码来源:CQFittingResult.cpp

示例6: slotSave

void CQFittingResult::slotSave(void)
{
  C_INT32 Answer = QMessageBox::No;
  QString fileName;

  while (Answer == QMessageBox::No)
    {
      fileName =
        CopasiFileDialog::getSaveFileName(this,
                                          "Save File Dialog",
                                          "untitled.txt",
                                          "TEXT Files (*.txt)",
                                          "Save to");

      if (fileName.isEmpty()) return;

      if (!fileName.endsWith(".txt") &&
          !fileName.endsWith(".")) fileName += ".txt";

      fileName = fileName.remove(QRegExp("\\.$"));

      Answer = checkSelection(fileName);

      if (Answer == QMessageBox::Cancel) return;
    }

  std::ofstream file(CLocaleString::fromUtf8(TO_UTF8(fileName)).c_str());

  if (file.fail()) return;

  size_t i, imax;

  // The global result and statistics
  file << "Objective Value\tRoot Mean Square\tStandard Deviation" << std::endl;
  file << mpProblem->getSolutionValue() << "\t";
  file << mpProblem->getRMS() << "\t";
  file << mpProblem->getStdDeviation() << std::endl;

  file << "Function Evaluations\tCPU Time [s]\tEvaluations/second [1/s]" << std::endl;
  const unsigned C_INT32 & FunctionEvaluations = mpProblem->getFunctionEvaluations();
  const C_FLOAT64 & ExecutionTime = mpProblem->getExecutionTime();
  file << FunctionEvaluations << "\t";
  file << ExecutionTime << "\t";
  file << FunctionEvaluations / ExecutionTime << std::endl;

  // Set up the parameters table
  file << std::endl << "Parameters:" << std::endl;
  file << "Parameter\tValue\tStd. Deviation\tCoeff. of Variation [%]\tGradient" << std::endl;

  // Loop over the optimization items
  const std::vector< COptItem * > & Items = mpProblem->getOptItemList();
  const CVector< C_FLOAT64 > & Solutions = mpProblem->getSolutionVariables();
  const CVector< C_FLOAT64 > & StdDeviations = mpProblem->getVariableStdDeviations();
  const CVector< C_FLOAT64 > & Gradients = mpProblem->getVariableGradients();

  imax = Items.size();

  if (mpProblem->getFunctionEvaluations() == 0)
    imax = 0;

  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);

  for (i = 0; i != imax; i++)
    {
      const CCopasiObject *pObject =
        pDataModel->getDataObject(Items[i]->getObjectCN());

      if (pObject)
        {
          std::string Experiments =
            static_cast<CFitItem *>(Items[i])->getExperiments();

          if (Experiments != "")
            Experiments = "; {" + Experiments + "}";

          file << pObject->getObjectDisplayName() << Experiments << "\t";
        }
      else
        file << "Not Found\t";

      const C_FLOAT64 & Solution = Solutions[i];
      file << Solution << "\t";
      const C_FLOAT64 & StdDeviation = StdDeviations[i];
      file << StdDeviation << "\t";
      file << fabs(100.0 * StdDeviation / Solution) << "\t";
      file << Gradients[i] << std::endl;
    }

  // Set up the experiments table
  file << std::endl << "Experiments:" << std::endl;
  file << "Experiment\tObjective Value\tRoot Mean Square\tError Mean\tError Mean Std. Deviation" << std::endl;

  // Loop over the experiments
  const CExperimentSet & Experiments = mpProblem->getExperiementSet();

  imax = Experiments.getExperimentCount();

  if (mpProblem->getFunctionEvaluations() == 0)
//.........这里部分代码省略.........
开发者ID:kgatjens,项目名称:COPASI,代码行数:101,代码来源:CQFittingResult.cpp

示例7: pix

bool Curve2DWidget::LoadFromCurveSpec(const CPlotItem * curve)
{
  if (!curve)
    {
      // We need to reset the widget to defaults
      mpEditTitle->setText("");

      mpObjectX = NULL;
      mpEditX->setText("");

      mpObjectY = NULL;
      mpEditY->setText("");

      mpBoxType->setCurrentIndex(0);
      mpBoxLineSubType->setCurrentIndex(0);
      mpBoxColor->clear();

      mpCheckBefore->setChecked(false);
      mpCheckDuring->setChecked(true);
      mpCheckAfter->setChecked(false);

      return true;
    }

  if (curve->getType() != CPlotItem::curve2d) return false;

  //if (curve->getChannels().getSize != 2) return false;

  mpEditTitle->setText(FROM_UTF8(curve->getTitle()));

  //TODO: check if objects exist....
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);
  mpObjectX = mpObjectY = NULL;

  if (curve->getChannels().size() >= 1)
    mpObjectX = pDataModel->getDataObject(curve->getChannels()[0]);

  if (curve->getChannels().size() >= 2)
    mpObjectY = pDataModel->getDataObject(curve->getChannels()[1]);

  if (mpObjectX)
    mpEditX->setText(FROM_UTF8(mpObjectX->getObjectDisplayName()));

  if (mpObjectY)
    mpEditY->setText(FROM_UTF8(mpObjectY->getObjectDisplayName()));

  const void* tmp;

  //Type
  if (!(tmp = curve->getValue("Line type").pVOID)) return false;

  unsigned C_INT32 linetype = *(unsigned C_INT32*)tmp;
  mpBoxType->setCurrentIndex(linetype);

  typeChanged(linetype);

  //line subtype & width
  if (linetype == 0 || linetype == 3)
    {
      if (!(tmp = curve->getValue("Line subtype").pVOID)) return false;

      mpBoxLineSubType->setCurrentIndex(*(unsigned C_INT32*)tmp);

      //mpBoxWidth
      if (!(tmp = curve->getValue("Line width").pVOID)) return false;

      mpSpinBoxWidth->setValue(*(C_FLOAT64*)tmp);
    }

  // points
  if (linetype == 1)
    {
      if (!(tmp = curve->getValue("Line width").pVOID)) return false;

      mpSpinBoxWidth->setValue(*(C_FLOAT64*)tmp);
    }

  //symbol type
  if (linetype == 2 || linetype == 3)
    {
      if (!(tmp = curve->getValue("Symbol subtype").pVOID)) return false;

      mpBoxSymbolSubType->setCurrentIndex(*(unsigned C_INT32*)tmp);
    }

  //color TODO
  mpBoxColor->clear();
  mpBoxColor->addItem("auto");
  size_t i;

  for (i = 0; i < CQPlotColors::getNumCopasiColors(); ++i)
    {
      QColor color = CQPlotColors::getColor("auto", i);
      QPixmap pix(12, 12);
      QPainter painter(&pix);

      if (color.isValid())
        {
//.........这里部分代码省略.........
开发者ID:PriKalra,项目名称:COPASI,代码行数:101,代码来源:curve2dwidget.cpp

示例8: 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(
//.........这里部分代码省略.........
开发者ID:cpanchal,项目名称:COPASI,代码行数:101,代码来源:CSEDMLExporter.cpp

示例9: 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
//.........这里部分代码省略.........
开发者ID:PriKalra,项目名称:COPASI,代码行数:101,代码来源:CSEDMLExporter.cpp


注:本文中的CCopasiDataModel::getDataObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。