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


C++ CCopasiObjectName::getRemainder方法代码示例

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


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

示例1: nameFromCN

// static
std::string CModelParameter::nameFromCN(const CCopasiObjectName & cn)
{
    CCopasiObjectName Primary = cn.getPrimary();
    CCopasiObjectName Remainder = cn.getRemainder();

    while (Remainder != "")
    {
        Primary = Remainder.getPrimary();
        Remainder = Remainder.getRemainder();
    }

    std::string Name = Primary.getElementName(0);

    if (Name != "")
    {
        return Name;
    }

    return Primary.getObjectName();
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:21,代码来源:CModelParameter.cpp

示例2: compile

// virtual
void CModelParameterReactionParameter::compile()
{
    CModelParameter::compile();

    mGlobalQuantityCN = std::string();

    std::string Infix = getInitialExpression();

    if (Infix.length() > 2)
    {
        // Infix: <CN,Reference=InitialValue> or <CN,Reference=Value>
        CCopasiObjectName Tmp = Infix.substr(1, Infix.length() - 2);
        std::string Separator = "";

        for (; Tmp != ""; Tmp = Tmp.getRemainder())
        {
            CCopasiObjectName Primary = Tmp.getPrimary();

            if (Primary.getObjectType() == "Reference")
            {
                break;
            }

            mGlobalQuantityCN += Separator + Primary;
            Separator = ",";
        }

        setSimulationType(CModelEntity::ASSIGNMENT);
    }
    else
    {
        setSimulationType(CModelEntity::FIXED);
    }

    mpGlobalQuantity = this->getSet()->getModelParameter(mGlobalQuantityCN);

    if (mpGlobalQuantity != NULL)
    {
        mValue = mpGlobalQuantity->getValue(ParticleNumbers);
    }

    std::vector< CCopasiContainer * > ListOfContainer;

    CModel * pModel = getModel();
    ListOfContainer.push_back(pModel);

    mpReaction = static_cast< CReaction * >(pModel->getObjectDataModel()->ObjectFromName(ListOfContainer, mpParent->getCN()));
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:49,代码来源:CModelParameter.cpp

示例3: setCN

// virtual
void CModelParameterSpecies::setCN(const CCopasiObjectName & cn)
{
    CModelParameter::setCN(cn);

    // Determine the CN for the compartment.
    // "CN=Root,Model=New Model,Vector=Compartments[compartment],Vector=Metabolites[A]"
    CCopasiObjectName Tmp = mCN;
    std::string Separator = "";

    for (; Tmp != ""; Tmp = Tmp.getRemainder())
    {
        CCopasiObjectName Primary = Tmp.getPrimary();
        mCompartmentCN += Separator + Primary;
        Separator = ",";

        if (Primary.getObjectType() == "Vector" &&
                Primary.getObjectName() == "Compartments")
        {
            break;
        }
    }
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:23,代码来源:CModelParameter.cpp

示例4: updateExpression

void CModelExpansion::updateExpression(CExpression* exp, const std::string & index, const SetOfModelElements & sourceSet, ElementsMap & emap)
{
  if (!exp)
    return;

  //we loop through the complete expression
  std::vector< CEvaluationNode * >::const_iterator it = exp->getNodeList().begin();
  std::vector< CEvaluationNode * >::const_iterator end = exp->getNodeList().end();

  for (; it != end; ++it)
    {
      CEvaluationNodeObject * node = dynamic_cast<CEvaluationNodeObject*>(*it);

      if (!node)
        continue;

      //std::cout << node->getData() << std::endl;
      const CCopasiObject * pObj = dynamic_cast<const CCopasiObject*>(node->getObjectInterfacePtr());
      std::string refname = "";
      std::string reftype = "";

      //when copying between models, pObj=NULL. This is because the expression could not be compiled
      //if it points to an object in a different model.
      //We try to fix this now:
      if (!pObj && mpSourceModel)
        {
          CCopasiObjectName cn = node->getObjectCN();

          while (cn.getPrimary().getObjectType() != "Model" && !cn.empty())
            {
              cn = cn.getRemainder();
            }

          pObj = dynamic_cast<const CCopasiObject*>(mpSourceModel->getObject(cn));
        }

      if (pObj)
        {
          refname = pObj->getObjectName();
          reftype = pObj->getObjectType();
          pObj = pObj->getObjectParent();
        }

      //is the object one that is/should be copied?
      if (sourceSet.contains(pObj))
        {
          if (!emap.exists(pObj))
            {
              //we have to create the duplicate
              std::cout << "!!!" << std::endl;

              if (dynamic_cast<const CCompartment*>(pObj))
                duplicateCompartment(dynamic_cast<const CCompartment*>(pObj), index, sourceSet, emap);

              if (dynamic_cast<const CMetab*>(pObj))
                duplicateMetab(dynamic_cast<const CMetab*>(pObj), index, sourceSet, emap);

              if (dynamic_cast<const CModelValue*>(pObj))
                duplicateGlobalQuantity(dynamic_cast<const CModelValue*>(pObj), index, sourceSet, emap);

              if (dynamic_cast<const CReaction*>(pObj))
                duplicateReaction(dynamic_cast<const CReaction*>(pObj), index, sourceSet, emap);
            }

          //find the duplicate
          const CCopasiObject* duplicate = emap.getDuplicatePtr(pObj);

          if (duplicate)
            {
              //get the reference object
              const CCopasiObject* pRef = dynamic_cast<const CCopasiObject*>(duplicate->getObject(reftype + "=" + refname));

              //update the node
              if (pRef)
                node->setData("<" + pRef->getCN() + ">");

              //std::cout << node->getData() << std::endl;
            }
        }
    }
}
开发者ID:PriKalra,项目名称:COPASI,代码行数:81,代码来源:CModelExpansion.cpp


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