本文整理汇总了C++中CCopasiObjectName::getPrimary方法的典型用法代码示例。如果您正苦于以下问题:C++ CCopasiObjectName::getPrimary方法的具体用法?C++ CCopasiObjectName::getPrimary怎么用?C++ CCopasiObjectName::getPrimary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCopasiObjectName
的用法示例。
在下文中一共展示了CCopasiObjectName::getPrimary方法的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();
}
示例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()));
}
示例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;
}
}
}
示例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;
}
}
}
}