本文整理汇总了C++中SpeciesReference::createStoichiometryMath方法的典型用法代码示例。如果您正苦于以下问题:C++ SpeciesReference::createStoichiometryMath方法的具体用法?C++ SpeciesReference::createStoichiometryMath怎么用?C++ SpeciesReference::createStoichiometryMath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpeciesReference
的用法示例。
在下文中一共展示了SpeciesReference::createStoichiometryMath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sprintf
void
createParameterAsRateRule(Model &m, SpeciesReference &sr, Rule &rr,
unsigned int idCount)
{
char newid[15];
std::string id;
// create parameter as variable of rate rule
// and use stoichiometryMath to point to this
sprintf(newid, "parameterId_%u", idCount);
id.assign(newid);
Parameter *p = m.createParameter();
p->setId(id);
p->setConstant(false);
rr.setVariable(id);
StoichiometryMath *sm = sr.createStoichiometryMath();
if (sm != NULL)
{
ASTNode *ast = SBML_parseFormula(id.c_str());
sm->setMath(ast);
}
}
示例2:
void
useStoichMath(Model & m, SpeciesReference &sr, bool isRule)
{
// use stoichiometryMath instead
StoichiometryMath *sm = sr.createStoichiometryMath();
if (sm != NULL)
{
if (isRule == true)
{
sm->setMath(m.getRule(sr.getId())->getMath());
m.removeRule(sr.getId());
}
else
{
sm->setMath(m.getInitialAssignment(sr.getId())->getMath());
m.removeInitialAssignment(sr.getId());
}
}
}
示例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();
}
}
}
}
}