本文整理汇总了C++中SpeciesReference::setId方法的典型用法代码示例。如果您正苦于以下问题:C++ SpeciesReference::setId方法的具体用法?C++ SpeciesReference::setId怎么用?C++ SpeciesReference::setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpeciesReference
的用法示例。
在下文中一共展示了SpeciesReference::setId方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SpeciesReference
// #######################################################################
SpeciesReference* SBML_formatter::species2SpeciesReference(const Species* species, const Reaction* rxn, string addToSpeciesID){
string value = species->getId();
SpeciesReference* SR = new SpeciesReference(species->getLevel(), species->getVersion());
value = species->getId();
if (addToSpeciesID != ""){
// sets the species name, as
value.append(addToSpeciesID);
}
SR->setSpecies(value);
SR->setStoichiometry(1);
SR->setId((value.append("_ref_")).append(dtostr(unique)));
value.clear();
value.append(species->getId());
SR->setName((value.append("_in_rxn_")).append(rxn->getId()));
// unique is a static variable which allows anything that needs a modelwide unique value to get
// one;
unique++;
return SR;
}
示例2: getReaction
void
Model::convertStoichiometryMath()
{
unsigned int n, j;
Reaction * r;
SpeciesReference *sr;
unsigned int idCount = 0;
char newid[15];
std::string id;
for (n = 0; n < getNumReactions(); n++)
{
r = getReaction(n);
for (j = 0; j < r->getNumReactants(); j++)
{
sr = r->getReactant(j);
if (sr->isSetStoichiometryMath())
{
if (!sr->isSetId())
{
sprintf(newid, "generatedId_%u", idCount);
id.assign(newid);
sr->setId(id);
idCount++;
}
else
{
id = sr->getId();
}
sr->setConstant(false);
AssignmentRule * ar = createAssignmentRule();
ar->setVariable(id);
if (sr->getStoichiometryMath()->isSetMath())
{
ar->setMath(sr->getStoichiometryMath()->getMath());
}
}
}
for (j = 0; j < r->getNumProducts(); j++)
{
sr = r->getProduct(j);
if (sr->isSetStoichiometryMath())
{
if (!sr->isSetId())
{
sprintf(newid, "generatedId_%u", idCount);
id.assign(newid);
sr->setId(id);
idCount++;
}
else
{
id = sr->getId();
}
sr->setConstant(false);
AssignmentRule * ar = createAssignmentRule();
ar->setVariable(id);
if (sr->getStoichiometryMath()->isSetMath())
{
ar->setMath(sr->getStoichiometryMath()->getMath());
}
}
}
}
}
示例3: dealWithL1Stoichiometry
void dealWithL1Stoichiometry(Model & m, bool l2)
{
unsigned int idCount = 0;
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);
if (sr->getDenominator() != 1)
{
long stoich = static_cast<long>(sr->getStoichiometry());
int denom = sr->getDenominator();
ASTNode *node = new ASTNode();
node->setValue(stoich, denom);
if (l2 == true)
{
StoichiometryMath * sm = sr->createStoichiometryMath();
sm->setMath(node);
}
else
{
sprintf(newid, "speciesRefId_%u", idCount);
id.assign(newid);
idCount++;
sr->setId(id);
InitialAssignment * ar = m.createInitialAssignment();
ar->setSymbol(id);
ar->setMath(node);
sr->unsetStoichiometry();
}
}
}
for (j = 0; j < r->getNumProducts(); j++)
{
SpeciesReference *sr = r->getProduct(j);
if (sr->getDenominator() != 1)
{
long stoich = static_cast<long>(sr->getStoichiometry());
int denom = sr->getDenominator();
ASTNode *node = new ASTNode();
node->setValue(stoich, denom);
if (l2 == true)
{
StoichiometryMath * sm = sr->createStoichiometryMath();
sm->setMath(node);
}
else
{
sprintf(newid, "speciesRefId_%u", idCount);
id.assign(newid);
idCount++;
sr->setId(id);
InitialAssignment * ar = m.createInitialAssignment();
ar->setSymbol(id);
ar->setMath(node);
sr->unsetStoichiometry();
}
}
}
}
}