本文整理汇总了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;
}
示例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);
}
}
示例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);
}