本文整理汇总了C++中Delay::getMath方法的典型用法代码示例。如果您正苦于以下问题:C++ Delay::getMath方法的具体用法?C++ Delay::getMath怎么用?C++ Delay::getMath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Delay
的用法示例。
在下文中一共展示了Delay::getMath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertTimeAndExtentWith
int Submodel::convertTimeAndExtentWith(const ASTNode* tcf, const ASTNode* xcf, const ASTNode* klmod)
{
if (tcf==NULL && xcf==NULL) return LIBSBML_OPERATION_SUCCESS;
Model* model = getInstantiation();
if (model==NULL) {
//getInstantiation sets its own error messages.
return LIBSBML_OPERATION_FAILED;
}
ASTNode tcftimes(AST_TIMES);
ASTNode tcfdiv(AST_DIVIDE);
if (tcf != NULL) {
tcftimes.addChild(tcf->deepCopy());
tcfdiv.addChild(tcf->deepCopy());
}
ASTNode rxndivide(AST_DIVIDE);
if (klmod != NULL) {
ASTNode rxnref(AST_NAME);
rxndivide.addChild(rxnref.deepCopy());
rxndivide.addChild(klmod->deepCopy());
}
List* allElements = model->getAllElements();
for (ListIterator iter = allElements->begin(); iter != allElements->end(); ++iter)
{
SBase* element = static_cast<SBase*>(*iter);
assert(element != NULL);
ASTNode* ast1 = NULL;
ASTNode* ast2 = NULL;
Constraint* constraint = NULL;
Delay* delay = NULL;
EventAssignment* ea = NULL;
InitialAssignment* ia = NULL;
KineticLaw* kl = NULL;
Priority* priority = NULL;
RateRule* rrule = NULL;
Rule* rule = NULL;
Submodel* submodel = NULL;
Trigger* trigger = NULL;
string cf = "";
//Reaction math will be converted below, in the bits with the kinetic law. But because of that, we need to handle references *to* the reaction: even if it has no kinetic law, the units have changed, and this needs to be reflected by the flattening routine.
if (rxndivide.getNumChildren() != 0 && element->getTypeCode()==SBML_REACTION && element->isSetId()) {
rxndivide.getChild(0)->setName(element->getId().c_str());
for (ListIterator iter = allElements->begin(); iter != allElements->end(); ++iter)
{
SBase* subelement = static_cast<SBase*>(*iter);
subelement->replaceSIDWithFunction(element->getId(), &rxndivide);
}
}
//Submodels need their timeConversionFactor and extentConversionFactor attributes converted. We're moving top-down, so all we need to do here is fix the conversion factor attributes themselves, pointing them to new parameters if need be.
if ((tcf !=NULL || xcf != NULL) && element->getTypeCode()==SBML_COMP_SUBMODEL) {
submodel = static_cast<Submodel*>(element);
if (tcf != NULL) {
if (submodel->isSetTimeConversionFactor()) {
createNewConversionFactor(cf, tcf, submodel->getTimeConversionFactor(), model);
submodel->setTimeConversionFactor(cf);
}
else {
submodel->setTimeConversionFactor(tcf->getName());
}
}
if (xcf != NULL) {
if (submodel->isSetExtentConversionFactor()) {
createNewConversionFactor(cf, xcf, submodel->getExtentConversionFactor(), model);
submodel->setExtentConversionFactor(cf);
}
else {
submodel->setExtentConversionFactor(xcf->getName());
}
}
}
if (tcf==NULL) {
if (klmod !=NULL && element->getTypeCode()==SBML_KINETIC_LAW) {
kl = static_cast<KineticLaw*>(element);
if (kl->isSetMath()) {
ast1 = new ASTNode(AST_TIMES);
ast1->addChild(klmod->deepCopy());
ast1->addChild(kl->getMath()->deepCopy());
kl->setMath(ast1);
delete ast1;
}
}
}
else {
// All math 'time' and 'delay' csymbols must still be converted.
// Also, several constructs are modified directly.
switch(element->getTypeCode()) {
//This would be a WHOLE LOT SIMPLER if there was a 'hasMath' class in libsbml. But even so, it would have to
// handle the kinetic laws, rate rules, and delays separately.
case SBML_KINETIC_LAW:
//Kinetic laws are multiplied by 'klmod'.
kl = static_cast<KineticLaw*>(element);
ast1 = kl->getMath()->deepCopy();
convertCSymbols(ast1, &tcfdiv, &tcftimes);
if (klmod !=NULL) {
kl = static_cast<KineticLaw*>(element);
if (kl->isSetMath()) {
ast2 = new ASTNode(AST_TIMES);
ast2->addChild(klmod->deepCopy());
ast2->addChild(ast1);
kl->setMath(ast2);
//.........这里部分代码省略.........