本文整理汇总了C++中CCompartment::getExpressionPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ CCompartment::getExpressionPtr方法的具体用法?C++ CCompartment::getExpressionPtr怎么用?C++ CCompartment::getExpressionPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCompartment
的用法示例。
在下文中一共展示了CCompartment::getExpressionPtr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: duplicateCompartment
void CModelExpansion::duplicateCompartment(const CCompartment* source, const std::string & index, const SetOfModelElements & sourceSet, ElementsMap & emap)
{
//if the source object has already been duplicated: do nothing
if (emap.exists(source))
return;
//try creating the object until we find a name that is not yet used
CCompartment* newObj;
std::ostringstream infix;
do
{
std::ostringstream name;
name << source->getObjectName() << infix.str() << index;
newObj = mpModel->createCompartment(name.str(), source->getInitialValue());
infix << "_";
}
while (!newObj);
//add duplicated object to the map
emap.add(source, newObj);
//now copy the contents of the object
newObj->setDimensionality(source->getDimensionality());
//status
newObj->setStatus(source->getStatus());
//expression (for assignment or ODE)
newObj->setExpression(source->getExpression());
updateExpression(newObj->getExpressionPtr(), index, sourceSet, emap);
//initial expression
newObj->setInitialExpression(source->getInitialExpression());
updateExpression(newObj->getInitialExpressionPtr(), index, sourceSet, emap);
newObj->setNotes(source->getNotes());
newObj->setMiriamAnnotation(source->getMiriamAnnotation(), newObj->getKey(), source->getKey());
}
示例2: mergeMetabolites
//.........这里部分代码省略.........
imax = mpModel->getEvents().size();
for (i = 0; i < imax; ++i)
{
CEvent * event = &mpModel->getEvents()[i];
if (!event) return info;
/* merge in trigger expressions */
CExpression* pExpression = event->getTriggerExpressionPtr();
if (pExpression == NULL) return info;
if (!mergeInExpression(toKey, key, pExpression)) return info;
pExpression = event->getDelayExpressionPtr();
if (pExpression)
if (!mergeInExpression(toKey, key, pExpression))
return info;
jmax = event->getAssignments().size();
for (j = 0; j < jmax; ++j)
{
CEventAssignment* assignment = &event->getAssignments()[j];
if (!assignment) return info;
std::string assignmentKey = assignment->getTargetKey();
if (assignmentKey == key) assignment->setTargetKey(toKey);
pExpression = assignment->getExpressionPtr();
if (pExpression == NULL) return info;
if (!mergeInExpression(toKey, key, pExpression)) return info;
}
}
imax = mpModel->getMetabolites().size();
for (i = 0; i < imax; ++i)
{
CMetab* metab = &mpModel->getMetabolites()[i];
if (!metab) return info;
switch (metab->getStatus())
{
case CModelEntity::FIXED:
case CModelEntity::REACTIONS:
break;
case CModelEntity::ASSIGNMENT:
if (!mergeInExpression(toKey, key, metab->getExpressionPtr())) return info;
break;
case CModelEntity::ODE:
if (!mergeInExpression(toKey, key, metab->getExpressionPtr())) return info;