本文整理汇总了C++中Species::setInitialConcentration方法的典型用法代码示例。如果您正苦于以下问题:C++ Species::setInitialConcentration方法的具体用法?C++ Species::setInitialConcentration怎么用?C++ Species::setInitialConcentration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Species
的用法示例。
在下文中一共展示了Species::setInitialConcentration方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createExampleInvolvingUnits
//.........这里部分代码省略.........
//---------------------------------------------------------------------------
//
// Creates Species objects inside the Model object.
//
//---------------------------------------------------------------------------
// Temporary pointer (reused more than once below).
Species *sp;
//---------------------------------------------------------------------------
// (Species1) Creates a Species object ("x0")
//---------------------------------------------------------------------------
sp = model->createSpecies();
sp->setId("x0");
// Sets the "compartment" attribute of the Species object to identify the
// compartnet in which the Species object located.
sp->setCompartment(compName);
// Sets the "initialConcentration" attribute of the Species object.
//
// The units of this Species object is determined by two attributes of this
// Species object ("substanceUnits" and "hasOnlySubstanceUnits") and the
// "spatialDimensions" attribute of the Compartment object ("cytosol") in which
// this species object is located.
// Since the default values are used for "substanceUnits" (substance (mole))
// and "hasOnlySubstanceUnits" (false) and the value of "spatialDimension" (3)
// is greater than 0, the units of this Species object is moles/liters .
//
sp->setInitialConcentration(1);
//---------------------------------------------------------------------------
// (Species2) Creates a Species object ("x1")
//---------------------------------------------------------------------------
sp = model->createSpecies();
sp->setId("x1");
sp->setCompartment(compName);
sp->setInitialConcentration(1);
//---------------------------------------------------------------------------
// (Species3) Creates a Species object ("s1")
//---------------------------------------------------------------------------
sp = model->createSpecies();
sp->setCompartment(compName);
sp->setId("s1");
sp->setInitialConcentration(1);
//---------------------------------------------------------------------------
// (Species4) Creates a Species object ("s2")
//---------------------------------------------------------------------------
sp = model->createSpecies();
sp->setCompartment(compName);
sp->setId("s2");
sp->setInitialConcentration(1);
//---------------------------------------------------------------------------
//
// Creates global Parameter objects inside the Model object.
//
示例2: createExampleInvolvingFunctionDefinitions
//.........这里部分代码省略.........
//---------------------------------------------------------------------------
//
// Creates Species objects inside the Model object.
//
//---------------------------------------------------------------------------
Species* sp;
//---------------------------------------------------------------------------
// (Species1) Creates a Species object ("S1")
//---------------------------------------------------------------------------
sp = model->createSpecies();
sp->setId("S1");
// Sets the "compartment" attribute of the Species object to identify the
// compartnet in which the Species object located.
sp->setCompartment(compName);
// Sets the "initialConcentration" attribute of the Species object.
//
// The units of this Species object is determined by two attributes of this
// Species object ("substanceUnits" and "hasOnlySubstanceUnits") and the
// "spatialDimension" attribute of the Compartment object ("cytosol") in which
// this species object located.
// Since the default values are used for "substanceUnits" (substance (mole))
// and "hasOnlySubstanceUnits" (false) and the value of "spatialDimension" (3)
// is greater than 0, the units of this Species object is mole/litre .
//
sp->setInitialConcentration(1);
//---------------------------------------------------------------------------
// (Species2) Creates a Species object ("S2")
//---------------------------------------------------------------------------
sp = model->createSpecies();
sp->setId("S2");
sp->setCompartment(compName);
sp->setInitialConcentration(0);
//---------------------------------------------------------------------------
//
// Creates a global Parameter object inside the Model object.
//
//---------------------------------------------------------------------------
Parameter* para;
// Creates a Parameter ("t")
para = model->createParameter();
para->setId("t");
para->setValue(1);
para->setUnits("second");
//---------------------------------------------------------------------------
//
// Creates Reaction objects inside the Model object.
//
//---------------------------------------------------------------------------
示例3: CreateSBMLModel
void Module::CreateSBMLModel()
{
Model* sbmlmod = m_sbml.createModel();
sbmlmod->setId(m_modulename);
sbmlmod->setName(m_modulename);
sbmlmod->setNotes("<body xmlns=\"http://www.w3.org/1999/xhtml\"><p> Originally created by libAntimony " VERSION_STRING " (using libSBML " LIBSBML_DOTTED_VERSION ") </p></body>");
char cc = g_registry.GetCC();
//User-defined functions
for (size_t uf=0; uf<g_registry.GetNumUserFunctions(); uf++) {
const UserFunction* userfunction = g_registry.GetNthUserFunction(uf);
assert(userfunction != NULL);
FunctionDefinition* fd = sbmlmod->createFunctionDefinition();
fd->setId(userfunction->GetModuleName());
ASTNode* math = parseStringToASTNode(userfunction->ToSBMLString());
fd->setMath(math);
delete math;
}
//Compartments
Compartment* defaultCompartment = sbmlmod->createCompartment();
defaultCompartment->setId(DEFAULTCOMP);
defaultCompartment->setConstant(true);
defaultCompartment->setSize(1);
defaultCompartment->setSBOTerm(410); //The 'implicit compartment'
size_t numcomps = GetNumVariablesOfType(allCompartments);
for (size_t comp=0; comp<numcomps; comp++) {
const Variable* compartment = GetNthVariableOfType(allCompartments, comp);
Compartment* sbmlcomp = sbmlmod->createCompartment();
sbmlcomp->setId(compartment->GetNameDelimitedBy(cc));
if (compartment->GetDisplayName() != "") {
sbmlcomp->setName(compartment->GetDisplayName());
}
sbmlcomp->setConstant(compartment->GetIsConst());
formula_type ftype = compartment->GetFormulaType();
assert (ftype == formulaINITIAL || ftype==formulaASSIGNMENT || ftype==formulaRATE);
if (ftype != formulaINITIAL) {
sbmlcomp->setConstant(false);
}
const Formula* formula = compartment->GetFormula();
if (formula->IsDouble()) {
sbmlcomp->setSize(atof(formula->ToSBMLString().c_str()));
}
SetAssignmentFor(sbmlmod, compartment);
}
//Species
size_t numspecies = GetNumVariablesOfType(allSpecies);
for (size_t spec=0; spec < numspecies; spec++) {
const Variable* species = GetNthVariableOfType(allSpecies, spec);
Species* sbmlspecies = sbmlmod->createSpecies();
sbmlspecies->setId(species->GetNameDelimitedBy(cc));
if (species->GetDisplayName() != "") {
sbmlspecies->setName(species->GetDisplayName());
}
sbmlspecies->setConstant(false); //There's no need to try to distinguish between const and var for species.
if (species->GetIsConst()) {
sbmlspecies->setBoundaryCondition(true);
}
else {
sbmlspecies->setBoundaryCondition(false);
}
const Variable* compartment = species->GetCompartment();
if (compartment == NULL) {
sbmlspecies->setCompartment(defaultCompartment->getId());
}
else {
sbmlspecies->setCompartment(compartment->GetNameDelimitedBy(cc));
}
const Formula* formula = species->GetFormula();
if (formula->IsDouble()) {
sbmlspecies->setInitialConcentration(atof(formula->ToSBMLString().c_str()));
}
else if (formula->IsAmountIn(species->GetCompartment())) {
sbmlspecies->setInitialAmount(formula->ToAmount());
}
SetAssignmentFor(sbmlmod, species);
}
//Formulas
size_t numforms = GetNumVariablesOfType(allFormulas);
for (size_t form=0; form < numforms; form++) {
const Variable* formvar = GetNthVariableOfType(allFormulas, form);
const Formula* formula = formvar->GetFormula();
Parameter* param = sbmlmod->createParameter();
param->setId(formvar->GetNameDelimitedBy(cc));
if (formvar->GetDisplayName() != "") {
param->setName(formvar->GetDisplayName());
}
param->setConstant(formvar->GetIsConst());
if (formula->IsDouble()) {
param->setValue(atof(formula->ToSBMLString().c_str()));
}
SetAssignmentFor(sbmlmod, formvar);
formula_type ftype = formvar->GetFormulaType();
assert (ftype == formulaINITIAL || ftype==formulaASSIGNMENT || ftype==formulaRATE);
if (ftype != formulaINITIAL) {
param->setConstant(false);
}
}
//Reactions
//.........这里部分代码省略.........
示例4: main
LIBSBML_CPP_NAMESPACE_USE
int main(int argc,char** argv)
{
DynPkgNamespaces sbmlns;
// create the document
SBMLDocument *document = new SBMLDocument(&sbmlns);
document->setPackageRequired("dyn", true);
// create the Model
Model* model=document->createModel();
model->setId("singleCell");
// create the Compartment
Compartment* compartment = model->createCompartment();
compartment->setId("Extracellular");
compartment->setConstant(true);
compartment->setSize(8000000);
compartment->setSpatialDimensions(3.0);
compartment = model->createCompartment();
compartment->setId("PlasmaMembrane");
compartment->setConstant(true);
compartment->setSize(314);
compartment->setSpatialDimensions(2.0);
compartment = model->createCompartment();
compartment->setId("Cytosol");
compartment->setConstant(true);
compartment->setSize(523);
compartment->setSpatialDimensions(3.0);
// create the Species
Species* species = model->createSpecies();
species->setId("C_EC");
species->setCompartment("Extracellular");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setHasOnlySubstanceUnits(false);
species = model->createSpecies();
species->setId("RTR_M");
species->setCompartment("PlasmaMembrane");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setHasOnlySubstanceUnits(false);
species = model->createSpecies();
species->setId("RCC_M");
species->setCompartment("PlasmaMembrane");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setHasOnlySubstanceUnits(false);
species = model->createSpecies();
species->setId("A_C");
species->setCompartment("Cytosol");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setHasOnlySubstanceUnits(false);
species = model->createSpecies();
species->setId("AA_C");
species->setCompartment("Cytosol");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setHasOnlySubstanceUnits(false);
species = model->createSpecies();
species->setId("T");
species->setCompartment("Cytosol");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setInitialConcentration(10);
species->setHasOnlySubstanceUnits(false);
species = model->createSpecies();
species->setId("S");
species->setCompartment("Cytosol");
species->setBoundaryCondition(false);
species->setConstant(false);
species->setInitialConcentration(5);
species->setHasOnlySubstanceUnits(false);
// create the Reactions
Reaction* reaction = model->createReaction();
reaction->setId("r1");
reaction->setReversible(true);
reaction->setFast(false);
reaction->setCompartment("Extracellular");
SpeciesReference* reactant = reaction->createReactant();
reactant->setSpecies("RTR_M");
//.........这里部分代码省略.........
示例5: main
LIBSBML_CPP_NAMESPACE_USE
int main(int argc,char** argv){
//
// Creates an SBMLNamespaces object with the given SBML level, version
// package name, package version.
//
// (NOTE) By defualt, the name of package (i.e. "groups") will be used
// if the arugment for the prefix is missing or empty. Thus the argument
// for the prefix can be added as follows:
//
// SBMLNamespaces sbmlns(3,1,"groups",1,"GROUP");
//
SBMLNamespaces sbmlns(3,1,"groups",1);
//
// (NOTES) The above code creating an SBMLNamespaces object can be replaced
// with one of the following other styles.
//
// (1) Creates an SBMLNamespace object with a SBML core namespace and then
// adds a groups package namespace to the object.
//
// SBMLNamespaces sbmlns(3,1);
// sbmlns.addPkgNamespace("groups",1);
//
// OR
//
// SBMLNamespaces sbmlns(3,1);
// sbmlns.addNamespace(GroupsExtension::XmlnsL3V1V1,"groups");
//
// (2) Creates a GroupsPkgNamespaces object (SBMLNamespace derived class for
// groups package. The class is basically used for createing an SBase derived
// objects defined in the groups package) with the given SBML level, version,
// and package version
//
// GroupsPkgNamespaces sbmlns(3,1,1);
//
// create the document
SBMLDocument *document = new SBMLDocument(&sbmlns);
// create the Model
Model* model=document->createModel();
// create the Compartment
Compartment* compartment = model->createCompartment();
compartment->setId("cytosol");
compartment->setConstant(true);
compartment=model->createCompartment();
compartment->setId("mitochon");
compartment->setConstant(true);
// create the Species
Species* species = model->createSpecies();
species->setId("ATPc");
species->setCompartment("cytosol");
species->setInitialConcentration(1);
species->setHasOnlySubstanceUnits(false);
species->setBoundaryCondition(false);
species->setConstant(false);
species = model->createSpecies();
species->setId("ATPm");
species->setCompartment("mitochon");
species->setInitialConcentration(2);
species->setHasOnlySubstanceUnits(false);
species->setBoundaryCondition(false);
species->setConstant(false);
// create the Groups
//
// Get a GroupsModelPlugin object plugged in the model object.
//
// The type of the returned value of SBase::getPlugin() function is SBasePlugin*, and
// thus the value needs to be casted for the corresponding derived class.
//
GroupsModelPlugin* mplugin = static_cast<GroupsModelPlugin*>(model->getPlugin("groups"));
//
// Creates a Group object via GroupsModelPlugin object.
//
Group* group = mplugin->createGroup();
group->setId("ATP");
group->setKind(GROUP_KIND_CLASSIFICATION);
group->setSBOTerm("SBO:0000252");
Member* member = group->createMember();
member->setIdRef("ATPc");
member = group->createMember();
//.........这里部分代码省略.........