Exemplo n.º 1
0
int rrcCallConv getNumberOfRules(RRHandle handle)
{
    start_try
        RoadRunner* rri = castToRoadRunner(handle);
        if(!rri->getModel())
        {
            Log(Logger::LOG_WARNING)<<"Model is not allocated.";
            return -1;
        }
        int value = rri->getModel()->getNumRules();
        return value;
    catch_int_macro
}
Exemplo n.º 2
0
void TestRoadRunner::testRead(const std::string &fname)
{
    Logger::enableConsoleLogging(Logger::LOG_DEBUG);
    //const char* fname = "/Users/andy/src/sbml_test/cases/semantic/00001/00001-sbml-l2v4.xml";

    libsbml::SBMLReader reader;

    SBMLDocument *doc = reader.readSBML(fname);


    Model *m = doc->getModel();

    const ListOfParameters *params = m->getListOfParameters();

    for(int i = 0; i < params->size(); ++i)
    {
        const Parameter *p = params->get(i);

        cout << "param \'" << p->getId() << "\', conservedMoiety: "
                << ConservationExtension::getConservedMoiety(*p) << endl;
    }

    const ListOfSpecies *species = m->getListOfSpecies();

    for(int i = 0; i < species->size(); ++i)
    {
        const Species *s = species->get(i);

        cout << "species \'" << s->getId() << "\', conservedMoiety: "
                        << ConservationExtension::getConservedMoiety(*s) << endl;

    }


    delete doc;

    Logger::setLevel(Logger::LOG_TRACE);

    RoadRunner r;

    r.load(fname, 0);


    rr::ExecutableModel *model = r.getModel();

    int len = model->getNumIndFloatingSpecies();
    double *buffer = new double[len];

    model->getFloatingSpeciesAmountRates(len, 0, buffer);

    delete[] buffer;



    cout << "its all good" << endl;
}