本文整理汇总了C++中Species::setUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ Species::setUnits方法的具体用法?C++ Species::setUnits怎么用?C++ Species::setUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Species
的用法示例。
在下文中一共展示了Species::setUnits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equals
END_TEST
START_TEST (test_WriteL3SBML_Species)
{
const char* expected =
"<species id=\"Ca2\" compartment=\"cell\" initialAmount=\"0.7\""
" substanceUnits=\"mole\" hasOnlySubstanceUnits=\"false\""
" boundaryCondition=\"true\" constant=\"true\"/>";
Species *s = D->createModel()->createSpecies();
s->setId("Ca2");
s->setCompartment("cell");
s->setInitialAmount(0.7);
s->setUnits("mole");
s->setBoundaryCondition(true);
s->setHasOnlySubstanceUnits(false);
s->setConstant(true);
char* sbml = s->toSBML();
fail_unless( equals(expected, sbml) );
safe_free(sbml);
}
示例2: Species
//.........这里部分代码省略.........
fail_unless(ud->getUnit(0)->getMultiplier() == 1);
fail_unless(ud->getUnit(0)->getScale() == -2);
fail_unless(ud->getUnit(0)->getExponent() == 1);
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_MOLE);
delete ud;
/* species with units from model substance*/
ud = uff->getUnitDefinitionFromSpecies(m->getSpecies(2));
fail_unless(ud->getNumUnits() == 2);
fail_unless(!strcmp(ud->getId().c_str(), ""), NULL);
fail_unless(ud->getUnit(0)->getMultiplier() == 1);
fail_unless(ud->getUnit(0)->getScale() == 0);
fail_unless(ud->getUnit(0)->getExponent() == 1);
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_MOLE);
fail_unless(ud->getUnit(1)->getMultiplier() == 1);
fail_unless(ud->getUnit(1)->getScale() == 0);
fail_unless(ud->getUnit(1)->getExponent() == -1);
fail_unless(ud->getUnit(1)->getOffset() == 0.0);
fail_unless(ud->getUnit(1)->getKind() == UNIT_KIND_LITRE);
delete ud;
ud = uff->getSpeciesSubstanceUnitDefinition(m->getSpecies(2));
fail_unless(ud->getNumUnits() == 1);
fail_unless(!strcmp(ud->getId().c_str(), ""), NULL);
fail_unless(ud->getUnit(0)->getMultiplier() == 1);
fail_unless(ud->getUnit(0)->getScale() == 0);
fail_unless(ud->getUnit(0)->getExponent() == 1);
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_MOLE);
delete ud;
/* species with declared standard units for substance and no spatialSizeUnits*/
ud = uff->getUnitDefinitionFromSpecies(m->getSpecies(3));
fail_unless(ud->getNumUnits() == 0);
delete ud;
ud = uff->getSpeciesSubstanceUnitDefinition(m->getSpecies(3));
fail_unless(ud->getNumUnits() == 1);
fail_unless(!strcmp(ud->getId().c_str(), ""), NULL);
fail_unless(ud->getUnit(0)->getMultiplier() == 1);
fail_unless(ud->getUnit(0)->getScale() == 0);
fail_unless(ud->getUnit(0)->getExponent() == 1);
fail_unless(ud->getUnit(0)->getOffset() == 0.0);
fail_unless(ud->getUnit(0)->getKind() == UNIT_KIND_MOLE);
///* check deals with invalid nodes */
delete ud;
UnitDefinition * ud1 = NULL;
Species *s = new Species(m->getLevel(), m->getVersion());
s->setId("s");
s->setUnits("undefined");
ud1 = uff->getUnitDefinitionFromSpecies(s);
fail_unless (ud1->getNumUnits() == 0);
delete ud1;
ud1 = uff->getSpeciesSubstanceUnitDefinition(s);
fail_unless (ud1->getNumUnits() == 0);
s->setUnits("mole"); // here the compartment size will be NULL
delete ud1;
ud1 = uff->getUnitDefinitionFromSpecies(s);
fail_unless (ud1->getNumUnits() == 1);
delete ud1;
ud1 = uff->getSpeciesSubstanceUnitDefinition(s);
fail_unless (ud1->getNumUnits() == 1);
delete s;
delete ud1;
}