From: Rainer M. <ra...@tb...> - 2006-08-07 13:16:41
|
And one more important thing: The reason to keep the names and values array separated is mainly to make it possible to run multiple integrations, i.e. different values, with one odeModel. I.e. you can create as many integratorInstance_t structures from one odeModel_t as you like. And again, the main interface to the names and values is the structure variableIndex_t. See the get/set functions for the integratorInstance_t http://www.tbi.univie.ac.at/~raim/odeSolver/doc/api/group__integrator.html#ga10 and for the odeModel_t at http://www.tbi.univie.ac.at/~raim/odeSolver/doc/api/group__variableIndex.html Rainer On Mon, 7 Aug 2006, Rainer Machne wrote: > > Hi Eryk, > > I know the nvalues array can be confusing. The main problem is that > keeping all values of the model, i.e. current values of variables (ODE and > assignment equations) and parameters in ONE array makes a lot of things, > such as formula evaluation and setting of the values via interface > functions, much easier. > >> Question? What is the length of the names array? > > The arrays "names" in odeModel_t and "values" in cvodeData_t and > cvodeResults_t correspond to each other. They have the same length > "nvalues". > > The neq, nalg (currently always == 0), nass and nconst are offsets in > these arrays. > > Note that, > nvalues = neq + nalg + nass + nconst; > >> What are the indices of the species please? > > It is important to realize that SBML species have no unique mapping to the > odeModel_t. > > If they are defined by an ODE their name and value is found in > odeModel->names[i] and > cvodeData->values[i], respectively, > where i is from 0 to (neq-1) > > If they are defined by an assignment rule i is from neq to (neq+nass -1), > and if they are constant (including constants changed by an event) i is > from (neq+nass) to (neq+nass+nvalues -1). > >> How to determine the indices of the x(t), etc?? > > As said above cvodeData->values[i] is the value of the > variable or parameter in odeModel->names[i]. > > If you want the current value of an object of the SBML model, you can also > use the variableIndex_t via the functions: > > variableIndex_t *ODEModel_getVariableIndex (odeModel_t *om, const char *symbol) > where "symbol" is the SBML ID of this object. > > Then you can use > > double IntegratorInstance_getVariableValue (integratorInstance_t *engine, > variableIndex_t *vi) > > to get the value of this object or use > > void IntegratorInstance_setVariableValue (integratorInstance_t *engine, > variableIndex_t *vi, double value) > > to set the object to the passed double value. > > Did this make it any clearer?? > > Rainer > > > On Tue, 1 Aug 2006, W Eryk Wolski wrote: > >> Hi, >> >> An old questions revisited? >> >> in definition of structure odeModel, >> >> /** All names, i.e. ODE variables, assigned parameters, and constant >> parameters */ >> char **names; >> >> int neq; /**< number of ODEs */ >> int nalg; /**< number of algebraic rules */ >> int nass; /**< number of assigned variables (nass) */ >> int nconst; /**< number of constant parameters */ >> >> Question? What is the length of the names array? >> >> >> In definition of structure cvodeResults >> >> /** number of variables for which results exist */ >> int nvalues; >> /** the following arrays represent the time series of all variables >> and parameters of the model */ >> double **value; >> >> Question: >> What are the indices of the species please? >> >> >> In defintion of structure cvodeData >> >> /** total number of values (variables x(t) + parameters p) */ >> int nvalues; >> /** value array is used to write and read the current values of >> all variables x(t) and parameters p of the system (of which >> there are `nvalues') */ >> double *value; >> >> How to determine the indices of the x(t), etc?? >> >> >> For me this issue is confusing since I have started to play arround >> with soslib. >> >> Eryk >> >> ------------------------------------------------------------------------- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to share your >> opinions on IT & business topics through brief surveys -- and earn cash >> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> sbmlsolver-devel mailing list >> sbm...@li... >> https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel >> > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > sbmlsolver-devel mailing list > sbm...@li... > https://lists.sourceforge.net/lists/listinfo/sbmlsolver-devel > |