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


C++ CCompartment::getMetabolites方法代码示例

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


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

示例1:

CMetab * CMetabNameInterface::getMetabolite(const CModel* model,
    const std::string & metabolite,
    const std::string & compartment)
{
  unsigned C_INT32 Index;

  if (compartment != "")
    {
      Index = model->getCompartments().getIndex(compartment);
      if (Index != C_INVALID_INDEX)
        {
          CCompartment *pCompartment = model->getCompartments()[Index];

          Index = pCompartment->getMetabolites().getIndex(metabolite);
          if (Index != C_INVALID_INDEX)
            return pCompartment->getMetabolites()[Index];
        }

      return NULL;
    }

  Index = model->findMetabByName(metabolite);

  if (Index != C_INVALID_INDEX)
    return model->getMetabolites()[Index];

  return NULL;
}
开发者ID:mgaldzic,项目名称:copasi_api,代码行数:28,代码来源:CMetabNameInterface.cpp

示例2: replaceInMetab

void CModelExpansion::replaceInMetab(CMetab* pX, const ElementsMap & emap)
{
  replaceInModelEntity(pX, emap);

  //is the metab in a compartment that needs to be replaced?
  if (emap.exists(pX->getCompartment()))
    {
      //move the metab to the new compartment
      CCompartment* oldComp = const_cast<CCompartment*>(pX->getCompartment());
      CCompartment* newComp = dynamic_cast<CCompartment*>(emap.getDuplicatePtr(pX->getCompartment()));
      bool success = false;

      do
        {
          success = newComp->addMetabolite(pX);

          if (success)
            {
              oldComp->getMetabolites().remove(pX->getObjectName());
              mpModel->setCompileFlag();
              mpModel->initializeMetabolites();
            }
          else
            {
              //rename the metab so that it can be added to the new compartment
              pX->setObjectName(pX->getObjectName() + "_");
              //TODO: check if the renaming actually worked
            }
        }
      while (!success);
    }
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:32,代码来源:CModelExpansion.cpp

示例3: if

void CQEventWidget1::addEvent(UndoEventData *pSData)
{
  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
  CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
  assert(pDataModel != NULL);

  CModel * pModel = pDataModel->getModel();
  assert(pModel != NULL);

  //reinsert the Event
  CEvent *pEvent =  pModel->createEvent(pSData->getName());

  //set the expressions
  pEvent->setTriggerExpression(pSData->getTriggerExpression());
  pEvent->setDelayExpression(pSData->getDelayExpression());
  pEvent->setPriorityExpression(pSData->getPriorityExpression());

  QList <UndoEventAssignmentData *> *assignmentData = pSData->getEventAssignmentData();
  QList <UndoEventAssignmentData *>::const_iterator i;

  for (i = assignmentData->begin(); i != assignmentData->end(); ++i)
    {
      UndoEventAssignmentData * assignData = *i;

      CCopasiObject * pObject = NULL;
      bool speciesExist = false;
      size_t ci;

      for (ci = 0; ci < pModel->getCompartments().size(); ci++)
        {
          CCompartment * pCompartment = pModel->getCompartments()[ci];

          if (pCompartment->getMetabolites().getIndex(assignData->getName()) != C_INVALID_INDEX)
            speciesExist = true;
        }

      if (speciesExist)
        {
          size_t index = pModel->findMetabByName(assignData->getName());
          pObject =  pModel->getMetabolites()[index];
        }
      else if (pModel->getModelValues().getIndex(assignData->getName()) != C_INVALID_INDEX)
        {
          pObject = pModel->getModelValues()[assignData->getName()];
        }
      else if (pModel->getReactions().getIndex(assignData->getName()) != C_INVALID_INDEX)
        {
          pObject = pModel->getReactions()[assignData->getName()];
        }

      const CModelEntity * pEntity = dynamic_cast< const CModelEntity * >(pObject);
      CEventAssignment *eventAssign = new CEventAssignment(pObject->getKey(), pEvent->getObjectParent());
      eventAssign->setExpression(assignData->getExpression());
      eventAssign->getExpressionPtr()->compile();
      pEvent->getAssignments().add(eventAssign);
    }

  std::string key = pEvent->getKey();
  protectedNotify(ListViews::EVENT, ListViews::ADD, key);

  mpListView->switchToOtherWidget(C_INVALID_INDEX, key);
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:62,代码来源:CQEventWidget1.cpp


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