Commit 73c8176f authored by Sylvain Soliman's avatar Sylvain Soliman
Browse files

Adding SBML API for main units

parent 6538e492
......@@ -12,6 +12,9 @@
model_getListOfParameters/2,
model_getListOfRules/2,
model_getSpeciesById/3,
model_getTimeUnits/2,
model_getSubstanceUnits/2,
model_getVolumeUnits/2,
listOf_get/3,
listOf_size/2,
reaction_getKineticLaw/2,
......
......@@ -567,6 +567,45 @@ pl_compartment_getVolume(term_t compartment_term, term_t volume_term) {
}
static foreign_t
pl_model_getTimeUnits(
term_t model_term, term_t units_term
) {
const char *units;
Model_t *model;
PL_check(PL_get_model(model_term, &model));
PL_check(units = Model_getTimeUnits(model));
PL_check(PL_unify_atom_chars(units_term, units));
PL_succeed;
}
static foreign_t
pl_model_getSubstanceUnits(
term_t model_term, term_t units_term
) {
const char *units;
Model_t *model;
PL_check(PL_get_model(model_term, &model));
PL_check(units = Model_getSubstanceUnits(model));
PL_check(PL_unify_atom_chars(units_term, units));
PL_succeed;
}
static foreign_t
pl_model_getVolumeUnits(
term_t model_term, term_t units_term
) {
const char *units;
Model_t *model;
PL_check(PL_get_model(model_term, &model));
PL_check(units = Model_getVolumeUnits(model));
PL_check(PL_unify_atom_chars(units_term, units));
PL_succeed;
}
PL_extension sbml_predicates[] = {
{ "readSBML", 2, (pl_function_t) pl_readSBML, 0 },
{ "sbmlDocument_getNumErrors", 2, (pl_function_t) pl_sbmlDocument_getNumErrors, 0 },
......@@ -580,6 +619,9 @@ PL_extension sbml_predicates[] = {
{ "model_getListOfRules", 2, (pl_function_t) pl_model_getListOfRules, 0 },
{ "model_getListOfFunctions", 2, (pl_function_t) pl_model_getListOfFunctions, 0 },
{ "model_getSpeciesById", 3, (pl_function_t) pl_model_getSpeciesById, 0 },
{ "model_getTimeUnits", 2, (pl_function_t) pl_model_getTimeUnits, 0 },
{ "model_getSubstanceUnits", 2, (pl_function_t) pl_model_getSubstanceUnits, 0 },
{ "model_getVolumeUnits", 2, (pl_function_t) pl_model_getVolumeUnits, 0 },
{ "listOf_get", 3, (pl_function_t) pl_listOf_get, 0 },
{ "listOf_size", 2, (pl_function_t) pl_listOf_size, 0 },
{ "reaction_getKineticLaw", 2, (pl_function_t) pl_reaction_getKineticLaw, 0 },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment