A fix for correctly updating scale factors after finalization of the simulation (as required for the respective functionality in R and Matlab-Toolbox, see https://github.com/Open-Systems-Pharmacology/R-Toolbox/issues/52) can be implemented by adding a list of referenced formulas to a species object. This requires each formula to have a valid id, which is true for all formulas created.
However, ExplicitFormulaExtender does not possess an id, and unit tests utilizing ExplicitFormulaExtender would fail. Please add a respective field.
To clarify: the proposed fix adds a TObjectList<Formula> _allFormulaList; to the species class. Upon finalization of a formula, the formula is added to _allFormulaList of each species referenced by the formula:
for (unsigned int i = 0; i < _quantityRefs.size(); i++)
{
QuantityReference quantityRef = _quantityRefs[i];
if (quantityRef.IsSpecies())
{
SimModelNative::Species * species = quantityRef.GetSpecies();
species->AddFormulaReference(this);
}
}
A fix for correctly updating scale factors after finalization of the simulation (as required for the respective functionality in R and Matlab-Toolbox, see https://github.com/Open-Systems-Pharmacology/R-Toolbox/issues/52) can be implemented by adding a list of referenced formulas to a species object. This requires each formula to have a valid id, which is true for all formulas created.
However, ExplicitFormulaExtender does not possess an id, and unit tests utilizing ExplicitFormulaExtender would fail. Please add a respective field.
To clarify: the proposed fix adds a
TObjectList<Formula> _allFormulaList;
to the species class. Upon finalization of a formula, the formula is added to_allFormulaList
of each species referenced by the formula:with
_allFormulaList.Add(formula);
fails if formula has no ID, which is the case with ExplicitFormulaExtender used in unit tests.