本文整理汇总了C++中SpeciesReference::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ SpeciesReference::getId方法的具体用法?C++ SpeciesReference::getId怎么用?C++ SpeciesReference::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpeciesReference
的用法示例。
在下文中一共展示了SpeciesReference::getId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
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());
}
}
}
示例2: checkSpeciesRefs
void checkSpeciesRefs(Model* model, ListOfSpeciesReferences* losr, set<string>& components, set<string>& tests, const map<string, vector<double> >& results)
{
for (unsigned int rp=0; rp<losr->size(); rp++) {
SpeciesReference* sr = static_cast<SpeciesReference*>(losr->get(rp));
if (sr->isSetStoichiometry() && sr->getStoichiometry() != 1) {
tests.insert("NonUnityStoichiometry");
}
if (sr->isSetStoichiometryMath()) {
tests.insert("NonUnityStoichiometry");
components.insert("StoichiometryMath");
if (variesIn(sr->getStoichiometryMath()->getMath(), model, results)) {
tests.insert("AssignedVariableStoichiometry");
}
else {
tests.insert("AssignedConstantStoichiometry");
}
}
else if (sr->isSetId()) {
double initialResult = 1;
if (results.find(sr->getId()) != results.end()) {
tests.insert("SpeciesReferenceOutput");
}
if (variesIn(sr->getId(), model, results)) {
tests.insert("AssignedVariableStoichiometry");
tests.insert("NonUnityStoichiometry");
}
else if (initialOverriddenIn(sr->getId(), model, results, tests)) {
tests.insert("AssignedConstantStoichiometry");
if (getInitialResultFor(sr->getId(), results, initialResult)) {
if (initialResult != 1) {
tests.insert("NonUnityStoichiometry");
}
}
else {
//Don't know what the actual initial result is, so we'll assume it's not 1.0.
tests.insert("NonUnityStoichiometry");
}
}
if (initialOverriddenIn(sr->getId(), model, results, tests)) {
tests.insert("InitialValueReassigned");
}
if (foundInMath(sr->getId(), model)) {
tests.insert("SpeciesReferenceInMath");
}
}
}
}
示例3: 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());
}
}
}
}
}
示例4: if
void
Model::dealWithStoichiometry()
{
unsigned int idCount = 0;
for (unsigned int i = 0; i < getNumReactions(); i++)
{
Reaction *r = getReaction(i);
unsigned int j;
for (j = 0; j < r->getNumReactants(); j++)
{
SpeciesReference *sr = r->getReactant(j);
if (sr->isSetStoichiometry() == false)
{
if (sr->isSetId() == false)
{
createNoValueStoichMath(*this, *sr, idCount);
idCount++;
}
else
{
// id is set it could be used by initialAssignment
// used by rule
// not used
if (getInitialAssignment(sr->getId()) != NULL)
{
useStoichMath(*this, *sr, false);
}
else if (getRule(sr->getId()) != NULL)
{
//assignmentRule
if (getRule(sr->getId())->getTypeCode() == SBML_ASSIGNMENT_RULE)
{
useStoichMath(*this, *sr, true);
}
else if (getRule(sr->getId())->getTypeCode() == SBML_RATE_RULE)
{
createParameterAsRateRule(*this, *sr, *(getRule(sr->getId())), idCount);
idCount++;
}
}
else
{
createNoValueStoichMath(*this, *sr, idCount);
idCount++;
}
}
}
else
{
// stoichiometry is set
if (sr->isSetId())
{
// id is set it could be used by initialAssignment
// used by rule
// not used
if (getInitialAssignment(sr->getId()) != NULL)
{
useStoichMath(*this, *sr, false);
}
else if (getRule(sr->getId()) != NULL)
{
//assignmentRule
if (getRule(sr->getId())->getTypeCode() == SBML_ASSIGNMENT_RULE)
{
useStoichMath(*this, *sr, true);
}
else if (getRule(sr->getId())->getTypeCode() == SBML_RATE_RULE)
{
createParameterAsRateRule(*this, *sr, *(getRule(sr->getId())), idCount);
idCount++;
}
}
}
// no id set - do not need to do anything
}
}
for (j = 0; j < r->getNumProducts(); j++)
{
SpeciesReference *sr = r->getProduct(j);
if (sr->isSetStoichiometry() == false)
{
if (sr->isSetId() == false)
{
createNoValueStoichMath(*this, *sr, idCount);
idCount++;
}
else
{
// id is set it could be used by initialAssignment
// used by rule
// not used
if (getInitialAssignment(sr->getId()) != NULL)
{
useStoichMath(*this, *sr, false);
}
else if (getRule(sr->getId()) != NULL)
{
//assignmentRule
if (getRule(sr->getId())->getTypeCode() == SBML_ASSIGNMENT_RULE)
//.........这里部分代码省略.........
示例5:
void
CompIdBase::checkId (const SpeciesReference& x)
{
if (x.isSetId()) doCheckId(x.getId(), x);
}
示例6: if
bool
LayoutSpeciesReferencePlugin::readOtherXML (SBase* parentObject, XMLInputStream& stream)
{
if (!parentObject) return false;
bool readAnnotationFromStream = false;
//
// This plugin object is used only for SBML Level 2 Version 1.
//
if ( getURI() != LayoutExtension::getXmlnsL2() ) return false;
if ( parentObject->getVersion() > 1 ) return false;
XMLNode *pAnnotation = parentObject->getAnnotation();
if (!pAnnotation)
{
//
// (NOTES)
//
// annotation element has not been parsed by the parent element
// (SpeciesReference) of this plugin object, thus annotation
// element is parsed via the given XMLInputStream object in this block.
//
const string& name = stream.peek().getName();
if (name == "annotation")
{
pAnnotation = new XMLNode(stream);
SpeciesReference *sr = static_cast<SpeciesReference*>(parentObject);
parseSpeciesReferenceAnnotation(pAnnotation,*sr);
std::string srId = sr->getId();
if (!srId.empty())
{
//
// Removes the annotation for layout extension from the annotation
// of parent element (pAnnotation) and then set the new annotation
// (newAnnotation) to the parent element.
//
XMLNode *newAnnotation = deleteLayoutIdAnnotation(pAnnotation);
parentObject->setAnnotation(newAnnotation);
delete newAnnotation;
}
else
{
//
// No layout annotation is included in the read annotation
// (pAnnotation) and thus just set the annotation to the parent
// element.
//
parentObject->setAnnotation(pAnnotation);
}
delete pAnnotation;
readAnnotationFromStream = true;
}
}
else if (parentObject->getId().empty())
{
//
// (NOTES)
//
// annotation element has been parsed by the parent element
// (SpeciesReference) of this plugin object, thus the annotation element
// set to the above pAnnotation variable is parsed in this block.
//
SpeciesReference *sr = static_cast<SpeciesReference*>(parentObject);
parseSpeciesReferenceAnnotation(pAnnotation, *sr);
std::string srId = sr->getId();
if (!srId.empty())
{
//
// Removes the annotation for layout extension from the annotation
// of parent element (pAnnotation) and then set the new annotation
// (newAnnotation) to the parent element.
//
XMLNode *newAnnotation = deleteLayoutIdAnnotation(pAnnotation);
parentObject->setAnnotation(newAnnotation);
delete newAnnotation;
}
readAnnotationFromStream = true;
}
return readAnnotationFromStream;
}