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


C++ SpeciesReference::unsetStoichiometryMath方法代码示例

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


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

示例1: removeFromParentAndDelete

int StoichiometryMath::removeFromParentAndDelete()
{
  SBase* parent = getParentSBMLObject();
  if (parent==NULL) return LIBSBML_OPERATION_FAILED;
  SpeciesReference* parentSR = static_cast<SpeciesReference*>(parent);
  if (parentSR == NULL) return LIBSBML_OPERATION_FAILED;
  return parentSR->unsetStoichiometryMath();
}
开发者ID:0u812,项目名称:libsbml.js.frozen,代码行数:8,代码来源:StoichiometryMath.cpp

示例2: dealWithAssigningL1Stoichiometry

void dealWithAssigningL1Stoichiometry(Model & m, bool l2)
{
  //char newid[15];
  std::string id;

  for (unsigned int i = 0; i < m.getNumReactions(); i++)
  {
    Reaction *r = m.getReaction(i);
    unsigned int j;

    for (j = 0; j < r->getNumReactants(); j++)
    {
      SpeciesReference *sr = r->getReactant(j);
      // we do not get here unless the stoichiometryMath is an integer
      // or a rational 
      if (l2 == true && sr->isSetStoichiometryMath() == true)
      {
        const ASTNode* ast = sr->getStoichiometryMath()->getMath();
        if (ast->isInteger())
        {
          int num = ast->getInteger();
          sr->setStoichiometry(num);
          sr->setDenominator(1);
        }
        else
        {
          int num = ast->getNumerator();
          int denom = ast->getDenominator();
          sr->setStoichiometry(num);
          sr->setDenominator(denom);
        }
        sr->unsetStoichiometryMath();
      }
      else
      {
        sr->setStoichiometry(sr->getStoichiometry());
        sr->setDenominator(1);
      }
    }
    for (j = 0; j < r->getNumProducts(); j++)
    {
      SpeciesReference *sr = r->getProduct(j);
      // we do not get here unless the stoichiometryMath is an integer
      // or a rational 
      if (l2 == true && sr->isSetStoichiometryMath() == true)
      {
        const ASTNode* ast = sr->getStoichiometryMath()->getMath();
        if (ast->isInteger())
        {
          int num = ast->getInteger();
          sr->setStoichiometry(num);
          sr->setDenominator(1);
        }
        else
        {
          int num = ast->getNumerator();
          int denom = ast->getDenominator();
          sr->setStoichiometry(num);
          sr->setDenominator(denom);
        }
        sr->unsetStoichiometryMath();
      }
      else
      {
        sr->setStoichiometry(sr->getStoichiometry());
        sr->setDenominator(1);
      }
    }
  }
}
开发者ID:TotteKarlsson,项目名称:roadrunner,代码行数:70,代码来源:SBMLConvert.cpp


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