From: Eric F. <efe...@ph...> - 2008-11-07 13:48:36
|
Hi Rainer, Sorry for this late reply, I was away. Thanks a lot for these info. These suggestions look good to me (in particular ODEModel_getVariableIndexFromSBase). Eric > -----Original Message----- > From: Rainer Machne [mailto:ra...@tb...] > Sent: 30 October 2008 14:52 > To: Eric Fernandez > Subject: Re: [SOSlib-discuss] equivalent to observablesArray > ?[Scanned] > > Eric Fernandez wrote: > > Hi, > > > > I shall answer to myself. What I want is returned by: > > > > for ( int i = 0; i != Model_getNumSpecies(om->m); i++ ) > > Hi Eric, > > We should probably introduce an interface function for om->m. > This SBML model, btw, is exactly the model from the input file. > > I have jsut added to CVS two new functions: > > const Model_t *ODEModel_getInputSBMLl(om) > > returns the pointer om->m, i.e. the input SBML. And > > const Model_t *ODEModel_getODESBMLl(om) > > returns the pointer om->simple, which is an internally > produced SBML model where all reactions have been replaced by > SBML rate rules. > > > > { > > Species_t *species = Model_getSpecies(om->m, i); > > cout << Species_getId(species) << " "; > > } > > > > (the same way the observables were built before). > > > > > Just a warning for potential other readers: > > Above code to get the Species from the input SBML model is not really > relevant for getting values from the derived ODE model or the > integrator: > The order of species, parameters, rules and reactions in the > input SBML > DOES NOT correspond to the order of 1) ODE variables, 2) assigned > variables, 3) constants in odeModel (om->names) and cvodeData > (data->values). There is no direct mapping between SBML and > ODE models. > > The way to interface variables/parameters of the derived ODE > Model is as > follows: > > 1) Get a variableIndex_t from the ODEModel, each by the function > > > variableIndex_t *ODEModel_getVariableIndex (odeModel_t *om, > const char > *symbol) > > To map this from the SBML model, you could set the string in above > function: > symbol = Species_getId(species) > > There are however various other functions to retrieve > specific variables > from the ODE model. Now, that i am writing this, maybe we can > introduce > simple convenience functions, which allow to get the > variableIndex just > via SBML species, parameter, compartment or reaction pointers, e.g.: > > ODEModel_getVariableIndexFromSBase > > Interested? It is rather trivial though. > > 2) Use this variableIndex to get the current values from the > integrator by > > IntegratorInstance_getVariableValue(integratorInstance_t *engine, > variableIndex_t *vi) > > > I guess you know that, but maybe it's helpful for others. > > Rainer |